Skip to content

fix: nested replacement tracked-change decisions#3557

Merged
harbournick merged 7 commits into
mainfrom
nick/sd-3293-bug-replacement-inside-another-users-tracked
May 30, 2026
Merged

fix: nested replacement tracked-change decisions#3557
harbournick merged 7 commits into
mainfrom
nick/sd-3293-bug-replacement-inside-another-users-tracked

Conversation

@harbournick
Copy link
Copy Markdown
Collaborator

No description provided.

@harbournick harbournick self-assigned this May 28, 2026
@harbournick harbournick requested a review from a team as a code owner May 28, 2026 23:51
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 28, 2026

SD-3293

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Re-trigger cubic

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@harbournick harbournick merged commit 1371d49 into main May 30, 2026
70 checks passed
@harbournick harbournick deleted the nick/sd-3293-bug-replacement-inside-another-users-tracked branch May 30, 2026 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants