2 Commits
Author SHA1 Message Date
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
CatoandClaude Opus 5 1bcf33fd9a feat(fleet): find a value copied into code that already has one home (#100)
* feat(fleet): find a value copied into code that already has one home

Renaming aoz-housing took four PRs across three repos and still missed things,
because the name had been copied where nothing connects it: a package name, a
GitHub URL builder, a seed map, a site override key, a JSON key in another repo
entirely. None of it broke loudly. A retired host answers 308, a renamed repo
redirects, a stale slug matches until the day it does not — so every copy looked
healthy right up to the moment it was wrong.

The first sweep found 495 across 16 repos, including a retired product name
serving on loki's public footer and a seed script that would have written two
retired hosts into the database.

A literal is a finding only when it duplicates a source of truth, or is wrong:
retired values (from registers/retired.json), a public IP in a connection (the
box address lives in loki _box-env.sh and in vars.HETZNER_IP), one person's home
directory (DEV_ROOT), a consumer mail address in source, and an arbitrary hex
class (globals.css tokens).

THIS AUDIT CONTAINS NO EXAMPLE OF WHAT IT HUNTS. One that hardcoded the box IP
and the operator's address in order to find them would be the bug it reports,
and in a public repo would publish the address too. The retired strings come
from the register — which is why `maonakamoto` is now a kind:"account" row in
retired.json rather than a literal inside a detector.

Not findings, deliberately: comments, including lines INSIDE block comments,
because the history of an incident is correct under the name it had then;
markdown, which org-drift already polices; registers, *.allow, *.baseline and
lockfiles, which ARE the source; test fixtures, in their own tier and outside
the ratchet; and hardcoded-values.allow, where every exception carries a reason
a reader can judge. An allow entry matching nothing is itself reported: an
allowlist that cannot shrink is a ratchet that cannot fall.

It caught its own bugs three times, which is the part worth trusting. The first
generic rules read CIDR tables as box addresses and import paths like
@/components/home/sections as home directories (ip 66 -> 26, home 84 -> 43).
Tightening the home rule to demand a trailing slash then LOST `default_cwd
"/home/g"`, and the stale-allowlist check surfaced it. And arbitrary-hex
reported 0 across 44 repos — believable only because a raw grep agreed.

25 assertions pin both directions of every rule against fixtures.

Two fixes in fleet itself:

bus-factor-audit.sh kept its own copy of the box IP; it now sources _box-env.sh
when the loki checkout is there and otherwise requires the value, naming where
it lives.

deploy-freshness-audit.mjs NEVER SAW orangecat. It matched deploy workflows on
/deploy/i and orangecat's is cd.yml, so the largest repo in the org has been
outside that audit since the day I wrote it — not reported clean, never looked
at. Found today, while orangecat's main had not reached the box since 483cb9e0.
Coverage 21 -> 22, and the audit now judges it.

Baseline set from the fleet AFTER this sweep's repo cleanups (348 runtime, down
from 495), so it is a floor rather than a comfortable number.

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

* fix(bus-factor): require the box address where it is USED, not where it is set

Requiring HETZNER_IP at assignment aborted the audit's own offline test suite —
9 of 10 cases failed on a script that had not yet decided to ssh anywhere. The
address is only needed under --box, so that is where the check belongs. Still no
literal default: BOX, else BOX_UBUNTU from _box-env.sh, else HETZNER_IP, else a
clear refusal naming all three. The usage text no longer promises a default that
does not exist.

test-bus-factor-audit.sh: 10 passed, 0 failed.

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 01:42:33 -07:00