Skip to content

test(ci): cover the mechanism that actually catches the outage - #423

Merged
github-actions[bot] merged 1 commit into
mainfrom
test/refs-audit-verdict-coverage
Aug 28, 2026
Merged

test(ci): cover the mechanism that actually catches the outage#423
github-actions[bot] merged 1 commit into
mainfrom
test/refs-audit-verdict-coverage

Conversation

@catomean

Copy link
Copy Markdown
Collaborator

Summary

After fixing the RETIRED_HANDLES self-match (#421), only that newer check had test coverage. The USES regex + redirect-resolution verdict — the actual mechanism that caught all three real outages this tool exists for (2026-08-26/27/28) — had zero tests. A regex bug there would silently miss exactly the class of breakage the whole tool was built to catch.

Change

Extracted verdictFor(slug, real) into fleet-refs-audit-lib.mjs as a pure decision function (no network), replacing the inline if/else with identical behavior. 10 new assertions cover USES parsing (plain + path-qualified references, local/docker exclusions, multiple lines, indentation) and verdictFor's four real outcomes (ok / stale-redirect / stale-missing / unreadable-on-failed-lookup).

Documented one known limitation rather than claiming full coverage: USES matches by line shape, not YAML structural position — narrow, not observed in this fleet.

Verified

  • npx tsx scripts/test/fleet-refs-audit.ts — 15/15 assertions.
  • npm run verify green (test:unit auto-discovers the file).

Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01Y9rKLxddothnXEtY6KDziN

…ust the newer bug

Only fleet-refs-audit's RETIRED_HANDLES self-match had test coverage. The
USES regex and the stale/missing/ok verdict decision — the part that would
have caught all three real outages this tool exists for (2026-08-26/27/28) —
had zero tests. A regex bug there would silently miss exactly the class of
breakage the whole tool was built to catch, which is a bigger risk than the
bug just fixed.

Extracted verdictFor(slug, real) into fleet-refs-audit-lib.mjs as a pure
decision function — no network call, so it's directly testable — replacing
the inline if/else in fleet-refs-audit.mjs with the same behavior.

10 new assertions: USES correctly matches plain and path-qualified uses:
lines, correctly excludes local (./…) and docker:// references (no owner to
be wrong about), matches multiple lines independently, tolerates
indentation; verdictFor correctly reports ok/stale/unreadable for all four
real outcomes resolve() can produce, including the failed-lookup case, which
must report unreadable rather than silently pass OR falsely fail.

Documented one known, narrow limitation rather than silently claiming full
coverage: USES matches by line shape, not YAML structural position, so a
run: block whose first physical line happens to read literally like a
uses: key would be misread. Not observed in this fleet; a real YAML parse
would close it at the cost of a dependency this script deliberately avoids.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y9rKLxddothnXEtY6KDziN
@github-actions
github-actions Bot merged commit 56e2187 into main Aug 28, 2026
3 checks passed
@github-actions
github-actions Bot deleted the test/refs-audit-verdict-coverage branch August 28, 2026 11:41
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.

1 participant