feat(ci): rivet-delta SVG render for email/mobile + classification priority fix#193
Merged
feat(ci): rivet-delta SVG render for email/mobile + classification priority fix#193
Conversation
PR #192's delta comment proved the concept: the mermaid diagram rendered inline on GitHub web, but showed as raw source in email digests and the GitHub mobile app (both of those strip ```mermaid blocks). This change pre-renders the diagram to SVG in the workflow and pushes it to a dedicated orphan branch (`rivet-delta-renders`), then rewrites the PR comment to put an <img> tag above the mermaid source. Email and mobile clients see the rendered image; GitHub web users still get the interactive mermaid graph in a collapsed <details>. Workflow: - New step: npx @mermaid-js/mermaid-cli@11.4.2 mmdc -i diagram.mmd -o diagram.svg - Push SVG to rivet-delta-renders:pr-<N>/run-<RUN>/diagram.svg - Two-pass script invocation: pass 1 emits mermaid source to disk via --mmd-out; pass 2 rewrites the comment with --svg-url pointing at the raw.githubusercontent.com URL of the pushed SVG. - Falls back to pass-1 mermaid-only output if SVG push fails (so a permissions glitch doesn't lose the whole comment). - Needs contents: write to push to the orphan branch — permission scope expanded from read-only. Script (scripts/diff-to-markdown.mjs): - --mmd-out PATH writes raw mermaid source (fences stripped) to PATH for the mermaid-cli renderer. - --svg-url URL injects an <img> reference above the mermaid block and wraps the mermaid source in <details><summary>Interactive graph</summary> so it collapses on the web UI. - Classification priority fix: build the mermaid node-class Map with modified first, then added/removed, so terminal classes (added, removed) win over modified when the same ID appears in multiple lists. Regression guard for the PR #192 "newly-added REQ-060 shown as modified/yellow" glitch. Playwright coverage (tests/playwright/rivet-delta.spec.ts): - svg-url flag injects image above mermaid block, mermaid moves to <details>, <img src> points at the raw URL. - mmd-out flag writes raw mermaid source without fences to the given path. - Classification priority: NEW-1 duplicated in `added` and `modified` renders as :::added, not :::modified. Also fixed the REQ-060 bucket-as-modified bug from v0.4.2: the rivet-core diff engine itself was correct (IDs can't be in both added and common); the bug was script-side. Implements: FEAT-124 Refs: DD-058 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
📐 Rivet artifact deltaNo artifact changes in this PR. Code-only changes (renderer, CLI wiring, tests) don't touch the artifact graph. |
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Rivet Criterion Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 5f725bd | Previous: d1c64fe | Ratio |
|---|---|---|---|
store_insert/10000 |
13499793 ns/iter (± 714321) |
11237893 ns/iter (± 494065) |
1.20 |
link_graph_build/10000 |
31165295 ns/iter (± 2308931) |
24161802 ns/iter (± 1197447) |
1.29 |
validate/10000 |
13358963 ns/iter (± 939893) |
11045689 ns/iter (± 484236) |
1.21 |
query/10000 |
144363 ns/iter (± 373) |
112961 ns/iter (± 504) |
1.28 |
This comment was automatically generated by workflow using github-action-benchmark.
…t HX-Location When the user clicked the Reload button in `rivet serve`, the reload handler returned `HX-Location` targeting `#content` only. Everything outside `#content` — including the sidebar with artifact count, document count, variant count, STPA count, EU-AI-Act count, and diagnostic badges — stayed untouched in the DOM. If a reload added or removed artifacts on disk, the sidebar numbers lied. Swapping to `HX-Redirect` tells HTMX to do a full browser navigation to the same URL. The whole shell re-renders, sidebar included. Cheap in practice because HTMX stays in-session and the server serves the page out of the freshly-reloaded salsa state. Playwright regression pins the contract: the /reload response must carry HX-Redirect, not HX-Location. The old shape (HX-Location + target=#content) is what left the sidebar stale, so refusing it at test time prevents the bug from silently coming back. Fixes: REQ-008 Refs: FEAT-001 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
avrabe
added a commit
that referenced
this pull request
Apr 23, 2026
* feat(variant): rivet variant explain for debugging solve outcomes Answers "why did my variant pick/skip feature X?" — a dev/debug UX gap called out in the v0.4.3 scope. Two modes: # Full audit: every effective feature + origin, unselected features, # and the constraint list rivet variant explain --model fm.yaml --variant prod.yaml # Single-feature focus: origin, attribute values, and every # constraint that mentions the feature rivet variant explain --model fm.yaml --variant prod.yaml asil-c Each effective feature carries an origin: - `selected` — user listed it under `selects:` - `mandatory` — parent group is mandatory, or is the root - `implied by <X>` — a constraint forced it in once <X> was selected - `allowed` — present but not proven mandatory `--format json` emits a structured audit for scripts (dashboard uses the same shape for the variant sidebar). Coverage: - explain_single_feature_shows_origin_and_attrs (text mode) - explain_single_feature_json_mode - explain_full_variant_audit_lists_origins_and_unselected Docs: new "Debugging" subsection in docs/getting-started.md under the variant management chapter, with an origin table. Implements: REQ-046 Refs: DD-050 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(variant): enrich eu-adas-c example + per-format smoke on realistic model Adds realistic `attributes:` to examples/variant/feature-model.yaml for every market (eu/us/cn with compliance+locale) and every ASIL level (asil-numeric + required analysis techniques). These match the worked examples in docs/getting-started.md so users can run the snippets against the shipped fixture and see the same output. New integration test `every_format_renders_realistic_example` exercises all 7 --format values against the enriched example and asserts each output contains the variant name and the asil-c marker (in whatever casing the format uses). Catches regressions that pass on toy models but break on constraint-driven inclusion, multi-attr features, or non-trivial tree depth. Implements: REQ-046 Refs: DD-050 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(release): v0.4.3 Workspace version bump 0.4.2 → 0.4.3, CHANGELOG entry covering the v0.4.3 changes that have already landed on main: - rivet variant features/value/attr for 7 build systems (#197) - docs: variant emitter walkthrough + exit-code contract (#198) - rivet variant explain for debugging solve outcomes (#199) - test: enrich eu-adas-c example + per-format smoke (#199) - sexpr count-compare + matches parse-time regex (#196) - SCRC Phase 1 clippy restriction lint escalation (#195) - Rivet Delta SVG render for email/mobile (#193) - stamp --missing-provenance filter + warn-skip (#192) v043-artifacts.yaml gains five new entries matching the implementations: - DD-061 build-system emitters are namespaced and loud-on-failure - FEAT-130 rivet variant features/value/attr - FEAT-131 rivet variant explain - DD-062 matches regex + count-compare validated at lower time - FEAT-132 count-compare lowering + matches parse-time regex - FEAT-133 Rivet Delta SVG render for email/mobile - FEAT-134 rivet stamp filter + warn-skip All 41 test binaries green. rivet validate: only pre-existing SPAR aadl-component schema errors remain (unrelated to this release). Implements: REQ-046 Refs: REQ-004, REQ-010, DD-050, DD-058 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Closes the v0.4.2 user-reported gap: the
rivet-deltamermaid diagram rendered fine on GitHub web but showed as raw source in email and on the GitHub mobile app.Approach (Option A): pre-render the mermaid to SVG in the workflow, push to a dedicated orphan branch (
rivet-delta-renders), and rewrite the PR comment to embed an<img>tag above the mermaid source (which now lives in a collapsed<details>for GitHub web users who want the interactive version).Changes
rivet-delta.yml): two-pass script invocation, mermaid-cli render, orphan-branch push. Falls back to mermaid-only if SVG push fails.contents: writepermission added (was read-only) for the orphan-branch push.diff-to-markdown.mjs):--mmd-outextracts raw mermaid source for the renderer;--svg-urlinjects the image reference and collapses the mermaid block.rivet-delta.spec.ts): 3 new tests pin the SVG-injection contract, the mmd-out file format, and the classification priority.Test plan
cargo test --workspace— 36/36 greennode scripts/diff-to-markdown.mjs --svg-url URLsmoke test — image injected above mermaid block🤖 Generated with Claude Code