Files
loki/scripts
56e2187f07 test(ci): cover the mechanism that actually catches the outage, not just the newer bug (#423)
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.


Claude-Session: https://claude.ai/code/session_01Y9rKLxddothnXEtY6KDziN

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-28 11:41:35 +00:00
..