Repository navigation
feat(report): typed RuleOutcome from one skip-reason table, outcome on skippedChecks and notChecked - #1682
Merged
Conversation
…n skippedChecks and notChecked #1661 Signed-off-by: Nik Cubrilovic <[email protected]>
Signed-off-by: Nik Cubrilovic <[email protected]>
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.
Closes #1661
What
A rule's outcome was encoded as
status: "skipped"plus askipReasonstring plusdetails.errored, and several predicates re-read that encoding in different places. Now one leaf module,packages/core-contracts/src/rule-outcome.ts, holds one table of the coded skip reasons (each with an outcome, a scope of rule or check, and a not-checked flag), andclassifyRuleOutcome(check)reads it, plusdetails.errored.ran,not_applicable,coverage_gap,timed_out,errored,disabled.isRuleNotApplicableReasonandisRuleWideGapSkipReasonare wrappers over the table, andNOT_CHECKED_SKIP_REASONSis derived from it. The engine merge code is untouched.report/skipped.tsandreport/not-checked.tsuse the classifier instead ofdetails.erroredandreason === "rule-timed-out".outcomeon eachskippedChecks[]andnotChecked[]entry (coverage_gap,timed_outorerrored), beside the unchangedreason. A saved report read back derives the outcome from the reason and does not trust the file. Schema version 1.9 (the last commit, on its own).Parse error,No pages crawled) are not coded; they classify asnot_applicable, documented. The engine's page-level logic still decides whether another check's evaluation makes a skip a gap.Acceptance criteria
rule-outcome-1661.test.tsenumerates every exported*_SKIP_REASONconstant and fails if one has no table entry (and if a table entry has no constant).outcomeper skipped and not-checked rule result; existing fields unchanged (three existing tests that assert exact entries now includeoutcome).--fail-on(fail-on-outcome-1661.test.ts,packages/report/tests/rule-outcome-1661.test.ts).docs/configuration/output.mdxlists the outcomes ("Rule outcomes") and the new field.Characterization first
skip-reason-predicates-1661.test.tspins what the three predicates answer for all 14 coded reasons. It was green on the hand-written predicates and stays green on the derived ones.Under a temp HOME, by explicit path: those, the report json-skipped, not-checked and outcome tests, rules
resolution, enginecompact-resolution-merge, CLIfail-onandexit-code, the include-pages, unstored-pages and reconstruct tests,meta-string-limitsandrule-verdict-scope.tsgoin cli, report, core-contracts and audit-engine, root lint,format:check,make validate.The squirrelscan agent skill needs no change.