Repository navigation
fix(read): hide a revision nested inside a hidden one in the accepted/baseline views - #19
Merged
Merged
Conversation
…/baseline views
A run was classified by its innermost revision wrapper only, so an
Editor's <w:del> nested inside Reviewer A's still-pending <w:ins> showed
its text in `read --baseline` (and `wc`/`find --baseline`), although
`track-changes reject --all` removes the whole insertion with it.
A run is now visible in a view iff EVERY enclosing wrapper is visible in
that view (accepted hides del/moveFrom, baseline hides ins/moveTo,
current shows all). The reader keeps `trackedChange` as the innermost
wrapper and records the enclosing chain in the new optional
`TrackedChange.within` (absent on top-level wrappers, so an un-nested
document's AST is unchanged); one shared predicate, `isRevisionVisible`
in core/track-changes/revision-visibility.ts, is read by
paragraphTextAccepted/Baseline (so `wc` follows), find's per-view run
text, iterateBlocks({ view }) and the markdown renderer.
`track-changes list` keeps its record shape (no `within`).
Golden comparison against origin/main over every tests/fixtures/*.docx
(read in all views + --ast, wc and find in all views): 540 commands,
0 diffs. New tests cover del-in-ins (two authors), ins-in-del, and a
<w:br/> inside the nested deletion: `read --baseline` ≡ `reject --all`,
`read --accepted` ≡ `accept --all`, same for `wc`, and `find --baseline`
no longer matches the nested-deleted text.
Triage-Routine: true
Co-Authored-By: Claude Fable 5.1 <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
The reader decided whether a run is visible in
--accepted/--baselinefrom its innermost tracked-change wrapper only. A deletion nested inside another author's insertion therefore showed its text inread --baseline, even though rejecting every change removes it:What changed
isRevisionVisibleinsrc/core/track-changes/revision-visibility.ts). Accepted hides deletions/move-sources, baseline hides insertions/move-targets, current shows all.TrackedChange.within, optional; the run's ownkind/idstays the innermost wrapper).read --astis unchanged for documents without nested tracked changes.read(markdown),find,wc,iterateBlocks({ view }).track-changes listoutput shape is unchanged. Schema widened forwithin.Verification
read --baseline≡track-changes reject --allandread --accepted≡accept --allon: a deletion nested in another author's insertion, a third author's deletion nested in an insertion, and an insertion nested in a deletion. Tests assert all six equivalences pluswccounts andfind --baselineno longer matching nested-deleted text.main:read(all views,--ast),wc(all views) andfind(all views) over all 36 fixtures — 540 commands, 0 differences.bun run check✅bun run test:unit✅ (1736 tests, +12 new, no existing expectation changed)./code-review xhighof the full diff: no regressions againstmain. Pre-existing gaps it noted, left alone on purpose (each would changereadoutput for existing fixtures or is outside this change): the markdown renderer still prints a<w:br/>/<w:tab/>inside a hidden wrapper; tracked-deleted table rows are hidden byreadbut not byfind/wc; equations and note references ignore views;revNgrouping is nesting-blind (fixed separately in thereplace --trackinside another author's pending insertion credits the new text to that author, and misses the target next to a nested deletion #13 PR).Decisions for you
Part of the fix for #13 (the minimal #13 PR handles the write side; this handles the read side).
🤖 Generated with Claude Code
https://claude.ai/code/session_012GoxD36rnNfg6uArkVxtJL
Generated by Claude Code