Skip to content

fix(export): node-budget the single-page graph render so it can't hang (REQ-201)#474

Merged
avrabe merged 1 commit into
mainfrom
fix/req-201-single-page-export-hang
Jun 5, 2026
Merged

fix(export): node-budget the single-page graph render so it can't hang (REQ-201)#474
avrabe merged 1 commit into
mainfrom
fix/req-201-single-page-export-hang

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Jun 5, 2026

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-page runs 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 via etch::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.rs caps at DEFAULT_NODE_BUDGET = 200 and 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, 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 the rivet serve dashboard.

— mirroring the serve guard. Small graphs render an SVG exactly as before.

before:  single-page export on rivet repo → minutes / no output
after:   single-page export on rivet repo → ~3s, budget note present

Test

export::tests::render_section_graph_over_budget_skips_layout builds 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 --check clean · cargo clippy --all-targets -- -D warnings exit 0 · rivet validate PASS. Manually confirmed rivet export --format html --single-page on the rivet repo now completes in ~3s (was minutes/hang). Implements + Verifies REQ-201.

🤖 Generated with Claude Code

…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
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 5, 2026

📐 Rivet artifact delta

Change Count
Added 1
Removed 0
Modified 0
Downstream impacted (depth ≤ 5) 0

Graph

graph 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
Loading
Added
  • REQ-201

📎 Full HTML dashboard attached as workflow artifact rivet-delta-pr-474download from the workflow run.

Posted by rivet-delta workflow. The graph shows only changed artifacts; open the HTML dashboard (above) for full context.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

Codecov Report

❌ Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rivet-core/src/export.rs 95.65% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant