Repository navigation
feat(edit): warn when a whole-paragraph edit resolves other authors' revisions - #18
Merged
Merged
Conversation
…revisions A whole-paragraph content edit (`edit --at pN --text/--markdown/--runs`, a range edit, `--batch`, `code edit`) rebuilds the paragraph under a single-author model, so another author's pending insertion became plain text (or was dropped) and their deletion vanished — silently, exit 0. Interim behavior per maintainer decision on #17: the edit still applies, but the CLI now warns on stderr naming those authors and pointing at span edits, which keep the revisions pending. Detection diffs the edited region's revisions before vs after the rebuild, so it reports only what was actually lost. Refs #17 Triage-Routine: true Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012GoxD36rnNfg6uArkVxtJL
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.
🤖 docx-cli triage
What was wrong
A whole-paragraph content edit rebuilds the paragraph as if one author wrote it. On a paragraph holding Reviewer A's pending insertion and Reviewer B's pending deletion,
edit --at p0 --text "…" --track --author Editorturned A's insertion into plain text and removed B's deletion. It printededit p0and exited 0.What changed
This is option D, the interim fix you chose: the edit still applies, and a warning now goes to stderr (exit 0):
edit --at pNwith--text/--markdown/--runs, range edits (pN-pM),--batch(one warning per entry), andcode edit. A bare-cell target suggests the validtN:rRcC:p0:START-ENDform.--trackappears in the suggestions only when the edit itself was tracked.watchPendingRevisions(src/core/track-changes/pending-authors.ts) records other authors'<w:ins>/<w:del>/<w:moveFrom>/<w:moveTo>/<w:pPrChange>in the edited region before the rebuild, and reports the ones missing after it. Each rebuild path keeps something different: the--textdiff carries text boxes through, while--markdowndrops them. So only before/after comparison avoids false alarms and misses.Edit.paragraphnow returns{ node, resolvedAuthors }andEdit.rangereturns the authors. The CLI only prints.replace,edit --at pN:S-E) don't warn because they keep revisions.Verification
code edit;--text(no warning) and dropped by--markdown(warns);<w:pPrChange>;bun run check✅bun run test:unit✅ (1724 tests; the pre-commit hook's fullbun testpassed 1748).Editlens instead of duplicating the edit-kind checks in two CLI files. /code-review xhigh: replaced a predict-what-survives scan with the before/after comparison, and extended coverage to range edits andcode edit.Decisions for you
--dry-runcan't warn, because it exits before the edit runs.--verboseJSON confirmation; it's stderr only.edit --text ""/docx delete) also drops other authors' insertions, without a warning.edit --markdownon a paragraph anchoring a text box deletes the box. That's an older bug, outside this change.src/core/track-changes/CLAUDE.mdandtests/cli/edit.test.ts. I'll mergemaininto whichever lands second.Refs #17. This keeps #17 open for the real fix: keeping the revisions, e.g. by routing through #15's span engine.
🤖 Generated with Claude Code
https://claude.ai/code/session_012GoxD36rnNfg6uArkVxtJL
Generated by Claude Code