F7.1: intra-diagram mermaid diffing (#22) #28

Merged
benstull merged 10 commits from f7.1-intra-diagram-mermaid-diff into main 2026-06-11 23:36:58 +00:00
Owner

Summary

Refines the F7 rendered track-changes preview's whole-diagram "changed" badge
into a node/edge-level diff inside flowchart and sequence diagrams against the
F6 baseline (task #22; design = spec §11, INV-29..31).

  • Parsed-graph diff — new pure host modules parse a changed mermaid block's
    before/after source into a typed element model, diff it, and re-emit the
    current diagram source augmented with mermaid's own styling directives so
    mermaid renders a colored diagram. Host stays pure (INV-22); webview unchanged
    (INV-21); nothing persisted (INV-20).
    • src/mermaidDiff.ts — dispatch + total fallback (never throws)
    • src/mermaidFlowchartDiff.ts — node/edge diff -> classDef/class/linkStyle
    • src/mermaidSequenceDiff.ts — participant/message diff -> rect rgb(...) runs
  • Flowchart + sequence this increment; every other type, wholly added/removed
    blocks, and any parse failure fall back to the v1 badge (INV-30).
  • Removed elements ghosted in place (faded/dashed), re-injected at baseline
    position (INV-31). Layout reflow accepted (no position pinning).
  • Legend beneath a diffed diagram (media/preview.css).

Test Plan

  • npm run typecheck — clean
  • npm test — 189 unit tests green
  • npm run test:e2e — 38 + 5 green (new: a changed flowchart augments the
    emitted mermaid source via the renderHtmlFor seam)
  • Manual webview-render smoke (docs/MANUAL-SMOKE-F7.1.md) — colors paint

Fixes #22

## Summary Refines the F7 rendered track-changes preview's whole-diagram "changed" badge into a **node/edge-level diff inside flowchart and sequence diagrams** against the F6 baseline (task #22; design = spec §11, INV-29..31). - **Parsed-graph diff** — new pure host modules parse a changed mermaid block's before/after source into a typed element model, diff it, and re-emit the *current* diagram source **augmented with mermaid's own styling directives** so mermaid renders a colored diagram. Host stays pure (INV-22); webview unchanged (INV-21); nothing persisted (INV-20). - `src/mermaidDiff.ts` — dispatch + total fallback (never throws) - `src/mermaidFlowchartDiff.ts` — node/edge diff -> `classDef`/`class`/`linkStyle` - `src/mermaidSequenceDiff.ts` — participant/message diff -> `rect rgb(...)` runs - **Flowchart + sequence** this increment; every other type, wholly added/removed blocks, and any parse failure fall back to the v1 badge (INV-30). - **Removed elements ghosted in place** (faded/dashed), re-injected at baseline position (INV-31). Layout reflow accepted (no position pinning). - Legend beneath a diffed diagram (`media/preview.css`). ## Test Plan - [x] `npm run typecheck` — clean - [x] `npm test` — 189 unit tests green - [x] `npm run test:e2e` — 38 + 5 green (new: a changed flowchart augments the emitted mermaid source via the `renderHtmlFor` seam) - [ ] Manual webview-render smoke (`docs/MANUAL-SMOKE-F7.1.md`) — colors paint Fixes #22
benstull added 10 commits 2026-06-11 23:36:39 +00:00
benstull merged commit 06d4f87bf7 into main 2026-06-11 23:36:58 +00:00
benstull deleted branch f7.1-intra-diagram-mermaid-diff 2026-06-11 23:36:58 +00:00
Sign in to join this conversation.