fix(export): node-budget the single-page graph render so it can't hang (REQ-201)#474
Merged
Merged
Conversation
…g (REQ-201)
Verified hang: on the rivet repo (~900 artifacts) `rivet export --format html
--single-page` runs for MINUTES producing nothing (multi-page finishes in ~6s).
Root cause: `render_section_graph` (rivet-core/src/export.rs) lays out the
entire link graph eagerly via `etch::layout::layout(pg, ...)` with NO node
budget; etch's layout is super-linear, so ~900 nodes effectively hangs the
single-page export. The serve path already guards this
(rivet-cli/src/render/graph.rs `DEFAULT_NODE_BUDGET = 200` + a "Graph above node
budget" page) — the static export did not.
Fix: in `render_section_graph`, if `node_count > 200`, skip the layout and emit
a short note ("Graph has N nodes, exceeding the 200-node static-render budget —
view it interactively in `rivet serve`"), mirroring the serve guard.
Test (export::tests): render_section_graph_over_budget_skips_layout — a
250-node graph returns the budget note and NO `<svg>` (the layout that hangs).
Confirmed with: cargo test -p rivet-core --lib
export::tests::render_section_graph_over_budget_skips_layout (pass), cargo fmt
--check, cargo clippy --all-targets -- -D warnings (exit 0), rivet validate PASS.
Manually verified `rivet export --format html --single-page` on the rivet repo
now completes in ~3s (was minutes/hang) with the budget note present.
Implements: REQ-201
Verifies: REQ-201
Refs: REQ-007
📐 Rivet artifact delta
Graphgraph LR
REQ_201["REQ-201"]:::added
classDef added fill:#d4edda,stroke:#28a745,color:#155724
classDef removed fill:#f8d7da,stroke:#dc3545,color:#721c24
classDef modified fill:#fff3cd,stroke:#ffc107,color:#856404
classDef overflow fill:#e2e3e5,stroke:#6c757d,color:#495057,stroke-dasharray: 3 3
Added
Posted by |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Jun 5, 2026
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.
Refs #468-adjacent (same dogfooding sweep). Companion to REQ-200 (#473).
What I found (dogfooding the real export)
On the rivet repo itself (~900 artifacts),
rivet export --format html --single-pageruns for minutes producing nothing (effectively a hang), while the multi-page export of the same project finishes in ~6s.Root cause
render_section_graph(rivet-core/src/export.rs) lays out the entire link graph eagerly viaetch::layout::layout(pg, …)with no node budget. etch's layout is super-linear, so ~900 nodes effectively hangs the single-page path.The serve path already guards exactly this:
rivet-cli/src/render/graph.rscaps atDEFAULT_NODE_BUDGET = 200and renders a "Graph above node budget" page instead of laying out an oversized graph. The static export simply never got the same guard.Fix
In
render_section_graph, ifnode_count > 200, skip the layout and emit a short note —— mirroring the serve guard. Small graphs render an SVG exactly as before.
Test
export::tests::render_section_graph_over_budget_skips_layoutbuilds a 250-node graph and asserts the output contains the budget note and no<svg>(the layout that hangs).Verification
cargo test -p rivet-core --lib export::tests::render_section_graph_over_budget_skips_layout(pass) ·cargo fmt --checkclean ·cargo clippy --all-targets -- -D warningsexit 0 ·rivet validatePASS. Manually confirmedrivet export --format html --single-pageon the rivet repo now completes in ~3s (was minutes/hang). Implements + Verifies REQ-201.🤖 Generated with Claude Code