feat(serve): variant selector + filtering in dashboard#179
Merged
Conversation
Discover the project's feature model, binding, and variant YAML files at load/reload time and hang them off AppState. Adds build_variant_scope, which filters the in-memory Store, LinkGraph, and cached diagnostics down to the artifacts bound to a variant's effective features. Routes /stats, /artifacts, /coverage, /validate, /stpa, /matrix plus the matching /api/v1 endpoints now honor an optional ?variant=NAME query param and return 400 for unknown names. A variant dropdown is rendered in the context bar whenever a feature model is present; selecting one reloads the page with ?variant=X. A "Filtered to variant: X (N of M)" banner appears above the content with a Clear filter link; a small HTMX sync script keeps the banner honest after cross-page swaps by reloading when the URL variant drifts from the rendered banner. Implements: REQ-007 Refs: REQ-045, FEAT-001 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Surface every declared variant in a dedicated nav entry (only shown when the project has a feature model). Each row reports the solver outcome (PASS/FAIL with inline error messages), the effective feature count, the bound artifact count, and the fraction of the total store the variant covers. Quick-pick links jump into the scoped dashboard, coverage, or artifact listings for that variant. When no feature model is configured, /variants renders a friendly hint instead — the rest of the dashboard behaves identically for non-variant projects. Implements: REQ-007 Refs: REQ-045, FEAT-001 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a minimal feature-model / binding / two variant configs (minimal-ci, dashboard-only) to the main project's artifacts/ tree so the existing Playwright and serve_integration harnesses can exercise the variant-filter UX without a bespoke test project. The fixtures are parsed as "no artifacts" by the generic-yaml adapter so they don't pollute the existing suite. * Seven new serve_integration tests cover: - /api/v1/artifacts scoped down to 1 row for minimal-ci - /api/v1/artifacts?variant=bogus returns 400 + JSON error - /api/v1/stats and /api/v1/coverage honor the scope - /variants overview renders every declared variant with PASS status - Dashboard header renders the variant-selector dropdown - /stats?variant=... emits the "Filtered to variant" banner * serve-variant.spec.ts (Playwright) covers the UI flow: dropdown population, selection pushing ?variant, Clear filter, reload-preserves-scope, /variants overview, unknown-variant 400, HTMX-driven nav triggering the sync reload. Verifies: REQ-045 Refs: REQ-007, FEAT-001 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Replace useless format!() with .to_string() in the banner. * Suppress result_large_err on try_build_scope — the `Err` arm is deliberately an already-built axum Response so handlers can early- return via `return resp` without re-rendering, and the Err path is the uncommon case. Trace: skip Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
8d3b01a to
7fd5a9b
Compare
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: 7fd5a9b | Previous: f46fb62 | Ratio |
|---|---|---|---|
traceability_matrix/1000 |
61408 ns/iter (± 1081) |
44392 ns/iter (± 1656) |
1.38 |
This comment was automatically generated by workflow using github-action-benchmark.
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 UX gap reported as "in rivet serve how would I even see the variant, currently don't know or to filter".
?variant=<name>and a "Filtered to variant: X (N of M artifacts shown)" banner with a Clear filter link is rendered above the content./stats,/artifacts,/coverage,/validate,/stpa,/matrixplus their/api/v1/*counterparts honor?variant=NAME. Unknown variant names return 400 with a JSON error body on the API, and a 400 HTML page on the browser routes./variantsoverview: Table of every declared variant with PASS / FAIL solver status (inline error messages when FAIL), feature count, bound-artifact count, and quick-picks that jump into the scoped dashboard./variantspage explains how to scaffold one. All existing flows are untouched.artifacts/feature-model.yaml+artifacts/bindings.yaml+artifacts/variants/*.yaml(also recognisesfeature_model.yamlandfeature-bindings.yaml; also walks every path declared inrivet.yamlsources plus the project root).Test plan
cargo test -p rivet-cli— all suites green (86 unit + 33 serve_integration including 7 new variant tests)cargo clippy -p rivet-cli --all-targets -- -D warningscleanserve-variant.spec.ts(8 tests) — runs in CI; local env does not have Playwright deps installedrivet validatestill produces the same pre-existing diagnosticsFiles of interest
rivet-cli/src/serve/variant.rs— discovery + resolution (new, ~300 LOC with tests)rivet-cli/src/serve/mod.rs::build_variant_scope— owns the scopedStore+LinkGraph+ filtered diagnosticsrivet-cli/src/serve/layout.rs— dropdown, banner,/variantsoverview rendererrivet-cli/src/serve/views.rs::try_build_scope— single helper used by all scoped handlersartifacts/feature-model.yaml+artifacts/variants/*.yaml— minimal fixtures so existing Playwright/integration harness can exercise the feature🤖 Generated with Claude Code