F6: diff-view toggle (Feature #17) #18

Merged
benstull merged 9 commits from f6-diff-view-toggle into main 2026-06-11 14:21:46 +00:00
2 changed files with 54 additions and 1 deletions
Showing only changes of commit 2edb66fe4c - Show all commits
+28 -1
View File
@@ -13,7 +13,8 @@ catalog (a pure, key-free SDK call) in a notification and the
Features shipped so far: F2 region-anchored threads (Feature #4), F3 live Features shipped so far: F2 region-anchored threads (Feature #4), F3 live
human/Claude attribution (Feature #6), F4 propose/accept diff flow human/Claude attribution (Feature #6), F4 propose/accept diff flow
(Feature #12). (Feature #12), F5 cross-rung sidecar contract (Feature #14), F6 diff-view
toggle (Feature #17).
## Architecture ## Architecture
@@ -131,6 +132,32 @@ record per the contract; git push/pull is the transport, no re-homing ever.
Design: `vscode-cowriting-plugin-content/specs/coauthoring-cross-rung-format.md`. Design: `vscode-cowriting-plugin-content/specs/coauthoring-cross-rung-format.md`.
## F6 — Diff-view toggle (Feature #17)
**Cmd/Ctrl-Alt-D** (or **Cowriting: Toggle Diff View**) flips a tracked
document into a native `vscode.diff` against a **coauthoring baseline** — the
readonly baseline on the left, your **live, editable** document on the right
(so you keep writing inside the diff; toggling again closes it). The diff
answers "what did *I* change?" in one keystroke instead of git archaeology.
- **Machine-factored baseline (INV-18):** the baseline initializes when a doc
is first tracked and **advances automatically at every machine landing**
(every successful `applyAgentEdit` seam apply — INV-9). So text Claude landed
never shows as a change; everything the diff shows is operator-authored by
construction — no attribution filtering.
- **Pin on demand:** **Cowriting: Pin Diff Baseline to Now** resets the
baseline to the current buffer for a deliberate "review my next pass" epoch;
the diff tab title names the epoch (`opened` / `Claude landed` / `pinned`).
- **Pure view, repo-free (INV-19):** the baseline snapshot lives in VS Code
workspace storage, **never** the repo — `.threads/`, the cross-rung contract
(INV-14..17), and `SCHEMA_VERSION` are untouched. Storage-unavailable
degrades to in-memory baselines + one warning.
- **No LLM in CI:** host E2E (`test/e2e/suite/diffView.test.ts`) drives the same
programmatic seam ingress (propose + accept) the F4 suite uses.
Design: `vscode-cowriting-plugin-content/specs/coauthoring-diff-view.md`.
Live smoke: [`docs/MANUAL-SMOKE-F6.md`](docs/MANUAL-SMOKE-F6.md).
## Develop ## Develop
- `npm run watch` — rebuild on change. - `npm run watch` — rebuild on change.
+26
View File
@@ -0,0 +1,26 @@
# Manual smoke — F6 diff-view toggle (live)
Pre-req: a real machine (not CI). Step 4 uses a live Claude turn — Claude Code
installed + signed in (the `claude-code` provider rides that login, INV-8). The
rest of F6 needs no credentials and no network.
1. `npm run build`, launch the extension (F5 in VS Code opens the committed
`sandbox/` playground), open `playground.md`.
2. Edit a sentence by hand, then **Cmd/Ctrl-Alt-D** (or run **Cowriting: Toggle
Diff View**). ✅ A diff opens: the readonly baseline on the left, your live
document on the right; the tab title reads `playground.md — my changes since
opened <time>`. Your hand edit shows as a change.
3. Keep typing **in the diff's right pane**. ✅ Editing continues in place;
decorations/threads still work. Toggle again. ✅ The diff tab closes and the
normal editor is back.
4. Select a sentence → right-click → **Ask Claude to Edit Selection** → give an
instruction → **✓ Accept Proposal**. Now toggle the diff. ✅ The accepted
text is **not** shown as a change (the baseline advanced past the landing —
INV-18); only your own subsequent edits show.
5. Run **Cowriting: Pin Diff Baseline to Now**. ✅ The diff empties (baseline =
now); the title reads `pinned <time>`. Type → your changes show against the
pin.
6. Reload the window (Developer: Reload Window). ✅ Toggle: the baseline is the
same as before the reload (persisted in workspace storage, not the repo —
INV-19; `git status` shows nothing new).
7. Toggle on a file outside the workspace folder. ✅ A warning, no diff.