test(registry): make every analysis account for every output surface - #150
Merged
Conversation
Analyses register on four parallel surfaces (dispatch match, csv/markdown emitters, spa dashboard) but only the dispatch match is compiler-guarded, so a new analysis can silently ship missing a rendering surface. Add a cfg(test) exhaustiveness module in analyze.rs that partitions AnalysisName::all() per surface into structurally-declared "wired" (two exhaustive matches over the enum — supported_formats and renders_in_spa, colocated with the dispatch match and build_spa_dashboard they mirror) and reviewed documented-absence lists with a one-line reason each. Adding a variant fails to compile until its wiring is declared; a variant accounted for on neither side fails a test naming the analysis and the surface. Documents today's reality (csv/markdown universal; spa renders 23 analyses, 33 documented-absent; a compact guard pins the 9-analysis bespoke-HTML set). No behavior change — test-only.
The campaign's refactoring churn lands in the red-band files by design — the very files being split and hardened — which max_red_effort_pct cannot distinguish from risk concentrating. 25.0 covers the campaign; restore toward the ~9.6% steady state once this churn rolls out of the window.
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
Wave-4 opener from the 2026-07-26 audit: the analysis registry had four parallel registration surfaces (dispatch match, CSV, markdown, SPA builder) with only the enum compiler-guarded — the drift mechanism behind three separate audit finding classes. A new
registration_surfacestest module now enforces: everyAnalysisNameis either wired on a surface or listed in that surface's documented-absence set with a one-line reason. A future analysis that skips a surface fails the test by name.supported_formats(name)(csv/markdown — all 56 wired, absence lists empty) andrenders_in_spa(name)(23 wired / 33 documented-absent), both exhaustive matches so a new enum variant fails compilation until classified; plus a dispatch no-dead-arm check and an html-wired-set guard.html_not_wiredcount; the SPA partition is 23/33.)Negative proof (entry temporarily removed, then restored):
spa: 1 analysis/analyses are neither wired nor documented-absent — wire a spa emitter/widget, or add each to the spa documented-absence list with a reason: hotspot-velocityVerification
test-supportsuites pass; clippy all-features clean; fmt clean; zero behavior change (test-only + seams)Known 1-line follow-up for the dispatch-collapse PR: the
html_not_wirederror string omitsrefactoring-targets, which does wire a real html emitter.