Files
fleet/scripts
CatoandClaude Fable 5.1 2a7319f898 feat(org-drift): find documents using a name or host that has been replaced (#43)
* feat(org-drift): find documents using a name or host that has been replaced

A rename that is only remembered is a rename that drifts.

aoz-wohnen.orangecat.ch, revampit.orangecat.ch, sbb.orangecat.ch and
sink.orangecat.ch all answer 200 — every one is a redirect. So a document
naming any of them looks perfectly healthy from the outside, and nothing ever
reports it. All four were found in 2026-09 by tripping over them, including on
the public studio page, which named a real transport company on a demo that has
no connection to it.

That is the same failure this audit already exists for — a document saying
something that is no longer true — so it is the same sweep, not a second script
with its own copy of the exemption and baseline logic.

THE GAP WAS A REGISTER, NOT A SCRIPT

Nothing recorded that a name had been replaced, so no check could have found a
document still using it. registers/retired.json is that record: kind, from, to,
since, why, and how the retirement was VERIFIED rather than who asserted it.
Adding a retirement is a ROW; the script does not change.

Nine entries to start, each confirmed rather than remembered — the four hosts by
following them with curl, "AOZ Housing" against the app's own brand.ts and live
<title>, "SBB Fundbüro" against the title it actually ships, and the two repo
renames against the commits that made them.

Findings say what to use instead and since when. "This document is wrong" costs
a reader a search; "say X instead, since 2026-09-10" costs them an edit.

THE RATCHET

51 files across 7 repos already use a retired form. Baselined with a reason,
not fixed here: one PR touching 51 files in 7 repos would be a worse change than
the drift it removes. Most are one host (revampit). The sbb-fundbuero ones are
worth doing first — a repo still calling itself "SBB Fundbüro" while the site it
ships is titled "Nordbahn Fundbüro".

A TEST THAT DAMAGED THE ARTIFACT IT CHECKED

Found while running the suite: the vacuous-scan case ran the real script without
overriding INVENTORY, so a test whose entire point is "scan nothing" overwrote
the committed 41-repo inventory with "Scanned 0 repos, found 0 violation(s)" —
the tracked record of the fleet's drift, replaced by the output of a
deliberately empty run, every time anyone ran the tests. Redirected to a temp
file. Same shape as the sed range in #42: a check satisfied just as well by a
broken reader as by a clean file.

Verified: 49 passed, 0 failed (13 new). The new cases pin the mechanism, not
live data — a fixture register, so retiring something tomorrow does not break
the suite. Regex metacharacters must be escaped (an unescaped old.example.ch
also matches oldXexampleYch), a name containing '&' must survive the sed
replacement, a clean line must yield no hint, and the register that RECORDS a
retirement must be exempt from it or the ratchet can never reach zero.

Note: this audit is already red on main for pre-existing org-claim violations
("bitbaum AG", incorporation language in four fleetcrown docs). Confirmed by
running the committed version against the same tree; not introduced here, and
not baselined here either — that is a decision about incorporation wording, not
a drift fix.

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

* fix(org-drift): baseline the file the API scan found and the local sweep missed

CI caught sbb-fundbuero/CLAUDE.md, which my local USE_LOCAL sweep did not. That
asymmetry is the point of the audit's default: USE_LOCAL greps local checkouts,
which go stale, while the real scan reads the org's default branches. A ratchet
that sees less than production prevents less than it claims.

Also corrects the previous commit message. It said this audit was "already red
on main for pre-existing org-claim violations". It is NOT — that came from the
same misleading local sweep. main's baseline holds three entries and CI was
green before this branch; the only genuinely new finding was the one file above.
The fleetcrown docs mentioning incorporation appear in a local grep because it
walks every docs/*.md, while the API scan reads a narrower set of paths.

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

* fix(org-drift): baseline from the API scan, not the local sweep; list the audit in SHARED.md

The baseline is now generated by the instrument that judges it. The previous
commit baselined 51 files from a USE_LOCAL=1 sweep, and CI correctly rejected
44 of them as entries matching nothing production can see — the local sweep
greps every docs/*.md in stale checkouts, while the real scan reads a narrower
set of paths from the org's default branches. A baseline full of unreachable
entries is a ratchet that cannot fall.

Seven real entries remain, in four other repos, each an agent-facing file
(CLAUDE.md / AGENTS.md / README.md) — the worst place for a stale address. The
inventory is committed as the API scan regenerated it: 46 repos, 10 violations.

Also lists org-drift-audit.sh in SHARED.md's central-audits table. It was
missing, which is exactly why a duplicate of it was nearly written today —
the table exists so that "is there already a checker for this?" has an answer.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HVudRzEmLqLHvGNqFSpJq6

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 17:22:39 -07:00
..