feat(export): extract CSS/JS to shared _assets/ + thread --filter (REQ-087, REQ-088)#319
Merged
Merged
Conversation
…Q-087, REQ-088)
REQ-088 — HTML exporter no longer embeds the full CSS/JS framework
into every page. Per-page emission was
`<style>{fonts_css}{css}</style><script>{mermaid_js}</script>` with
`MERMAID_JS = include_str!("../assets/mermaid.min.js")` (~3MB), so a
5000-artifact project produced ~13 GB of mostly-identical bytes. Now
the exporter writes `<out>/_assets/styles.css` + `_assets/mermaid.min.js`
ONCE and each page emits `<link rel="stylesheet" href="…">` and
`<script src="…">`. Verified on the rivet dogfood corpus: 871 pages,
total export 9.7 MB (was multi-GB), per-page ~7-10 KB.
The wrap_page closure now takes the page's `rel_path` and computes a
depth-adjusted prefix (`""`, `"../"`, `"../../"`) so root-level,
depth-1, and depth-2 pages all resolve assets and nav hrefs correctly
— this also clears latent nav-relativity bugs in the previous fixed
`../path` strings (root index.html's "Overview" link, depth-2
help/schema/* pages, the inconsistent stpa/ vs ../path navs).
REQ-087 — `rivet export --filter <s-expr>` now actually narrows the
per-artifact page set. `cmd_export` accepted `--filter` for HTML but
never threaded it into `cmd_export_html`, so a filtered HTML export
silently emitted every artifact — the F2 silent-failure class. Now
threaded through and applied at the per-artifact loop using the
existing `sexpr_eval::matches_filter_with_store` (same pattern as
`cmd_export_zola`).
Adds `rivet-cli/tests/export_html.rs` with two integration tests
driving the real binary against the rivet corpus:
`export_html_extracts_shared_assets` asserts `_assets/` exists, pages
reference it, the inlined library signature is gone, and per-page
HTML is < 100KB; `export_html_filter_narrows_per_artifact_pages`
asserts a filter set strictly narrows from the unfiltered baseline.
Implements: REQ-087, REQ-088
Verifies: REQ-087, REQ-088
📐 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: 6e743a9 | Previous: 86bf482 | Ratio |
|---|---|---|---|
validate/10000 |
17690146 ns/iter (± 2447873) |
13963257 ns/iter (± 521263) |
1.27 |
This comment was automatically generated by workflow using github-action-benchmark.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
4 tasks
avrabe
added a commit
that referenced
this pull request
May 24, 2026
…#322) REQ-090 — Release attaches the audit-deliverable bundle (multi-page HTML + ReqIF + generic-yaml + README) instead of the navigation-shell HTML. Compliance action gains opt-in `include-data-formats` (default false, backward-compatible); release.yml's build-compliance sets `single-page: false` + `include-data-formats: true`. Multi-page emission is ~50 MB thanks to REQ-088's shared-assets fix (#319). Implements: REQ-090
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
Two HTML-export fixes from the v0.11.1 audit findings (PR #317
captured them as REQ-087 and REQ-088).
REQ-088 — kill the 13 GB. Per-page emission was
`<style>{fonts_css}{css}</style><script>{mermaid_js}</script>` with
`MERMAID_JS = include_str!("../assets/mermaid.min.js")` (~3MB), so a
5000-artifact project produced ~13 GB of mostly-identical bytes. Now
the exporter writes one shared `/_assets/styles.css` +
`_assets/mermaid.min.js` and each page emits
`<link rel="stylesheet" href="…">` + `<script src="…">`.
The wrap_page closure takes the page's `rel_path` and computes a
depth-adjusted prefix (`""`, `"../"`, `"../../"`) so
root / depth-1 / depth-2 pages all resolve assets and nav hrefs
correctly — clears latent nav-relativity bugs as a side-effect.
Verified on the rivet dogfood corpus:
REQ-087 — `--filter` actually narrows. `cmd_export` accepted
`--filter` for HTML format but never threaded it into
`cmd_export_html`. Result: a filtered HTML export silently emitted
every artifact — the F2 silent-failure class
(REQ-078..082's family). Now threaded through and applied at the
per-artifact loop using the existing
`sexpr_eval::matches_filter_with_store` (same pattern
`cmd_export_zola` already uses).
Smoke: unfiltered emits 788 per-artifact pages; `--filter` with an
unmatching clause emits 1 (just the index shell) — proving the wire
works.
Test plan
drive the real binary against the rivet corpus and assert:
`_assets/` exists, pages reference it, no inlined mermaid
signature, per-page < 100KB; `--filter` strictly narrows
from the unfiltered baseline. Both pass locally.
MSRV-config noise).
🤖 Generated with Claude Code