Draft review view: accept/reject changes in-app + full review-state reads#172
Open
mhurhangee wants to merge 8 commits into
Open
Draft review view: accept/reject changes in-app + full review-state reads#172mhurhangee wants to merge 8 commits into
mhurhangee wants to merge 8 commits into
Conversation
The backend for the draft review panel:
- read_draft now shows the FULL review state — pending redlines inline
as {++inserted++}/{--deleted--} (tagged with the author when it isn't
Patrick), and comments listed under the paragraph they anchor to. The
agent no longer reads past its own tracked changes and the attorney's
comments as if the document were clean.
- resolveParagraphRevision accepts/rejects Patrick's redline in ONE
paragraph in place (the paragraph IS the change unit — the adapter
supersedes, so a paragraph only ever holds one round). Mirror DOM
surgery of the reject path: accept unwraps w:ins / drops w:del. Rides
the dance as a 'resolve' op (parks while the draft is open in Word).
- docx-text returns runs (each carrying its w:id + author) + comments in
one fetch; listComments reports each comment's anchor paragraph;
DraftStatus.parkedOps summarises what's queued.
DraftPanel becomes a review surface: a Review mode (default) condensing the draft to just the changed and commented paragraphs, each a card with the redlined text and Accept / Reject buttons that resolve the change in place through the dance — no need to open Word. A change queued behind an open Word lock shows a 'queued — close the draft to apply' badge (parsed from the dance's parkedOps). A Document mode toggle keeps the full-text read. Comments render on the card of the paragraph they anchor to.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
relockDocument flips an unlocked original back to read-only — it drops out of the draft world (still readable/pinnable). The pristine backup stays, so re-unlocking reuses it rather than re-snapshotting; any of Patrick's tracked changes already in the file remain for review in Word. Surfaced as a 'Lock (stop editing)' item in the document kebab menu, mirroring 'Unlock for editing'.
Working through the semantics showed the living-doc's 'accept then redline' shortcut breaks reject-to-original (collapses the change chain, loses the original text) — so both edit directions need the bespoke stacking splice, not superseding. Captured the algorithm + overlap rules + test matrix so it's implementation-ready.
mhurhangee
added a commit
that referenced
this pull request
Jul 4, 2026
Correctness: - resolveParagraphRevision is content-addressed (expectedText) + verified before write, not bare-index — a Word-side save or list-rewrite that shifts paragraph indices can no longer accept/reject the wrong change - re-lock discards the draft's parked ops (dance.discardParked) — the attorney locked it to STOP editing; queued edits must not drain in - the review card only offers Accept/Reject on Patrick's own redline (docx-text now marks paragraphs ); the attorney's own tracked changes show a 'resolve in Word' note instead of no-op buttons - unanchored comments (no resolvable paragraph anchor) surface in a trailing section instead of being silently dropped - a failed/refused resolve now shows an error in the panel Robustness: - read_draft hands the agent an explicit target_text line on revised paragraphs (no lossy reconstruction from CriticMarkup) Cleanup: - parkedOps carry a structured paragraphIndex (no regex on a display string for the queued badge) - one shared collectByAuthor helper for accept/reject surgery - readDraftReview loads+parses the docx once for runs + comments (the polled review path no longer double-unzips)
Correctness: - resolveParagraphRevision is content-addressed (expectedText) + verified before write, not bare-index — a Word-side save or list-rewrite that shifts paragraph indices can no longer accept/reject the wrong change - re-lock discards the draft's parked ops (dance.discardParked) — the attorney locked it to STOP editing; queued edits must not drain in - the review card only offers Accept/Reject on Patrick's own redline (docx-text now marks paragraphs resolvable); the attorney's own tracked changes show a "resolve in Word" note instead of no-op buttons - unanchored comments (no resolvable paragraph anchor) surface in a trailing section instead of being silently dropped - a failed/refused resolve now shows an error in the panel Robustness: - read_draft hands the agent an explicit target_text line on revised paragraphs (no lossy reconstruction from CriticMarkup) Cleanup: - parkedOps carry a structured paragraphIndex (no regex on a display string for the queued badge) - one shared collectByAuthor helper for accept/reject surgery - readDraftReview loads+parses the docx once for runs + comments (the polled review path no longer double-unzips)
0715cb3 to
b524504
Compare
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.
First slice of the draft-review-panel fast-follow (
living-docs/draft-review-panel.md, items 2 + 3). Addresses the feedback from the first real drafting sessions: the plain-text preview was a mistake, andread_draftwas blind to its own redlines + comments.Review view (replaces the plain preview)
DraftPanelis now a review surface. Default Review mode condenses the draft to just the changed and commented paragraphs, each a card with the redlined text (real ins/del marks) and Accept / Reject buttons that resolve the change in place — no need to open Word. A change queued behind an open Word lock shows a "queued — close the draft to apply" badge. A Document mode toggle keeps the full-text read. Comments render on the card of the paragraph they anchor to.resolveParagraphRevision(adapter) — accept/reject Patrick's redline in one paragraph. The paragraph is the change unit (the adapter supersedes, so a paragraph only ever holds one round of Patrick's revisions). Mirror DOM surgery of the reject path: accept unwrapsw:ins/ dropsw:del.resolveop — parks while the draft is open in Word, drains on close, persists across restart, serialized like every other mutation.read_draft full review state (agent visibility)
read_draftnow shows pending redlines inline as{++inserted++}/{--deleted--}(tagged with the author when it isn't Patrick), and lists comments under the paragraph they anchor to. The agent no longer reads past its own tracked changes and the attorney's comments as if the document were clean — the observed "ignores existing changes/comments" problem.Supporting
docx-textreturns runs (each carrying itsw:id+ author) + comments in one fetch;listCommentsreports each comment's anchor paragraph;DraftStatus.parkedOpssummarises what's queued.Testing
64 tests green (new: resolve accept/reject round-trips + no-op refusal, run revision-id/author, comment anchor paragraph, parked-op summaries, a resolve op through the dance). Routes smoke-tested end-to-end against a redlined USPTO fixture (docx-text → runs+comments, resolve accept → change goes permanent).
Manual check to do: drive a real drafting session in
pnpm dev— accept/reject cards, the queued badge while Word holds the draft open, the Review/Document toggle.Next in the plan: quick-edit + adjust/comment cards, overlap-aware attorney-revision editing, re-lock.