fix: nested replacement tracked-change decisions#3557
Merged
harbournick merged 7 commits intoMay 30, 2026
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30467182c2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
cubic analysis
No issues found across 4 files
Linked issue analysis
Linked issue: SD-3293: BUG: Replacement inside another user's tracked insertion/deletion resolves parent and child changes incorrectly
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | Create a single child replacement change (rather than separate insert/delete children) when a user replaces text inside another user's unresolved insertion. | Overlap compiler and tests were changed to expect one replacement child attached to the parent rather than separate insertion/deletion children; the test asserts change.type === Replacement and checks deleted/inserted segments and overlapParentId. |
| ✅ | Preserve the parent insertion/deletion as attributable to the original author (parent remains an independent change) when a nested replacement is created. | Compiler changes preserve the parent change and annotate child segments with overlapParentId; tests assert the parent change still exists and is of the expected type. |
| ✅ | Rejecting a nested replacement should restore/preserve the inferred parent deletion across split fragments (i.e., rejecting the child does not remove the parent deletion content improperly). | A new decision-engine unit test explicitly exercises rejecting a replacement that splits same-author deletion fragments and expects the parent deletion to be restored and remain as a single deletion change with the combined text. |
| Accepting a nested replacement should resolve only the selected portion (replace only the selected part of the parent's inserted text) and keep the remaining parent insertion intact. | The decision-engine changes include logic to plan replacement resolution and the compiler creates a single replacement change, which are necessary to support correct acceptance behavior, but I don't see an explicit acceptance-resolution unit test in this diff that verifies accepting a nested replacement updates only the selected portion and preserves the rest of the parent insertion. | |
| Rejecting a nested replacement inside a parent's insertion should remove only the replacement and leave the parent's insertion intact. | The PR adds restoration logic for parent contexts and preserves parent metadata; however, the diff includes an explicit test for deletion-case restoration but I don't see a corresponding explicit test for rejecting a replacement inside a parent insertion in the provided changes. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.