Repository navigation
Name the widget a render-gate failure came from - #902
Merged
Merged
Conversation
A widget that fails soft echoes its source in a `pre` under the message, and the gate read the box's whole text, so each refusal ran the reason straight into the source (`… (rounded)stateDiagram-v2`) and printed the full source twice, once per colour scheme. The report never said which widget failed, so on a page with two diagrams only the pasted source told them apart, and the fidelity test used that source to attribute each refusal. `failSoftErrors` now returns the owning widget's tag and id with the box's message and leaves out the `pre`. The gate reports `<lf-diagram id='…'> failed soft: …` in the owner form its other findings already use, and the fidelity test attributes refusals by id. The fidelity cases gain the state-diagram shape that misdrew examples/security-boundary.html until #899: a state used before `state "…" as S0` labels it is drawn labelled `S0`. `declared-label` is the control, with the declaration first. Co-Authored-By: Claude Opus 5 <[email protected]>
leaf-agent
approved these changes
Sep 21, 2026
max-sixty
added a commit
that referenced
this pull request
Sep 22, 2026
`lf-diagram` now draws with agentic-mermaid 0.4.1, a fork of Beautiful Mermaid 1.1.3 that documents the SVG it writes and draws more of Mermaid. With a renderer that holds up on its own, the render gate stops re-reading each diagram with official Mermaid: #899's differential check, the 2.85MB Mermaid reader bundle it imported, and the `registerRenderCheck` hook only it used are removed. The gate reports a diagram only when the renderer refuses it or draws it empty, and every family the renderer draws passes. ## What a reader sees - Most drawings improve or are unchanged. In `pr-walkthrough`, TempIndex's three edges now leave TempIndex rather than running up a trunk from Committed changes. Sequence diagrams draw notes, `autonumber` and `-x` heads, which Beautiful Mermaid dropped. `[/lean/]` stops at its own closer instead of swallowing the next node. - Pie, Gantt, mindmap, timeline, journey, quadrant, git graph, architecture and radar diagrams draw; the check refused every family outside the six Leaf documents. - The XY chart is heavier. agentic-mermaid replaced Beautiful Mermaid's own chart design with a port of Mermaid's xychart layout and defaults (`xychart/layout.ts`): bars fill 95% of their band from a constant with no option, fills are solid and unstroked, and axes carry lines and ticks. The title overlapping the top gridline happens with the library's defaults too. Mermaid config and a tint on the documented `data-role="bar"` lighten it but keep the bars full-width, so this change leaves the chart as drawn and the authoring guide sends quantities to `lf-chart`. - A diagram page directory carries 2.90MB of diagram vendor files, against 4.41MB before (Beautiful Mermaid 1.56MB plus the reader 2.85MB). The renderer itself is larger: 869KB gzipped against 471KB, because the package ships its whole toolkit in one module esbuild cannot cut down. ## What the gate no longer catches agentic-mermaid still departs from Mermaid in places, and those now draw silently: no `click` or `link` target (the box draws as a plain one), no frontmatter or sequence `title`, a state statement ending in `;` dropped, a state labelled with its bare id when a transition names it before `state "…" as S0` declares it, ER relationships read only in symbol form, and an entity code such as `#36;` drawn as written. `skills/leaf/references/authoring-evidence.md` lists them and asks for a look at each diagram. A diagram drawn empty (a lone `[*] --> A;`, or only word cardinalities) is still reported, as a widget with no usable size. ## Where to look - `skills/leaf/packages/diagram/widgets/lf-diagram.js` — the renderer's own `font` and `idPrefix` options replace Leaf's font rewrite and id namespacing; `security: "strict"` leaves out a `click` or `link` target, which the default mode draws as a focusable link nothing navigates; `interactive: true` gives chart values a hover tooltip and a line series its dots. Parts are read from the renderer's documented `data-role` contract; a namespace gives way to a class of the same name, and an id that is not one token (a quoted ER name, a multi-word mindmap node) is not offered as a part. - `scripts/vendor.py` — `build_agentic_mermaid` replaces the Beautiful Mermaid build; `elkjs`, `entities` and `yaml` are held by agentic-mermaid's declared ranges. The reader build and the `mermaid` pin are gone. - `skills/leaf/assets/runtime/render-check.js`, `render-checks/widgets.js`, `render_gate/readings.py` — the hook and its gate wiring removed; #902's per-widget failure naming stays. - `tests/test_render_gate.py` — `test_the_gate_passes_what_the_renderer_draws` covers every added family plus the multi-word and quoted ids, and fails on a head where the check still ran. `test_the_shim_runs_the_gate_from_anywhere` now holds #902's `<lf-diagram id='d-broken'> failed soft:` form without the source. Fixtures that relied on pie failing use `sankey-beta`, which the renderer does not implement. ## Validation - `uv run pytest tests -q` on `e3317831`: 1215 passed. The one commit since adds `security: "strict"`, which renders all 39 drawable shipped and test diagrams byte-identically, and `test_a_diagram_link_draws_no_tab_stop`, which fails without it. - `npm run test:runtime`: 33 passed. - The diagram part tests in `test_render_aim.py`, `test_render_reactions.py` and `test_render_semantic_selection.py` pass: Alt+click and `s` still target a declared box. - `version check --render` passed on the four shipped pages with diagrams (`security-boundary`, `pr-walkthrough`, `corpus`, `how-it-works`) during the trial, when the check still ran; removing the check only relaxes the gate. - Locally, a ten-diagram page presents about 200ms later (480ms → 680ms) and the largest shipped diagram renders in 101ms against 8ms. The `scripts/verify-site-local.sh` phase profile was not run: it needs Docker, which was not available. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A widget that fails soft echoes its source in a
preunder its error message, and the render gate read the error box's whole text. So each refusal ran the reason straight into the source (… node drawn but not in the source: S0 "S0" (rounded)stateDiagram-v2) and printed the full source twice, once per colour scheme. The report never said which widget failed: on a page with two diagrams, only the pasted source told them apart, and the diagram fidelity test relied on that source to attribute each refusal.failSoftErrorsnow returns the owning widget's tag and id alongside the box's message, and leaves out thepre. The gate reports a refusal in the<tag id='…'>form its other findings already use:The fidelity test now attributes refusals by id. It also gains the state-diagram shape that misdrew
examples/security-boundary.htmluntil #899: a state used beforestate "…" as S0labels it is drawn labelledS0. The render gate already refused that shape; the case pins it, anddeclared-label, with the declaration first, is its control.Validation
security-boundary.htmldraws its first box asS0, and main's copy drawsS0 · Gate passed. On this branch,version check --renderrefuses the first with the message above and passes the second.uv run pytest tests/test_render_gate.py tests/test_render_commands.py tests/test_render_pages.py -n 4on a Mac: 180 passed, 2 failed. The failures,test_render_reports_a_word_the_printed_page_losesandtest_a_written_comment_keeps_its_originating_agent, fail the same way on1888c6ec, the commit this branch started from. CI'stestjob passes on this head.pre-commitis clean on the changed files.🤖 Generated with Claude Code