Files
fleet/.github/workflows/hardcoded-values.yml
CatoandClaude Opus 5 783207e68b feat(ci): nothing watched the twenty-one audits that watch every repo (#105)
* feat(ci): nothing watched the twenty-one audits that watch every repo

Four of them were not doing their job on 2026-09-17 and no signal existed
anywhere: email-canary RED that day carrying a real finding (the Resend
sender domain every app sends through read unverified), bus-factor and
dependabot-alerts RED for days, and hosted-supabase CANCELLED — so it had
audited nothing since the 14th, and its silence was shaped exactly like a
clean sweep.

Rung 4 says a gate that reports success and means nothing is worse than no
gate. A gate that reports FAILURE and is never read is the same defect
wearing the other colour.

audit-health.sh asks four questions of every audit workflow: has it ever
run (GitHub lists a workflow it REFUSED by path, with zero runs — the
dotfiles duplicate-key incident), was its last run green (cancelled and
timed-out are not), did it run recently enough for its OWN cron, and does
every secrets.NAME it references actually exist.

The staleness threshold is derived from each workflow's cron rather than
tabulated here: a second copy of a fact the workflow already states would
be Ground Truth #2 violated by the script that enforces it.

This is the one audit that pushes. Every other reports into a job summary,
which is right — and is exactly what failed, because nobody looked for
days. One Telegram per run, never per finding, and the alert step goes red
itself if undeliverable.

PHANTOM SECRETS, the mechanism by which an audit goes blind without ever
failing: `${{ secrets.ABSENT || secrets.GITHUB_TOKEN }}` is not an error.
It silently degrades to the repo-scoped default token, and an audit that
sweeps the fleet able to see one repo reports a clean fleet.
FLEET_READ_TOKEN and FLEET_ADMIN_TOKEN were named by seven workflows here
and have never existed; only FLEET_PAT does. That is the proven cause of
the dependabot-alerts red — with the default token,
repos/*/vulnerability-alerts is unreadable for every repo but this one.
All fifteen references repointed at FLEET_PAT.

Secrets absent ON PURPOSE go in audit-health.allow with a reason, because
the property is "its absence silently weakens a gate", not "it is absent".
SWH_TOKEN is the conforming case — optional, only lifts a rate limit.
Flagging it would have been the third false positive of this exact shape
after ivy-portal and aoz-begleitung: the rule encoding the first example
it was written from rather than the property that example illustrated.

Proven by mutation in both directions, and the suite immediately earned
itself: staleness NEVER FIRED, because splitting a cron expression with
`set -- $cron` also globs it — the `*` fields expand against the working
directory, so `17 6 * * 1` was read as a file listing. It passed a live
run against the real fleet, because nothing happened to be stale that day,
and would have shipped as a column that could never go red — the exact
shape this file exists to find, in the file that finds it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(ci): a PR gate must judge the diff, and the floor follower knew only npm

Two corrections, both found by the work landing in this branch actually
being run.

1. audit-health gated PRs on the state of the WORLD.

Its pull_request run called --check, which renders the live red/stale
verdict — so PR #105's own check failed on four audits that were red
before the branch existed, and every unrelated PR in this repo would have
been blocked on someone else's outage. A gate that goes red for something
its author cannot fix is how a team learns to merge past red, which costs
more than the gate ever returns.

--static answers only what a diff controls: does every secret these
workflows name exist. The live verdict belongs to the scheduled run, which
is the one that pushes. Four new test cases pin both halves — a RED audit
does not fail --static and is not even rendered, while a phantom secret
still bites.

2. The floor audit's sub-package follower matched only npm's --prefix.

Its comment names printcraft as the repo it was written to fix. printcraft
has been charged for all three gates in every sweep since, because its
verify is `pnpm --dir app run verify` and `--dir` is pnpm's spelling of
--prefix. The follower was written for the package manager the fleet does
not use.

printcraft was reported "▲ FIXABLE — verify omits a gate the repo already
has: lint typecheck test" while its CI ran lint, typecheck, vitest, three
Python pipeline tests, a build and a standalone-output contract on every
PR. Nothing was wrong with the repo. Confirmed by extraction both ways:
the old regex does not match that verify at all, the new one resolves it
to app/verify.

A comment claiming a bug is fixed is not evidence that it is.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(ci): the phantom check charged 21 secrets it was merely unable to read

Its first CI run reported FLEET_PAT, TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID
and every other real secret as "does not exist". Listing secrets needs a
scope the workflow token lacks; both listings failed; the empty set that
came back was read as "no secrets exist".

That is the audit's own worst bug — a failed fetch reported as a finding —
committed by the script written to report that class, on its first live
run, against the rule stated three sections above it in the README it
ships with: silence is not data.

Both listings must now SUCCEED before any verdict is drawn, and the check
is withheld out loud when either cannot be read. Never partially: a
half-read listing charges every secret defined in the half you could not
see. Three new cases stub a token that may not list secrets and pin that
nothing is charged, that the withholding is said aloud, and that an outage
does not fail the run.

The tell was arithmetic, not intuition: 21 findings arriving at once
against a fleet that had none the day before.

Also: ci-pnpm.yml carried `version: 11` on pnpm/action-setup@v4, and
action-setup HARD-ERRORS when that is set alongside package.json
`packageManager` — which every fleet repo sets. All seven pnpm repos
checked had quietly dropped the line locally and none fixed the source, so
the golden floor was the one shape nobody could actually copy. It surfaced
because listkit adopted it verbatim and CI died in five seconds.

A template with no adopter that matches it is not a source of truth.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 06:33:24 -07:00

45 lines
1.8 KiB
YAML

# A value copied into code that already has one home.
#
# The sweep this gate came from found 495 such literals across 16 repos,
# including a retired product name serving on a public footer and a seed script
# that would have written two retired hosts into the database. None of them
# broke loudly, which is the whole problem: a retired host answers 308 and a
# renamed repo redirects, so every copy looks healthy until it isn't.
#
# The guards are proven BEFORE the run that judges the fleet, not after — a
# detector that never fires is indistinguishable from a clean fleet, and this
# one reported `arbitrary-hex 0` across 44 repos on its first pass.
#
# On the schedule: GitHub does not honour `schedule:` reliably here — measured
# 2026-09-15, deploy-freshness.yml fired at neither of its first two hourly
# slots and every run either it or the reconciler had was a manual dispatch.
# So the cron below is a free second chance, not the clock. Dispatch it by hand,
# or tick it from the box the way fleet-reconciler.timer ticks the reconciler.
name: Hardcoded values
on:
workflow_dispatch: {}
schedule:
- cron: '17 6 * * *'
permissions:
contents: read
jobs:
audit:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
- name: Prove the rules, both directions
run: python3 scripts/ci/test-hardcoded-values-audit.py
- name: Sweep every default branch
env:
# Reading PRIVATE repos needs the org PAT; GITHUB_TOKEN sees only this
# one. A sweep that silently skipped the private repos would report a
# smaller fleet as a clean one.
GH_TOKEN: ${{ secrets.FLEET_PAT || secrets.GITHUB_TOKEN }}
run: python3 scripts/ci/hardcoded-values-audit.py --check | tee -a "$GITHUB_STEP_SUMMARY"