Skip to content

feat(report): typed RuleOutcome from one skip-reason table, outcome on skippedChecks and notChecked - #1682

Merged
nc9 merged 3 commits into
mainfrom
feat/rule-outcome-1661
Nov 10, 2026
Merged

nc9 merged 3 commits into
mainfrom
feat/rule-outcome-1661

Conversation

@nc9

@nc9 nc9 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Closes #1661

What

A rule's outcome was encoded as status: "skipped" plus a skipReason string plus details.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), and classifyRuleOutcome(check) reads it, plus details.errored.

  • Outcomes: ran, not_applicable, coverage_gap, timed_out, errored, disabled.
  • isRuleNotApplicableReason and isRuleWideGapSkipReason are wrappers over the table, and NOT_CHECKED_SKIP_REASONS is derived from it. The engine merge code is untouched.
  • report/skipped.ts and report/not-checked.ts use the classifier instead of details.errored and reason === "rule-timed-out".
  • JSON: outcome on each skippedChecks[] and notChecked[] entry (coverage_gap, timed_out or errored), beside the unchanged reason. 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).
  • Free-text skip reasons (Parse error, No pages crawled) are not coded; they classify as not_applicable, documented. The engine's page-level logic still decides whether another check's evaluation makes a skip a gap.

Acceptance criteria

  • One classifier maps every coded skip reason to an outcome; rule-outcome-1661.test.ts enumerates every exported *_SKIP_REASON constant and fails if one has no table entry (and if a table entry has no constant).
  • The predicates are replaced by the table (wrappers, derivation).
  • Report JSON carries outcome per skipped and not-checked rule result; existing fields unchanged (three existing tests that assert exact entries now include outcome).
  • An errored rule and a timed-out rule are told apart in JSON and in --fail-on (fail-on-outcome-1661.test.ts, packages/report/tests/rule-outcome-1661.test.ts).
  • docs/configuration/output.mdx lists the outcomes ("Rule outcomes") and the new field.

Characterization first

skip-reason-predicates-1661.test.ts pins 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, engine compact-resolution-merge, CLI fail-on and exit-code, the include-pages, unstored-pages and reconstruct tests, meta-string-limits and rule-verdict-scope. tsgo in cli, report, core-contracts and audit-engine, root lint, format:check, make validate.

The squirrelscan agent skill needs no change.

@nc9
nc9 marked this pull request as ready for review November 10, 2026 11:12
@nc9
nc9 merged commit 89b0d0b into main Nov 10, 2026
16 checks passed
@nc9
nc9 deleted the feat/rule-outcome-1661 branch November 10, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rules: rule outcome is a skip-reason string re-classified by four predicates; one typed RuleOutcome

1 participant