-
-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle concurrent Tree.RemoveStyle #883
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,16 +71,18 @@ func NewTreeStyleRemove( | |
parentCreatedAt *time.Ticket, | ||
from *crdt.TreePos, | ||
to *crdt.TreePos, | ||
maxCreatedAtMapByActor map[string]*time.Ticket, | ||
attributesToRemove []string, | ||
executedAt *time.Ticket, | ||
) *TreeStyle { | ||
return &TreeStyle{ | ||
parentCreatedAt: parentCreatedAt, | ||
from: from, | ||
to: to, | ||
attributes: map[string]string{}, | ||
attributesToRemove: attributesToRemove, | ||
executedAt: executedAt, | ||
parentCreatedAt: parentCreatedAt, | ||
from: from, | ||
to: to, | ||
maxCreatedAtMapByActor: maxCreatedAtMapByActor, | ||
attributes: map[string]string{}, | ||
attributesToRemove: attributesToRemove, | ||
executedAt: executedAt, | ||
} | ||
} | ||
|
||
|
@@ -100,7 +102,7 @@ func (e *TreeStyle) Execute(root *crdt.Root) error { | |
return err | ||
} | ||
} else { | ||
pairs, err = obj.RemoveStyle(e.from, e.to, e.attributesToRemove, e.executedAt) | ||
_, pairs, err = obj.RemoveStyle(e.from, e.to, e.attributesToRemove, e.executedAt, e.maxCreatedAtMapByActor) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tip Codebase Verification The search results indicate that there are existing tests for the
Please add unit tests that specifically target the new Analysis chainEnsure that the Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify that the new logic in `RemoveStyle` is covered by unit tests.
# Test: Search for unit tests covering the new logic in `RemoveStyle`.
rg --type go $'func Test.*RemoveStyle' test/
Length of output: 45 Script: #!/bin/bash
# Locate the definition of the `RemoveStyle` method to understand its context.
ast-grep --lang go --pattern 'func ($_).RemoveStyle($_, $_, $_, $_, $_) { $$$ }'
# Search for any tests related to `RemoveStyle`.
rg --type go 'RemoveStyle' test/
# Specifically look for tests involving the `maxCreatedAtMapByActor` parameter.
rg --type go 'maxCreatedAtMapByActor' test/
Length of output: 608 |
||
if err != nil { | ||
return err | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The
canStyle
method intree.go
explicitly prevents text nodes from being styled by returningfalse
ifn.IsText()
istrue
. This contradicts the change in theStyle
method, which now allows text nodes to be styled.pkg/document/crdt/tree.go:397-399
: ThecanStyle
method returnsfalse
for text nodes.pkg/document/crdt/tree.go:989
: TheStyle
method now allows text nodes to be styled ifcanStyle
returnstrue
.This inconsistency needs to be addressed to ensure the logic is coherent.
Analysis chain
Verify the consistency of allowing text nodes to be styled here, given the update in
canStyle
method.Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 36
Script:
Length of output: 1524