Files
loki/scripts
a06e650063 fix(ci): harden the fleet-refs-audit self-match exclusion, add the missing test (#421)
#420 already fixed this audit's first production failure (it flagged its own
RETIRED_HANDLES: maonakamoto declaration as a live reference) — that landed
first and this rebases on top of it, replacing the approach rather than
duplicating the fix.

#420's exclusion was file-level: `SELF_REPO='fleetcrown'` +
`SELF_WORKFLOW='fleet-refs-audit.yml'`, matched by repo name and filename.
Two problems with that shape specifically:

  - it goes stale the moment this tooling changes address. Memory already
    has this fleet's audit/template infra mid-move to bitbaum/fleet — the
    exact rename-and-forget pattern this whole audit exists to catch, now
    baked into the audit's own exclusion list.
  - it exempts the entire file from retired-handle detection, not just the
    one line that's actually a declaration rather than a reference. A
    genuine stale mention added anywhere else in that same file later would
    go uncaught.

Replaced with a line-level exclusion: strip the RETIRED_HANDLES: declaration
line specifically (scripts/ci/fleet-refs-audit-lib.mjs), the same way
comment lines were already stripped for the identical reason one level up.
Works regardless of which repo or filename hosts the audit.

#420's PR body describes manual mutation-style checks (toggling SELF_REPO
and RETIRED_HANDLES by hand) but landed with no committed test — nothing
would catch a regression here. scripts/test/fleet-refs-audit.ts pins it: the
production line no longer self-matches, a genuine `uses: maonakamoto/...`
still fails, a documentation comment still passes, and stripping the
declaration line doesn't hide a real reference elsewhere in the same file.
Picked up automatically by test:unit (glob-discovered) — confirmed via
`npx tsx scripts/test-unit.ts`. Also ran the matcher directly against the
real .github/workflows/fleet-refs-audit.yml: zero matches.


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:45:25 +02:00
..
…