F7: rendered track-changes markdown preview (#21) #23

Merged
benstull merged 12 commits from f7-rendered-preview into main 2026-06-11 15:50:34 +00:00
Owner

Implements Feature #21 (F7) — a rendered track-changes markdown preview — from the graduated Solution Design coauthoring-rendered-preview.md.

Summary

  • New Ctrl+Alt+R / Cowriting: Open Track-Changes Preview command opens a read-only webview beside a Markdown editor that renders the document and marks what changed since the F6 baseline: prose <ins>/<del> (word-refined) and atomic code/mermaid fences with a "changed" badge (INV-23). Mermaid renders as diagrams (runs in the webview).
  • Pure, vscode-free render engine src/trackChangesModel.ts (splitBlocks / diffBlocks / renderTrackChanges) — block-level LCS diff over normalized blocks + word-level prose refinement; deterministic (INV-22).
  • Sealed webview (INV-21): local bundled assets only, strict CSP + per-load nonce, no network/CDN, no LLM. Mermaid is bundled into the webview asset only (out/media/preview.js, esbuild second entry) — host bundle stays ~68kb.
  • TrackChangesPreviewController reuses the F6 baseline (new additive DiffViewController.onDidChangeBaseline event) and adds no persistence (pure read-only, INV-20). Live debounced update on edit; re-bases on machine landing / pin.
  • F7 coexists with F6 (markdown-only vs any-file).
  • Intra-diagram mermaid diffing deferred to #22 (v1 = whole-diagram badge).

Test Plan

  • Unit (vitest, vscode-free): test/trackChangesModel.test.ts — 18 cases (addition/deletion/prose-change ins-del/atomic code+mermaid/reorder/unchanged/determinism/error-chip). Full suite 122 passing.
  • Host E2E (@vscode/test-electron, no LLM): test/e2e/suite/trackChangesPreview.test.ts — open/PUC-1, type/PUC-2, propose+accept epoch advance/PUC-3, pin/PUC-4, non-markdown guard/PUC-6. Full E2E 33 + 4 passing.
  • npm run typecheck clean; npm run build produces out/media/preview.js + out/media/preview.css.
  • Manual smoke docs/MANUAL-SMOKE-F7.md (webview visual rendering — sealed sandbox, not E2E-asserted).

Non-shippable POC (no marketplace publish); host-E2E tier per spec §7.2.

Co-authored with Claude (session 0021).

Implements **Feature #21 (F7)** — a rendered track-changes markdown preview — from the graduated Solution Design `coauthoring-rendered-preview.md`. ## Summary - New `Ctrl+Alt+R` / **Cowriting: Open Track-Changes Preview** command opens a read-only webview beside a **Markdown** editor that renders the document and marks what changed since the F6 baseline: prose `<ins>`/`<del>` (word-refined) and **atomic** code/mermaid fences with a "changed" badge (INV-23). Mermaid renders as diagrams (runs in the webview). - Pure, vscode-free render engine `src/trackChangesModel.ts` (`splitBlocks` / `diffBlocks` / `renderTrackChanges`) — block-level LCS diff over normalized blocks + word-level prose refinement; deterministic (INV-22). - Sealed webview (INV-21): local bundled assets only, strict CSP + per-load nonce, no network/CDN, no LLM. Mermaid is bundled into the **webview** asset only (`out/media/preview.js`, esbuild second entry) — host bundle stays ~68kb. - `TrackChangesPreviewController` reuses the F6 baseline (new additive `DiffViewController.onDidChangeBaseline` event) and adds **no** persistence (pure read-only, INV-20). Live debounced update on edit; re-bases on machine landing / pin. - F7 coexists with F6 (markdown-only vs any-file). - Intra-diagram mermaid diffing deferred to **#22** (v1 = whole-diagram badge). ## Test Plan - [x] Unit (vitest, vscode-free): `test/trackChangesModel.test.ts` — 18 cases (addition/deletion/prose-change ins-del/atomic code+mermaid/reorder/unchanged/determinism/error-chip). Full suite **122 passing**. - [x] Host E2E (`@vscode/test-electron`, no LLM): `test/e2e/suite/trackChangesPreview.test.ts` — open/PUC-1, type/PUC-2, propose+accept epoch advance/PUC-3, pin/PUC-4, non-markdown guard/PUC-6. Full E2E **33 + 4 passing**. - [x] `npm run typecheck` clean; `npm run build` produces `out/media/preview.js` + `out/media/preview.css`. - [ ] Manual smoke `docs/MANUAL-SMOKE-F7.md` (webview visual rendering — sealed sandbox, not E2E-asserted). Non-shippable POC (no marketplace publish); host-E2E tier per spec §7.2. Co-authored with Claude (session 0021).
benstull added 12 commits 2026-06-11 15:50:25 +00:00
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
benstull merged commit ce01ef81b5 into main 2026-06-11 15:50:34 +00:00
Sign in to join this conversation.