Skip to content

fix(rules): a rule that threw never resolves its prior findings #999 #1000 - #1007

Merged
nc9 merged 1 commit into
mainfrom
fix/999-1000-timeout-carry
Oct 22, 2026
Merged

nc9 merged 1 commit into
mainfrom
fix/999-1000-timeout-carry

Conversation

@nc9

@nc9 nc9 commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Same class as #968/#997, using its rule-wide <rule>|* key.

#999. A rule that throws is recorded as a failed <rule>-error, which names none of the rule's real checks. When it threw on every page, no key of the rule existed in the resolution signal and the absent key resolved a prior finding on a crawled page. collectResolutionEvidence (packages/rules/src/resolution.ts) now treats that row like a timeout skip: the page it names (or every crawled page when the row names none or its list is clipped) goes under <rule>|* in notEvaluated, never failing. The row still takes its ordinary per-check path too, so nothing else changes. The merge needs no change: it already carries on that key. Old consumers ignore the key (only ever carry); old producers send none (behaviour as before). No wire-shape change.

#1000. I could not reproduce the premise. The runner's timeout row is stamped with its page by the engine (streaming.ts, adapter.ts), and the publish fold keeps the page list (pages, pagesTruncated past the cap), so the signal already lists only the timed-out pages. No code change; timeout-pages-listed-1000.test.ts pins it end to end through the real v1 and streaming engines (the rule times out on some pages, the signal lists exactly those, before and after the publish fold) and a clipped list marking every page. If the lead or reviewer knows a path where the row reaches the signal count-only, tell me where and I will cover it.

Files:

  • packages/rules/src/resolution.ts (+17 -3)
  • packages/audit-engine/tests/rule-error-no-resolve-999.test.ts (new): signal and merge, sampled and compact, all/some/elsewhere/no error, folded and clipped rows
  • packages/audit-engine/tests/timeout-pages-listed-1000.test.ts (new)
  • CHANGELOG Unreleased bullet

Tests: both new files plus timeout-no-resolve-968, compact-resolution-merge, rules resolution and resolution-compact pass (999 file: 6 of 17 failed before the fix); tsgo clean in rules and audit-engine.

Docs: no change needed. Agent skill: no change needed.

Closes #999
Closes #1000

@claude

claude Bot commented Oct 22, 2026

Copy link
Copy Markdown

Reviewed the diff. I found no blocking issues, and I haven't run the tests.

  • (nit) packages/rules/src/resolution.ts: the thrown-rule predicate (status === "fail" && name === ${ruleId}-error``) appears twice, once in the pre-count and once in the main loop. A small helper like isRuleErrorRow(ruleId, check) would keep the two from drifting apart.
  • (nit) The comment line "names (normalized URL), or true when the row cannot say which..." runs past the surrounding wrap width.
  • (low) Because a thrown row also falls through to the ordinary path, it keeps its own <rule>-error failing key as well as the rule-wide notEvaluated key. The new test asserts failing[ruleKey] is undefined, but it doesn't check that the <rule>-error key itself is handled sensibly, for example that it isn't treated as resolving. This looks harmless, so a one-line assertion would be enough.
  • (low) The resolution: carry the page list on the folded in-process timeout row #1000 tests use a 1 ms budget and rely on real timing. They already read the timed-out pages from the rows rather than assuming them, which helps. On very fast CI machines the big pages could still finish in time, and the toContain premise assertions would then fail. This is not a real flake risk with 12k-element bodies.

The logic looks correct. The cap reservation counts thrown rules, so the rule-wide key can't be dropped. Check names can't collide with <ruleId>-error because rule ids contain a slash. Coverage is good: sampled and compact modes, partial and total errors, and clipped lists. The CHANGELOG entry is present.

@nc9
nc9 force-pushed the fix/999-1000-timeout-carry branch from 03e35b2 to cb59c69 Compare October 22, 2026 02:14
@claude

claude Bot commented Oct 22, 2026

Copy link
Copy Markdown

Review of #1007. I read the diff and the surrounding code in resolution.ts. I didn't run the tests.

The fix looks correct and fits the #968 design. A thrown <rule>-error row now feeds the same <rule>|* not-evaluated key as a timeout skip. Replayed rows (carried / unrendered) are excluded. A row with no page, or a clipped page list, widens to every crawled page, which is the safe direction. The fall-through to the ordinary fail path keeps the existing behaviour. Test coverage is good: sampled and compact signals, all/some/elsewhere/no error, and folded and clipped rows.

  • (low) packages/rules/src/resolution.ts (timedOutRules loop): a rule with both a timeout skip and a thrown row is counted once, which is correct. The reserved room is still capped by maxChecks. When the cap is hit, the per-check keys yield first, as before. Worth a one-line test for that edge if one doesn't exist.
  • (nit) packages/rules/src/resolution.ts: the if (rule.checks.some(...)) condition and the new comment line (// (pub#968, pub#999) ... names (normalized URL), or true when the row cannot say which ...) run past the usual line width. Please run the formatter.
  • (nit) timeout-pages-listed-1000.test.ts: the 1 ms budget makes the test depend on timing. It already reads the timed-out pages from the rows, which helps. It does assert that big-a and big-b time out, which could flake on a very fast machine. The 12k-element fixture makes that unlikely.
  • (nit) The resolution: carry the page list on the folded in-process timeout row #1000 "no code change" conclusion is reasonable and the pinning test is useful. The PR's Closes #1000 is fine as long as the reporter agrees the premise couldn't be reproduced.

No blocking issues found.

@nc9
nc9 merged commit fd5ba7e into main Oct 22, 2026
15 checks passed
@nc9
nc9 deleted the fix/999-1000-timeout-carry branch October 22, 2026 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant