feat(f11): SLICE-5 — gateway, non-authorable disabling, docs (#43)

Closes the F11 feature: makes the toolbar surface reachable end to end and
guards the edit controls. Per spec §6.4/§6.5/§7.2 SLICE-5.

- package.json: cowriting.showTrackChangesPreview added to editor/title
  (when: editorLangId == markdown) — the minimal right-click → Open Review
  Preview gateway (#41/#42 expand it later).
- trackChangesPreview: the gateway command accepts the tab's resource Uri
  (palette/keybinding still fall back to the active editor); refresh() sends an
  `authorable` flag on both render messages; `editControlsEnabled` test seam.
- webview: disable Pin + Ask-Claude on a non-authorable doc (Annotations stays
  active — reading is always allowed); RenderMessage.authorable.
- host E2E: the editor/title gateway opens the preview + is markdown-guarded;
  edit controls disabled on a non-authorable (read-only-scheme) markdown doc.
- docs: docs/MANUAL-SMOKE-F11.md (live smoke, 10 steps) + README F11 section +
  intro line.

205 unit + 53 host E2E green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ben Stull
2026-06-12 13:57:28 -07:00
parent 03b61ed43e
commit 1564ef562b
6 changed files with 178 additions and 6 deletions
+67
View File
@@ -0,0 +1,67 @@
# Manual smoke — F11 preview toolbar as the primary interaction surface (#43)
F11 makes the rendered preview's **header toolbar** the primary interaction
surface: beside the existing **Annotations** switch it gains a **Pin baseline**
button and a **single adaptive Ask-Claude button** (Edit Selection when text is
selected in the preview, Edit Document otherwise). The webview's *visual*
behavior — the buttons, the live label flip, and the selection→source mapping —
is verified **here**, not in the automated host E2E (the webview is a sealed
sandbox; the host's message→seam wiring is covered by the F11 E2E suite). Run
once per change that touches F11. Live turns hit the SDK; use a trivial
instruction to keep them quick.
## Setup
1. `npm run build`
2. Launch the Extension Development Host (F5 in VS Code, or the Run panel) with
`sandbox/` open.
3. Open a markdown document with a few paragraphs (e.g. copy
`test/e2e/fixtures/workspace/docs/preview.md`).
## Steps
1. **Right-click gateway (PUC-6).** Right-click the markdown editor **tab** (or
use the editor title bar) → **"Cowriting: Open Review Preview"**. The preview
opens beside the editor. (The palette entry and `Ctrl+Alt+R` still work too.)
2. **Three header controls (PUC-1).** The header row shows, left to right: the
**☑ Annotations** checkbox (on), a **⌖ Pin baseline** button, and a **✦ Ask
Claude to Edit Document** button. They restyle with the theme.
3. **Adaptive label — selection (PUC-2).** Select a paragraph **in the preview**
(drag across rendered text). The Ask-Claude button label flips live to **"✦
Ask Claude to Edit Selection"**. Click elsewhere to clear the selection → it
flips back to **"✦ Ask Claude to Edit Document"**.
4. **Edit Selection (PUC-3).** With a paragraph selected in the preview, click
**Ask Claude to Edit Selection** → a host input box appears → type an
instruction (e.g. "tighten this") → submit. A **blue `cw-proposal` block**
appears **inline at that paragraph** with **✓ / ✗** (the selection mapped back
to its source block; the edit ran host-side). The editor does **not** change
(INV-10). Accept with **✓**: the replacement lands; the block clears.
5. **Edit Document (PUC-4).** Clear the selection (button reads "Edit Document").
Click it → instruct (e.g. "fix any typos and tighten") → submit. Claude's
whole-document rewrite surfaces as **one or more** independent blue proposal
blocks (one per changed hunk), each independently **✓ / ✗**-able. Accept some,
reject others — each behaves as an ordinary F10 proposal.
6. **Pin baseline (PUC-5).** Make (or accept) a few changes so the preview shows
change-marks and a non-zero summary. Click **⌖ Pin baseline**. Expect: the
change-marks **clear**, the summary resets to `+0 0`, and the header epoch
reads **`pinned <time>`**. "What changed" now counts from this moment.
7. **Off-state still maps (INV-36).** Toggle **Annotations** off (clean preview).
Selecting a paragraph still flips the button to **Edit Selection** and an edit
still works — the off/clean preview is also a selection→source surface.
8. **Non-authorable doc (PUC-1/7).** Open a markdown doc from a read-only/virtual
source (e.g. a Git diff view, or an Output channel rendered as markdown) and
open the preview. Expect: **Pin baseline** and **Ask-Claude** render
**disabled**; the **Annotations** toggle stays active (reading is allowed).
9. **Theme.** Toggle light / dark / high-contrast (`Ctrl+K Ctrl+T`). The two
toolbar buttons (enabled, hover, disabled states) restyle and stay legible.
10. **Cleanliness.** `git status` shows nothing written to the document, sidecar,
or repo by the toolbar gestures except the edits you explicitly accepted
(INV-20/35).
## Pass criteria
All ten steps behave as described; the adaptive label tracks the live selection;
the selection-scoped edit anchors at the right paragraph; the document edit
produces per-hunk proposals; pin clears the marks; edit controls are inert on a
non-authorable doc; no console errors in the webview devtools; nothing is
persisted by the toolbar beyond the edits you accepted.