mirror of
https://github.com/bitbaum/fleet.git
synced 2026-12-04 08:38:58 +01:00
docs/chatkit
7
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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> |
||
|
|
28fc7de4ae |
fix(deploy-freshness): cross-check a stale verdict here too, from one definition (#95)
I put the commit-index cross-check in the reconciler only, reasoning that a wrong STALE there costs a real deploy while this gate merely reports. That was the wrong call, and it took about an hour to prove: the first audit run after the aoz rename went RED on evig, whose tip had a successful deploy-selfhost.yml run sitting in `actions/runs?head_sha=...` the entire time. A gate that cries wolf gets muted, and this one guards the single mechanism between "merged" and "live". "It only reports" is not a reason to tolerate a false positive in it — reporting is the whole job. So `deployedByShaIndex` and `runsForSha` move OUT of the reconciler and into this module, and the reconciler imports them. One definition, not two: the thing that reports a stall and the thing that repairs one already share deployFreshness, and splitting the confirmation across both files is exactly the drift those imports exist to prevent. Their eight assertions move with them. The audit now asks the commit index before calling anything stale, and says which index answered when they disagree. Live run after the change: 21 repos, all deployed, exit 0 — evig included. Worth being precise: evig resolved through the NORMAL path this time, because the flake is intermittent, so this run did not exercise the new branch. What covers it is the moved unit tests and the reconciler's own evig incident. 33 + 25 assertions, none lost in the move (was 24 + 34). Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2 Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
144855dea6 |
chore(aoz): rename the repo to aoz-begleitung, and record why (#94)
* chore(aoz): rename the repo to aoz-begleitung, and record why `bitbaum/aoz-housing` is now `bitbaum/aoz-begleitung`. It was the last public place the product was still called Housing: registers/retired.json retired "AOZ Housing" as the PRODUCT name on 2026-09-10, but the repo kept it, and the repo is PUBLIC — so the retired name sat on the org page, in every clone URL, and in ~55 references across this repo alone. The deploy name `aoz-wohnen` is deliberately NOT renamed with it, and that is the decision, not an omission. It is an infrastructure identifier — systemd unit, /opt path, database — and nothing on the box keys on the repo name; renaming it would touch a live site for no visible gain. Two names now instead of three. The registers are DERIVED and were regenerated, not hand-edited: origin.json (aoz's `stamped` and `swh` drop to null, correctly and temporarily — Software Heritage archived the old origin URL and the OpenTimestamps manifest names the old repo; the nightly origin-proof re-stamps) and packages.json. proofs/origin/*.json are untouched on purpose. They are hash-chained and append-only, so a past proof naming bitbaum/aoz-housing is correct history; rewriting one would both falsify the record and break the chain. retired.json gains the `repo` row, which is what makes the old name traceable — and what makes org-drift-audit.sh start flagging documents that still use it. Three were flagged: this repo's AGENTS.md (fixed here), the renamed repo's README (fixed in aoz-begleitung#243) and its CLAUDE.md, which is BASELINED with a reason rather than fixed: `JWT_ISSUER` is still the literal string `aoz-housing` and must stay so — src/proxy.ts and src/lib/auth/config.ts pass it as the JWT issuer, and changing it invalidates every live session. A live auth value, not a name. Verified across the rename: bitbaum/aoz-housing redirects to the new repo, https://aoz.orangecat.ch still 200, aoz-wohnen-app still active, and the new clone URL resolves to 431bae7 — the same tip as before. Tests green: deploy-freshness 24, deploy-reconciler 34, repo-metadata 17, model-pin, version-currency, product-identity 45, verify-predicates 29. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2 * chore(aoz): defer the retired-name row until the docs it polices have landed org-drift-audit.sh reads the org's DEFAULT BRANCHES, not the working tree. So adding the `aoz-housing -> aoz-begleitung` row to retired.json in the same PR that fixes AGENTS.md is a deadlock by construction: the audit judges main, where AGENTS.md is still unfixed, so `--check` fails — and the fix cannot merge while it fails. The row is a POST-condition, not a co-requisite. Fix the documents first, let them reach the default branches, then declare the name retired and let the audit hold the line from there. The row returns in its own PR once this and loki#732 are on main. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2 * chore(aoz): the baseline exception belongs with the row that creates it Same sequencing lesson, mirrored. Without the retired-name row nothing flags aoz-begleitung/CLAUDE.md, so a baseline entry for it matches no violation — and org-drift rejects that correctly: "baseline entries with no matching violation — the ratchet fell". A baseline full of entries that match nothing is a ratchet that cannot fall, which the file's own header already says. So the row and its one exception land together, in the PR after this one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2 --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
c241537655 |
fix(deploy-freshness): the audit reported a clean fleet it had not fully seen (#87)
Caught by checking the gate's own output against a local run: CI surveyed 20 repos and printed "✓ every deploying repo has its main tip live", while the same command locally surveyed 21. The missing one is `annushka`, which is PRIVATE. CI's token could not enumerate it, and a repo a token cannot see is absent from `gh repo list` in exactly the same way as a repo that does not exist. So the audit built to catch "something I could not see, reported as something that was not there" committed that exact error about itself, and the symptom was a green tick. Two fixes, and the second is the one that matters. The token now prefers FLEET_PAT, which can read the private repos. But a token fix only repairs today's instance: any future scope lapse, any new private repo, silently shrinks the sweep again and still prints a green tick. A count with nothing to compare against is not coverage. So the deploying repos are pinned in a committed baseline and coverage becomes a RATCHET, the same shape as the duplication ratchet in SHARED.md: it may RISE — a repo that starts deploying is surfaced as an addition, and the baseline is updated — but a silent FALL is a finding, and --check exits 1 on it, naming the repos rather than only counting them. A genuinely retired repo leaves the baseline in the same PR that retires it, where a human sees the decision instead of the gate quietly getting smaller. The coverage check runs BEFORE the verdicts are printed, because the point is that those rows do not describe the whole fleet. 24 assertions (17 → 24), 5 mutants killed: a ratchet that never reports anything missing, an unreadable baseline, unstripped comments, a baseline missing the private repo, and coverage that can never legitimately rise. Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2 Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
0d3e5b4010 |
feat(fleet): one clock for the fleet's deploys (#85)
The reconciler logic is neither missing nor broken. auto-merge-sweep.sh already
compares the base tip against the last successful deploy and closes the gap,
with a green guard and an in-flight guard, and it is already centralised as a
reusable workflow. What is broken is its CLOCK.
Each caller repo supplies its own `schedule:`, so the fleet depends on ~25
independent GitHub crons, and GitHub honours them erratically. Time since each
repo's sweep last ran, measured today against a stated ten-minute cadence:
loki 19m · evig 151m · reparaturbonus-zh 244m · vitareba 276m
Quiet repos are hit worst, which is exactly backwards — GitHub de-prioritises
schedules on low-activity repos, and a client site nobody pushes to all week is
the definition of low-activity. The repos least likely to have a human watching
are the ones whose clock stops first. reparaturbonus-zh sat merged-but-not-live
for four hours today for precisely that reason: its Deploy lost a timing race
and nothing retried it, while CI stayed green and /api/health returned 200.
So: one schedule, in the most active repo in the org, dispatching deploys only
where they are needed. It does not reimplement the sweep and it does not merge
anything — it closes the merged-but-not-live gap and nothing else.
Staleness comes from the audit's own deployFreshness, imported rather than
re-derived, so the thing that REPORTS a stall and the thing that FIXES one
cannot drift into disagreeing.
What it refuses to do is the load-bearing part:
- never ships a RED tip, however stale;
- never ships while a deploy is in flight;
- never ships a tip whose CI has not finished;
- never ships a tip with no green CI run at all. That is loki right now —
concurrency cancelled both its CI runs, so no green run exists for the
chained deploy to fire on. It needs a CI re-run, not a deploy, and the
output says so instead of papering over it by shipping something unverified;
- never ships more than MAX_DISPATCHES (5) in one tick. A reconciler holds a
deploy button for all 21 repos; a whole fleet going stale at once is far
likelier to be a bug in the predicate than 21 real stalls, so past the cap
it reports and ships nothing.
Both decisions that can cause a deploy are pure and tested: 18 assertions, and
5 mutants killed — reading a cancelled CI run as green, dropping the in-flight
guard, shipping a red tip, making the tool inert, and raising the cap above the
fleet size. The workflow proves those guards BEFORE the run that can dispatch.
Dry run is the default; the live survey of all 21 repos dispatched nothing and
correctly held loki back.
Also captures gh's stderr instead of forwarding it: probing 21 repos for a
.github/workflows directory printed eight bare 404s above the report, expected
misses indistinguishable from a real failure and noisy enough to hide one.
Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
9c34c592b8 |
fix(deploy-freshness): three ways this audit reported a blind spot as a verdict (#83)
Merged an hour ago and already wrong in three places, each the same shape: something it could not SEE, reported as something that was not THERE. A gate that cries wolf gets muted, and this one guards the single mechanism standing between "merged" and "live" for most commits here. 1. A WINDOW is not an absence. It read `actions/runs?per_page=40` and filtered by name; on a busy repo that window is all CI and auto-merge, so a healthy Deploy from two days ago falls off the end. aoz-housing was flagged with its newest Deploy green. Now each deploy workflow is asked for its OWN runs. 2. `main` is not every repo's default branch. aoz-housing and sbb-fundbuero are on `master`, so it asked for runs on a branch that does not exist there, got none, and called both never-deployed. Branch now comes from the repo. 3. An ERROR is not an empty list. A single `unexpected EOF` was swallowed into zero runs, which reads as "no successful Deploy run on record". `gh` now retries transport failures only — a 404 is an answer — and a repo that truly could not be read says COULD NOT READ (not a verdict), never a clean row. And the deployer predicate, which I got wrong twice in OPPOSITE directions: matching the filename alone caught this audit's own deploy-freshness.yml, so fleet — which deploys nothing — was a deploying repo with no deploy; requiring the body to name selfhost-deploy.yml or deploy.sh then excluded loki, whose deploy.yml ships inline, dropping the control plane out of its own audit while it held seven successful deploys. A false negative is the worse direction, so the rule is now include-by-name, exclude-only-what-is-proven-not-to-deploy, and it lives in a pure exported `isDeployerSource` with both directions pinned by the real files that fooled each version. Three mutants killed. Fleet-wide result: 21 repos judged, zero unknown, and one true finding it would otherwise have missed — loki's tip 56m undeployed, every chained Deploy skipped because both of its CI runs were cancelled by concurrency. Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2 Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
d849b430d2 |
feat(fleet): ask whether what is on main is actually live (#80)
Nothing was asking. uptime-sweep.sh probes /api/health and treats 5xx as DOWN — that proves a process is UP, not that it is running the code we merged. CLAUDE.md already says a health check is not a feature check; this is the missing half. WHY IT MATTERS HERE SPECIFICALLY A push made with GITHUB_TOKEN triggers no workflows, so an auto-merged PR fires no Deploy. Measured on bitbaum/loki: SIX of the last fifteen commits on main had no Deploy run of their own. They shipped anyway, because the auto-merge sweep reconciles every ten minutes. So that reconciler is the single thing standing between "merged" and "live" for most commits in this fleet — and it had no alarm on it. If it stops, CI stays green, PRs keep merging, /api/health keeps answering 200, and the box quietly serves last week's code. WHAT IT FOUND ON ITS FIRST RUN ✗ reparaturbonus-zh — main tip is 212m old and no deploy has run since it A client site, merged and not live for three and a half hours. Its Deploy at d1431ca is completed/FAILURE, six Auto-merge sweeps have run since without recovering it, and the commit carries TWO CI runs — one success, one cancelled — which is the documented shape where the shared Deploy reads the cancelled duplicate as a failed gate. Two more repos report UNKNOWN rather than clean: aoz-housing and sbb-fundbuero have a deploy.yml but no successful Deploy run on record. WHAT IT ASKS Per repo with a deploy workflow: is main's tip covered by a successful Deploy? A run for that exact SHA counts, and so does any successful run that STARTED after the tip was committed — because most commits here ride a later reconciler dispatch rather than firing their own. Requiring an exact-SHA run would have reported nearly the whole fleet stale while everything was live, which is how a check earns being muted. Anything uncovered is only a finding once it is older than the reconciler's window (45m: the sweep's 10 minutes plus room for a build). Inside that it is PENDING, not a problem. WHAT IT DELIBERATELY DOES NOT DO It does not judge whether the deployed code works. And it does not read the app's own /api/health `commit` field: exactly one of thirteen live apps publishes one, so a check built on that would cover a single app while looking fleet-wide. 12 self-test assertions, no network — including both grace boundaries, the vacuous-pass guard, and that a failed, cancelled or still-running deploy never counts as shipped. Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2 Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |