#46 (SLICE-3, accept): Accept all pending proposals in one gesture

Document-edit flow SLICE-3 — completes reach→review→accept
(specs/coauthoring-document-edit-flow.md §7.2, INV-42). A single "Accept all"
gesture applies every pending proposal on the current document through the
existing F4 acceptById seam (block proposals take the INV-40 word-precise path
automatically), in descending anchor order so an earlier accept never invalidates
a later one, skipping (never force-applying) proposals that can't anchor and
reporting applied-vs-skipped. Batched application of the existing accept path — no
new mechanism; the webview posts intent only (INV-35). No confirmation dialog
(undo restores).

- proposalController.ts: acceptAllProposals(document) → {applied, skipped}
  (descending order, orphan-skip); accept/acceptById gain a silent opt so the
  batch suppresses N per-proposal orphan warnings in favour of one report.
- trackChangesPreview.ts: ToolbarMsg += {type:"acceptAll"}; handleWebviewMessage
  routes it to a public acceptAll(document) that batches + reports.
- extension.ts + package.json: cowriting.acceptAllProposals command (active doc,
  markdown-gated palette entry) for the non-webview path.
- media/preview.ts + shellHtml: "✓✓ Accept all" toolbar button, posting the
  intent, shown only with ≥2 pending proposals (authorable, on-state).
- trackChangesModel.ts: diffToBlockHunks now emits one block-aligned hunk per
  CHANGED block even when changed blocks are ADJACENT (treats changed blocks as
  1:1 anchors alongside unchanged ones; gap-spans only cover add/remove runs
  between anchors) — fixes adjacent changed blocks collapsing into one proposal.
- f12Accept host E2E (apply-all reconstructs; orphan skip + report; single
  proposal; command registered/gated); MANUAL-SMOKE-F12 §3.

214 unit + 73/5 host E2E green. Completes the document-edit-flow cluster
(#42 reach + #47 review + #46 accept).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ben Stull
2026-06-13 08:15:55 -07:00
parent 6fd7555183
commit c94b9ccfe7
8 changed files with 286 additions and 36 deletions
+27
View File
@@ -67,3 +67,30 @@ light copy-edit instruction (e.g. "tighten the prose, fix typos").
A document edit yields one in-context proposal per changed block (fences atomic);
accepting a block lands the whole block but Claude-attributes only the words it
changed; inserted blocks accept; selection edits are unaffected; no console errors.
## SLICE-3 — #46 (accept): Accept all (INV-42)
On a markdown doc, **Ask Claude to Edit Document** with a pass that changes
**several** blocks, so the preview shows **≥ 2** pending proposals.
1. **Button appears at ≥2 (PUC-6).** The preview toolbar shows **✓✓ Accept all**
only when there are **2 or more** pending proposals (and the doc is authorable,
annotations on). With 01 pending it is hidden.
2. **One gesture applies all.** Click **Accept all**: every pending proposal lands
(Claude-attributed per INV-40), the ✓/✗ blocks clear, and a status message
reports how many were accepted. No confirmation dialog.
3. **Undo restores.** `Ctrl+Z` walks back the applied edits (consistent with
single accept; a block accept is itself N steps — see SLICE-2).
4. **Orphan-skip + report.** If one proposal's target text was changed by hand
first (so it can't anchor), Accept all applies the rest and the report says
`… , N skipped (target text changed — undo or reject)`; the orphaned proposal
stays pending, its text untouched (never force-applied).
5. **Command path.** With no preview panel open, the command palette **Cowriting:
Accept All Claude Proposals** (markdown-gated) applies all proposals on the
active doc with the same report.
### Pass criteria
Accept all is offered only at ≥2 pending; one click applies every resolvable
proposal and reports the tally; orphans are skipped (not mangled) and remain
pending; the palette command works on the active doc; no console errors.