F6: diff-view toggle on any file (global storage, untitled in-memory) #20

Merged
benstull merged 3 commits from f6-any-file into main 2026-06-11 14:53:20 +00:00
Owner

Broadens F6 diff-view toggle to work on any file — not only files inside the opened workspace folder. Closes #19; builds on #17 (F6).

Why

Manual testing of #17 surfaced friction: Ctrl+Alt+D warned "open a tracked workspace document" for untitled buffers and files outside the folder. F6 reused F2 isTracked (= "workspace file", needed so threads/attribution can use the .threads/ sidecar) — but F6 needs no sidecar, only a stable doc identity + a storage home.

What (operator decisions, session 0019)

  • Own diffable predicatefile: or untitled:, decoupled from F2 isTracked. DiffViewController is now constructed before the no-folder activation branch, so the toggle/pin commands are always live (never stubbed) — F6 even works with no folder open.
  • Uniform global storage — baselines move to context.globalStorageUri keyed by sha256(documentUri) (one path for in-folder, out-of-folder, untitled). Still never the repo (INV-19). Baseline.docPathuri.
  • Untitled buffers — supported in-memory only (no durable identity to persist against; lost on reload, (unsaved) in the title). Saving promotes to a persisted file: baseline.

F2–F5 are untouched. The machine-landing advance wiring stays in the with-root branch (the seam only fires on workspace files).

Verification

  • npm run typecheck clean · npx vitest run 104 pass (BaselineStore re-keyed).
  • npm run test:e2e 28 + 4 pass (exit 0): adds an out-of-workspace file case (persisted in global storage), an untitled buffer case (in-memory, not persisted), and a no-folder activation case proving the toggle works folder-less. No LLM in CI.

Docs

  • Spec amended to v0.2.0 (coauthoring-diff-view.md §11 + §1.7/§6.3/§6.5/§6.7/INV-19/change log) — pushed to the content repo.
  • README F6 section + docs/MANUAL-SMOKE-F6.md updated (incl. fixing the Ctrl+Alt+D wording — it's Ctrl, not Cmd, on macOS too).

Session 0019.

🤖 Generated with Claude Code

Broadens **F6 diff-view toggle** to work on **any file** — not only files inside the opened workspace folder. Closes #19; builds on #17 (F6). ### Why Manual testing of #17 surfaced friction: `Ctrl+Alt+D` warned "open a tracked workspace document" for untitled buffers and files outside the folder. F6 reused F2 `isTracked` (= "workspace file", needed so threads/attribution can use the `.threads/` sidecar) — but **F6 needs no sidecar**, only a stable doc identity + a storage home. ### What (operator decisions, session 0019) - **Own diffable predicate** — `file:` or `untitled:`, decoupled from F2 `isTracked`. `DiffViewController` is now constructed *before* the no-folder activation branch, so the toggle/pin commands are **always live** (never stubbed) — F6 even works with no folder open. - **Uniform global storage** — baselines move to `context.globalStorageUri` keyed by `sha256(documentUri)` (one path for in-folder, out-of-folder, untitled). Still never the repo (INV-19). `Baseline.docPath` → `uri`. - **Untitled buffers** — supported **in-memory only** (no durable identity to persist against; lost on reload, `(unsaved)` in the title). Saving promotes to a persisted `file:` baseline. F2–F5 are untouched. The machine-landing `advance` wiring stays in the with-root branch (the seam only fires on workspace files). ### Verification - `npm run typecheck` clean · `npx vitest run` **104** pass (BaselineStore re-keyed). - `npm run test:e2e` **28 + 4** pass (exit 0): adds an **out-of-workspace file** case (persisted in global storage), an **untitled buffer** case (in-memory, not persisted), and a **no-folder** activation case proving the toggle works folder-less. No LLM in CI. ### Docs - Spec amended to **v0.2.0** (`coauthoring-diff-view.md` §11 + §1.7/§6.3/§6.5/§6.7/INV-19/change log) — pushed to the content repo. - README F6 section + `docs/MANUAL-SMOKE-F6.md` updated (incl. fixing the `Ctrl+Alt+D` wording — it's `Ctrl`, not `Cmd`, on macOS too). Session 0019. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
benstull added 3 commits 2026-06-11 14:53:08 +00:00
F6 no longer requires a workspace file. It gets its own diffable predicate
(any file: or untitled:) decoupled from F2 isTracked, keys baselines by a
sha256 of the document URI, and stores them in VS Code GLOBAL storage
(context.globalStorageUri) — always present, never the repo (INV-19). Untitled
buffers have no durable identity → in-memory baseline only (lost on reload).

DiffViewController is now constructed before the workspace-root check and its
commands are always live (never stubbed) — the machine-landing advance wiring
stays in the with-root branch since the seam only fires on workspace files.
BaselineStore generalized to key-by-hash (Baseline.docPath → uri).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Migrate test surface to URI-string keys; add out-of-workspace file (persisted
in global storage) + untitled-buffer (in-memory, not persisted) cases; assert
F6 toggle works with no folder open. No LLM.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
benstull merged commit 259f1672e6 into main 2026-06-11 14:53:20 +00:00
Sign in to join this conversation.