WS7: golden-sample contract test (detector drill-down -> dispatchable action)#1083
Merged
Conversation
Adds RemediationGoldenSampleTests -- the dynamic complement to RemediationContractTests' static handler<->key check. For each Apply-able fact key it feeds a representative detector drill-down (shaped to match the drill-down collectors' emit, each fixture citing its emit site) through the FactRemediation builder AnalysisService applies, and asserts a non-null action whose FactKey resolves through the production handler registry. This is the autogrowth-CTE-drift guard at the dynamic level: a builder that stops reading a drill-down key the detector emits now fails loudly instead of letting Apply silently no-op. Includes a completeness check -- every registered Apply-able handler key must have a golden fixture producing a dispatchable action (forces a fixture whenever the Apply-able surface grows). Updates the RemediationContractTests scope note to point at the implemented follow-up. Dashboard.Tests: 467 passed / 0 failed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Adds
RemediationGoldenSampleTests— the dynamic complement toRemediationContractTests' static handler↔key check. This is the golden-sample follow-up that file's scope note explicitly deferred.For each Apply-able fact key, it feeds a representative detector drill-down — shaped to match what the drill-down collectors emit (
SqlServerDrillDownCollector/ LiteDrillDownCollector; each fixture cites its emit site) — through theFactRemediationbuilderAnalysisServiceapplies, and asserts a non-null action whoseFactKeyresolves through the production handler registry:BuildActionBuildActionBuildRcsiActionBuildClearPlanActionBuildFileAutogrowthActionBuildServerConfigActionPlus a completeness test: every registered Apply-able handler key must have a golden fixture producing a dispatchable action — so the Apply-able surface can't grow without a fixture.
Why
This is the "autogrowth-CTE-drift" guard at the dynamic level: if a builder stops reading a drill-down key the detector emits (rename / typo / extractor refactor), the action comes back null and the matching test fails loudly — instead of Apply silently no-opping (
RemediationRunStatus.NoHandler) in production. The static contract test locks the handler↔key set; this locks that real drill-down still flows through to a dispatchable action.Residual limitation (documented in the test)
Fixtures are captured from the collector emit at authoring time and catch builder-side drift immediately. A future collector-side key rename is caught only when the fixtures are regenerated against the new emit — the fixtures are the contract, kept in sync with the cited emit sites. (A shared drill-down key-name constant set would make this automatic; larger refactor, out of scope.)
Tests
Dashboard.Tests: 467 passed / 0 failed (+7 from this PR). Test-only change — no production code touched.🤖 Generated with Claude Code