mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 12:07:28 +01:00
81bf2041be96b400a07afce68e138a7768faef80
26
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
65dea6f303 |
chore: pnpm — the fleet has one package manager (#478)
* chore: pnpm — the fleet has one package manager - packageManager pnpm@11.25.0; lockfile via pnpm import, package-lock.json removed; npm "workspaces" replaced by pnpm-workspace.yaml packages (packages/agent), and bridge/ joins the workspace — one install, one lockfile, its own package-lock.json removed - npm "overrides" (fast-uri pin) moved to pnpm-workspace.yaml (pnpm ignores the npm-only field) - allowBuilds: better-sqlite3, node-pty, @sentry/cli, native toolchain, and the two git-hosted deps (@fleet/ai-forms, limitkit — pnpm wants the exact resolved spec, keys move with the pinned tags); temporary minimumReleaseAgeExclude for our own @bitbaum/ai-kit@0.6.2 - phantom deps declared: @auth/core (src/auth.ts augments @auth/core/jwt — TS2664 under pnpm's strict layout), dotenv, sharp (scripts) - CI/audit/deploy workflows: pnpm/action-setup@v6, store-dir pinned outside the action's bin dir, cache: pnpm, frozen-lockfile; deploy's separate `npm --prefix bridge ci` is covered by the workspace install; Next cache key hashes pnpm-lock.yaml; npm audit → pnpm audit - desktop-release: root install → pnpm; desktop/ itself STAYS an npm package (own package-lock.json, electron toolchain untouched) - husky: pre-push staleness gate now compares pnpm-lock.yaml against node_modules/.modules.yaml; hooks + scripts (deploy-hetzner, hetzner/deploy, install-app, doctor, smoke) converted to pnpm - check-deploy-ready fleet gate now recognizes pnpm verify/test lines too Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn * fix: prettier-format pnpm-workspace.yaml — format:check gates verify Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn --------- Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
34f6d27ea6 |
fix(ops): the box register follows revampit to evig, and conformance notices a unit that lost its guards (#475)
revampit was renamed to evig on the box on 2026-09-02 (/opt/revampit -> /opt/evig,
revampit-app -> evig-app). The app repo caught up. This repo — which holds the
box register and the tooling that watches it — did not, and two of the stale
references were load-bearing:
- verify.sh ran `systemctl is-active revampit-app` for a unit that no longer
exists (`inactive`, exit 4), so the full-fleet sweep was permanently FAIL
and never once checked the app that replaced it. A sweep that always fails
is a sweep nobody reads.
- uptime-sweep.sh watched revampit.orangecat.ch, which is now a Caddy `redir`
block — a static 308 the sweep counts as up. That entry answers "is Caddy
alive", not "is the app alive", and would have reported up through an evig
outage. Pointed at evig.orangecat.ch, it probes /api/health for real.
The rest is register hygiene with no live consequence: the push-deploy hook
installed a command at /home/g/dev/revampit/scripts/selfhost-deploy-revampit.sh
(neither path exists any more), and three runner sandboxes listed a
/opt/revampit that is gone while omitting the /opt/evig that replaced it.
The automation, because a fix that only repairs today is worth 1x:
runtime-conformance-audit.sh now asks whether an enabled *-app.service still
has its guardrails — a memory cap and an OnFailure. A rename moves the unit
file; it does NOT move the .service.d/ drop-ins beside it. evig-app ran for two
days with MemoryMax=infinity on a shared box and no failure alert because its
drop-ins were still in the old unit's directory, and nothing noticed, because
these drop-ins are box state that no repo describes. Every other app unit on
the box carries both, which is what makes an exception a finding rather than a
preference. The audit already runs every 6h and alerts per finding, so this
class now pages instead of waiting to be stumbled over.
Evidence, on the real box:
# after restoring evig-app's drop-ins by hand
$ sudo bash runtime-conformance-audit.sh
checked 26 app dirs on node 24.20.0
findings=0 unreadable=0
# negative control: move the drop-ins away again
FINDING|evig|unit has no memory cap (MemoryMax=infinity) on a shared box
FINDING|evig|unit has no OnFailure= — it can die without alerting anyone
$ bash scripts/hetzner/verify.sh
OK evig systemd=active local=200 public=200
... 23 checks, exit 0
`npm run verify` green: tsc clean, eslint 0 errors / 3 warnings, 130/130 unit
test files, 150 home tests, 66 uptime-sweep tests, all ops suites.
Claude-Session: https://claude.ai/code/session_01LmyE2aLaXKB2V7WA3XQprm
Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
caa0e41c3b |
chore: add a formatter (#449)
* chore: add a formatter, matching the style this repo already writes singleQuote=false was chosen by counting this repo's own imports, not by fleet decree. The fleet is genuinely split and the two repos that already had a .prettierrc disagreed with each other, so there was no standard to restore. Quote style does not cross repo boundaries; having a gate does. Markdown is ignored for now — prettier rewraps prose, which would bury the real diff. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * style: format with prettier (1062 files) Mechanical. No behaviour change. This SHA is listed in .git-blame-ignore-revs so `git blame` skips it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * chore: teach git blame to skip the reformat Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(lint): reattach two guards the reformat detached Both effects were one-liners, so a trailing eslint-disable-line covered the setState call: useEffect(() => { setSelected(new Set()); }, [q.length]); // eslint-disable-line ... prettier expanded the block. The comment stayed on the closing line while the call moved above it, so the guard protected nothing and the rule its author had deliberately silenced failed the build. This is the second shape of the same defect — hirnli had the eslint-disable-NEXT-line variant. Both come from the same fact: an eslint directive binds to a line number, so reformatting can silently unbind it, which makes 'mechanical, no behaviour change' false for any bulk reformat. * chore(desktop): bump the runner version the reformat requires desktop-release-drift enforces that anything built into Fleet Runner which differs from the last released tag must carry a version ahead of that tag — main read 0.8.15 and fleet-runner-v0.8.15 already shipped. A whole-repo reformat changes bytes under desktop/, so the gate fires. The alternative was adding desktop/ to .prettierignore, which would buy a quiet PR by carving a permanent hole in the formatter's coverage — the precise shape of silent drift this test was written to catch. Bumping is what the rule asks for and costs one patch release whose only content is whitespace. * chore: merge main and re-format A whole-repo reformat conflicts with any concurrent commit, and a conflicting PR runs no checks at all while reporting nothing. Conflicts resolved to main, which is correct because this branch changes formatting and nothing else. * chore: leave desktop/ out of this reformat desktop-release-drift is right to refuse this. Everything under desktop/ is built into Fleet Runner, so changing it means shipping: bump the version AND add a FLEET_RUNNER_RELEASES entry, whose stated audience is 'person who installed Fleet Runner and wants to know what changed'. For a whitespace-only build the honest answer is 'nothing', so that release should not exist — and I should not write release notes claiming otherwise. I had bumped to 0.8.16 to get the gate green. That was the wrong direction: publishing a build to three OS runners to keep a formatting PR quiet. Reverted. desktop/ is excluded in .prettierignore with the reasoning recorded there, to be formatted alongside the next real runner change, where the bump and the notes are true anyway. --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
7c12ddb023 |
feat(ops): SSOT registry for everything that reaches the operator's Telegram (#445)
George: 'telegram should still update me on things. and we should have ssot for things telegram does/updates me on. i do like when it tells me when there is feedback sent through the feedback form.' docs/telegram-notifications.md is now that SSOT: every notification class — requested updates (visitor feedback, run outcomes, Loki briefings), incidents (with the fix-agent dispatch), platform self-checks, and off-repo senders (Loki cron, orangecat uptime) — one row each: what arrives, when, from where. Enforced, not aspirational: scripts/ci/check-telegram-registry.sh (wired into npm run verify) finds every sender surface in the repo — direct api.telegram.org calls, importers of telegram-send.ts, box scripts sourcing lib-alert.sh — and fails when a path is missing from the registry. Adding a notification without registering it turns CI red in the same PR. Mutation-proven: a planted unregistered sender fails the gate naming the file; removing it goes green (22 sender files registered). Claude-Session: https://claude.ai/code/session_018RmMktaYn8MuJdEqjp5gWU Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
20ff75ef33 |
fix(ops): only flag units that are meant to be running (#440)
The unit check asked "is it active?" and flagged aoz-demo, which is stopped AND disabled with nothing routed to its port — deliberately retired. A check that reports a decision as a fault is one people learn to ignore, and an ignored check is worse than none. "Is it supposed to be running?" is a different question from "is it running?". Enabled-but-inactive is the fault; disabled-and-inactive is a choice. Claude-Session: https://claude.ai/code/session_01UvjGNAS9CMfEGNW26tUR4P Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
63c9f2e943 |
feat(ops): audit what is DEPLOYED, not what is committed (#439)
bitbaum/fleet already has hosted-supabase-audit.sh, whose stated job is "does
any repo still point at a Supabase we retired?". It ran on 2026-08-28 and
reported SUCCESS while printcraft returned 500 in production, pointing at a
hosted project whose DNS no longer resolved.
It missed because it runs `git grep` over repo checkouts, and the reference
lived in /opt/printcraft/shared/.env — not in git, deliberately, because the
box is the environment SSOT. The gate was scoped to the wrong substrate: it
checked the artifact while the configuration lived in the running system. A
check that looks in the wrong place is worse than no check, because it answers.
The rule this implements: SOURCE audits run in CI against git, RUNTIME audits
run on the box against what is actually deployed. The fleet had a good
collection of the first kind and none of the second.
Five checks, each a shape that has already bitten:
- an env still naming a retired managed host (supabase.co, neon, planetscale)
- a configured host that no longer resolves
- a process running with keys its .env can no longer provide — config broken
on disk for hours while the process holds the old values, which is exactly
how 25 vitareba cron jobs died at the next restart
- a declared node engine the box cannot satisfy
- an app unit that is not active
Found on its first run, before it was committed:
revamp-info declares node >=22, box runs 20.20.2 — and it IS deployed
revampit points at a dead trycloudflare.com quick-tunnel host
aoz-demo unit inactive
Alerts per finding, never one aggregate: host-check spent six weeks unable to
fire because one permanently-failed unit pinned a single boolean at `bad`.
Claude-Session: https://claude.ai/code/session_01UvjGNAS9CMfEGNW26tUR4P
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
3dcfe4bf18 |
fix(ci): the audit never looked at steps written as - uses: (#429)
* fix(ci): the audit never looked at steps written as `- uses:` `^\s*uses:` matches a `uses:` that is the first key on its line. A step in the compact list form — `- uses: actions/checkout@v5` — has a dash in front and was never matched, so the audit skipped it while printing a ref count that made it look like it had checked everything. Measured across the fleet before the fix: 59 of 155 workflow files contained at least one reference the audit never looked at. Nothing was broken by it, and the reason is worth recording. A job-level `uses:` — the reusable-workflow call, the thing all three outages came through — is a mapping key and never a list item, so it was always matched. Only step-level action references were invisible, and today those are five third-party refs (actions/checkout, actions/labeler, pnpm/action-setup) which all resolve. No bitbaum-owned reference is currently written as a step. So this is a latent hole, not a live outage: the moment a fleet-owned action is referenced as a step — the natural way to write one — it would be invisible to precisely the check built to catch it. Found by auditing the audit for its own class: a reference that resolves for every tool you would check it with, but not for the consumer that uses it. Here the consumer was the gate itself. Mutation-proven: reverting the dash fails the compact-form test, restoring it passes. Coverage widened from 24 to 26 distinct refs against the real fleet, still green, no false positives. Suite is 26 assertions. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UvjGNAS9CMfEGNW26tUR4P * fix(ci): push the actual regex fix, not the mutation of it The previous commit on this branch shipped the MUTATED lib. A verification script copied the deliberately-broken variant back over the file being pushed (the restore put back only the copy under ci/, not the one at the top level), so the branch carried the dash-less regex while the test asserting the dash went with it. CI caught it immediately, which is the point: the test written alongside the fix is what proved the fix was absent. A gate that only ever sees the intended input would not have. Rebuilt from main plus the single intended edit, and the artifact is checked for the dash before the push rather than after. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UvjGNAS9CMfEGNW26tUR4P --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
d0029f2665 |
feat(ci): fail the build when an app ships migrations it never applies (#428)
botsmann shipped eleven migrations that were applied nowhere. /api/health served PGRST205 from a table that did not exist, for months, while every deploy went green — because deploy.sh skips apply-schema.sh entirely when the manifest's db field is `-`. Nothing failed. Nothing ran. Those look identical from outside, and that is the whole bug. Then printcraft did it too: five more migrations the pipeline never saw (#407). Twice is a class. The third is what this prevents. The gate: an app whose repo contains migrations while declaring `db=-` fails the build, naming the app and the directory holding the SQL. A zero-check, not a ratchet — no app violates this today, so any occurrence is a regression rather than inherited debt. The four apps that legitimately declare `db=-` (camille, sbb-lost-found, sink, substrata) genuinely have no migrations, and a test pins that this stays legal. ONE LIST, NOT TWO A gate with its own idea of where migrations live would drift from the applier and start lying in the other direction — passing an app whose SQL sits in a directory it never checks. So apply-schema.sh's candidate paths moved into a `migration_dirs` function above its lib-only return, and both consumers read it. Its five drizzle candidates, one prisma and two supabase homes had never been unit-testable before, because the discovery sits below that return; they are pinned now, in the applier's own order. Proven able to fail before shipping: fixtures assert a supabase-layout app and a drizzle-layout app each go red, that an app declaring its database is untouched, and that db=- with no migrations stays legitimate. The gate is about the lie, not about having SQL. 34 apply-schema tests, 18 deploy-ready-gate tests, whole ops suite green. Claude-Session: https://claude.ai/code/session_018waGt1ieA9TjpscqrbrnGb Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
a7e1279bbe |
feat(ci): the audit checks the referenced FILE, not just the repo (#427)
verdictFor proves the OWNER resolves. Nothing proved the file inside it still exists at that ref — and those are different failures with the same symptom. A rename leaves the file intact under a new owner. MOVING a shared workflow and deleting the old copy leaves the owner perfectly canonical and the file gone. Both kill the run identically: it dies before any job exists, zero jobs, no log, "workflow file issue", and the caller PR stays green and mergeable. This is not hypothetical. Sixteen repos called bitbaum/dotfiles/.github/workflows/auto-merge-sweep.yml; the shim was deleted today once they had all migrated to bitbaum/fleet. `bitbaum/dotfiles` is and remains canonical, so the owner check sees nothing wrong. Verified live: that path now returns 404 while bitbaum/fleet returns 200. Structure follows the existing split — pure decision in the lib (pathVerdictFor, no network, fully testable), lookup in the script (pathExists, cached per owner/path@ref). USES gained two capture groups for the subpath and ref; callers destructuring [, owner, name] are unaffected, which the existing tests already pin. A missing subpath is never a finding: `actions/checkout@v5` has no file to check beyond the repo. A failed lookup is `unreadable`, never clean and never a false stale — same rule the owner check already follows. Mutation-proven, each red then green: exists===false treated as ok -> exit 1 failed lookup treated as clean -> exit 1 USES stops capturing subpath/ref -> exit 1 restored -> exit 0 Plus end-to-end against the real deleted reference: caught, while the live replacement and a plain action pass. Suite is 22 assertions; the full audit runs clean over the real fleet (32 repos, 155 workflow files) with no false positives. Claude-Session: https://claude.ai/code/session_01UvjGNAS9CMfEGNW26tUR4P Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
56e2187f07 |
test(ci): cover the mechanism that actually catches the outage, not just the newer bug (#423)
Only fleet-refs-audit's RETIRED_HANDLES self-match had test coverage. The USES regex and the stale/missing/ok verdict decision — the part that would have caught all three real outages this tool exists for (2026-08-26/27/28) — had zero tests. A regex bug there would silently miss exactly the class of breakage the whole tool was built to catch, which is a bigger risk than the bug just fixed. Extracted verdictFor(slug, real) into fleet-refs-audit-lib.mjs as a pure decision function — no network call, so it's directly testable — replacing the inline if/else in fleet-refs-audit.mjs with the same behavior. 10 new assertions: USES correctly matches plain and path-qualified uses: lines, correctly excludes local (./…) and docker:// references (no owner to be wrong about), matches multiple lines independently, tolerates indentation; verdictFor correctly reports ok/stale/unreadable for all four real outcomes resolve() can produce, including the failed-lookup case, which must report unreadable rather than silently pass OR falsely fail. Documented one known, narrow limitation rather than silently claiming full coverage: USES matches by line shape, not YAML structural position, so a run: block whose first physical line happens to read literally like a uses: key would be misread. Not observed in this fleet; a real YAML parse would close it at the cost of a dependency this script deliberately avoids. 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> |
||
|
|
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> |
||
|
|
d5f02c2a5c |
fix(ci): the reference audit failed on its own configuration (#420)
Its first real CI run went red on itself: the workflow sets
RETIRED_HANDLES: maonakamoto, and that is a live line, not a comment. The
handle it is configured to hunt for appears in the file that configures it.
The mutation tests missed this for a specific and repeatable reason — they ran
against a fleet that did not yet contain the audit. A gate cannot be proven
against a world it is not yet part of.
The exclusion is deliberately narrow, and each half is proven:
- SELF_REPO=__none__ (exclusion disabled) -> exit 1, fails on its own file,
so the exclusion is what suppresses it rather than the detector going blind
- exclusion enabled -> exit 0, and 155 workflow files still read, including
that one, so it is skipped for this check only and not skipped entirely
- RETIRED_HANDLES=ubuntu -> exit 1 with 115 live-line hits, so detection in
every other workflow is untouched
Claude-Session: https://claude.ai/code/session_01UvjGNAS9CMfEGNW26tUR4P
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
a58961aac8 |
fix(ci): deploy-ready gate now checks CD, not just CI — and fixes a live drift it just found (#419)
Two real gaps surfaced by a fleet-wide CI/CD audit, both now closed: 1. This gate only ever verified CI existence. camille-boulangerie had ci.yml (verify ran green on every push) and no deploy.yml at all — a green push there has never once reached the box. The gate's own stated purpose is "absence must not read as success," and it was doing exactly that for CD. Fixed in a companion PR (bitbaum/camille-boulangerie#2): the gate now detects a Deploy-shaped workflow the same way it detects CI, ratcheted independently so a CI regression and a CD regression can never mask each other under one shared count. deploy-ready-cd.baseline seeded at 0 — every deployed app now genuinely has both, verified fresh, not assumed. 2. apps.conf's `sink` entry pointed at /home/g/dev/aslan-tattoo, which no longer exists — some prior autonomous session renamed the checkout to /home/g/dev/s-ink and nothing updated the register. Running this gate locally caught it immediately (the "drift, not a bare environment" path added earlier today). Fixed the path. Neither of these was visible from CI passing: (1) needs a live check that CI has never run, and (2) can ONLY be caught locally, since it depends on the actual fleet checkouts existing — nothing schedules that check anywhere. That residual gap (no cron ever runs the fleet-inspection half) is reported separately, not fixed here — it needs a real decision about where such a check could run unattended, not a quick patch. scripts/test/deploy-ready-gate.sh gets 4 new cases using synthetic fixture repos (not the real fleet, which could coincidentally look fine) to prove CI and CD are detected independently, including camille's exact shape: a repo with only a CI workflow must be flagged for missing CD, not CI. 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> |
||
|
|
1697d93bc8 |
feat(ci): audit every workflow reference in the org, on a schedule (#418)
Three times in three days a rename or a transfer stopped every merge and every
deploy across the fleet, and all three times nothing looked wrong. GitHub
follows a rename for REST and for git; the Actions `uses:` resolver does not.
The run dies before any job exists — zero jobs, no log — so the workflow that
would report the failure is the one that cannot start, and pull requests stay
green and mergeable while nothing ships.
That is why this cannot be a per-repo check. A copy inside each repo only
protects repos that already have CI, and petvity and solon and datacat each had
a dead deploy with no auto-merge.yml to notice it. This asks GitHub, from
outside, what every referenced repo is really called and compares that to what
the workflow says.
Found on its first run, before this was even committed: datacat and solon both
called catomean/fleetcrown and had been unable to deploy since the org move.
Two deliberate details:
- Comment lines are stripped before the retired-handle check. Workflows that
EXPLAIN this outage name the old account on purpose, and a gate that fires
on its own documentation is one people learn to ignore.
- MIN_REPOS is a floor. "0 problems" across 0 repos is not a pass; if the
token stops seeing the fleet that must fail, not report clean.
Not closed by this: it fails red in Actions, which nobody watches. It closes
detection, not notification. Routing it through FleetCrown alerts is the
follow-up.
Claude-Session: https://claude.ai/code/session_01UvjGNAS9CMfEGNW26tUR4P
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
45938e60cf |
fix(ci): unbreak the gates — dependency graph, agent-core drift, desktop release (#400)
* refactor(infra): studio constants get one home, and the rename gets a command Fair criticism: I spent the day arguing for SSOT and then wrote new-site.sh with its own copies of GH_OWNER, BASE_DOMAIN and DEV_ROOT, and hardcoded 'maonakamoto' again in provision-widget.ts. Worse, the pattern already existed — _box-env.sh is literally labelled 'SSOT' for the box address. I did not extend it, I duplicated around it. _box-env.sh now owns GH_OWNER, SITES_BASE_DOMAIN and DEV_ROOT alongside the box address, and new-site.sh and provision-widget.ts read them instead of carrying their own. The 41 workflow files are a different case and worth being precise about: GitHub Actions requires a LITERAL owner/repo in and will not accept a variable, so that duplication cannot be removed. But a duplication you cannot remove is one you have to OWN — leaving it as 'remember to edit 41 files' is exactly the shape of step that gets skipped, the same shape as the git repository Camille never got. So sweep-gh-owner.sh is committed: one command, dry-runnable, optionally self-committing. Dry run against the fleet: 24 repos, all detected correctly. Renaming to an org is now plus one line in _box-env.sh. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(infra): split WORKFLOW_OWNER from GH_OWNER before they diverge Same bug as the last commit, one layer down. The site template hardcoded maonakamoto/fleetcrown in its deploy.yml uses: line, derived from nothing — so every new site would bake in a literal that follows neither an account rename nor a move to an org. And GH_OWNER was quietly doing two jobs: where new site repos are CREATED, and where fleetcrown LIVES. They look identical today and are about to diverge — sites go to an org while fleetcrown stays on the personal account. One name for two values is how a rename half-works. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(ci): GitHub owner maonakamoto -> catomean * chore(infra): owner is catomean Account renamed maonakamoto -> catomean. sweep-gh-owner.sh swept 24 repos and the SSOT now agrees; 32 local remotes repointed. This is the commit the sweep script exists for. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * chore(ci): GitHub owner maonakamoto -> catomean * chore(ci): GitHub owner maonakamoto -> catomean * fix(desktop): cut 0.8.14 — the owner rename touched desktop code My owner sweep changed two files in desktop/ (an update URL and a package reference) without bumping the version. That is precisely the failure #370 existed to prevent: desktop code that changes without a release ships to the server and to no machine at all, silently. The gate caught it, four commits after it was written. Working as intended, and worth saying plainly — I was the one it caught. GitHub redirects repository URLs after a rename, but only until somebody claims the freed name. An auto-updater should not depend on a redirect. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(ci): the gate fails on your diff, not on your laptop Three things in this hook blocked pushes for reasons unrelated to the change being pushed, and together they are why --no-verify became reflex here. I passed it eight times in one day and blamed the hook; the hook was reporting real problems with misleading attribution. 1. STALE INSTALL. An unresolvable dependency surfaced as 'Cannot find module' — indistinguishable from a type error in your code. Now a precondition that fails first, loudly, naming npm ci. A day was spent on this exact confusion. 2. AGENT-CORE DRIFT. Drift arises either because you changed canonical without syncing, or because somebody changed the mirror in the other repo. Only the first is yours. It now checks whether this branch touched src/lib/agent/core/ and warns instead of blocking when it did not. 3. SCHEMA DRIFT. The guard already skipped an unreachable database but not a reachable stale one, so a local scratch DB missing someone else's columns blocked pushes touching no schema. Now scoped: if the branch changes schema a mismatch is yours and blocks; otherwise it reports and continues. The pattern is taken from desktop-release-drift, which self-scopes to files changed since the last release and is the only check here that has never blocked an unrelated push. It caught me correctly today, four commits after it was written. Where scope cannot be established the checks still fail closed — a gate that cannot establish innocence should not grant it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(ci): resolve the default branch, never assume main The diff-scoping added in the previous commit compares against origin/main. 28 repos here use main — but aoz-housing, dotfiles and sbb-lost-found use master, and six had no origin/HEAD set at all. On those, merge-base fails, the scoping falls through to 'cannot tell', and every check treats every change as in-scope. The gate I had just fixed would have gone back to blocking unrelated pushes on a fifth of the fleet, for a reason nobody would have connected to a branch name. default_branch() now lives in lib.sh and resolves in order: the remote's own origin/HEAD, then whichever of main/master exists, then fail. Never a guess. The pre-push hook and agent-core-drift both use it. Also ran 'origin/HEAD' is unchanged and points to 'main' on the six repos missing origin/HEAD. 32 of 33 now resolve; wild-spirit has no remote at all, which is a separate finding and the same shape as camille this morning. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(scaffold): every new site is born with CI ci-gate.sh cannot tell 'CI green' from 'no CI configured' — both exit 0. So a scaffolded site without a workflow deployed every push unverified while looking identical to one that passed. Substrata shipped to production that way for a day. The template now emits ci.yml alongside deploy.yml: npm ci, type-check, lint, build — the same bundle verify runs locally. Plus eslint.config.mjs, because ESLint 9 without a flat config exits non-zero on a migration notice and a new site's FIRST CI run would be red for reasons unrelated to its code. A red first run teaches people to ignore the light. Config copied from the fleet's working Next 16 apps, not invented. postcss.config.mjs assigns before exporting — the anonymous default export is a lint warning, and a scaffold should not emit its own warnings. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(ci): no deployed app ships without CI, ratcheted to zero ci-gate.sh exits 0 for 'CI green' AND for 'no CI configured'. Absence is indistinguishable from success, so an app with no workflow deploys every push unverified while looking exactly like one that passed. Nothing reported it, because nothing was looking. The audit found two: camille-boulangerie, and sink — which is sinktattoo.com, a real client's site. sink turned out to be a FALSE POSITIVE, and that is the more useful finding: apps.conf pointed at /home/g/dev/s-ink, a path that does not exist, so the gate reasoned about an absent repository and reported the wrong fault. It sent me to add a workflow to a repo that already had one. The register was the bug. So the gate now distinguishes a stale register entry from a missing workflow and fails loudly on the former — a gate that lies about what to fix is worse than no gate. apps.conf repointed at /home/g/dev/aslan-tattoo. Camille genuinely had none and now does. Baseline is 0: a new deployed app without CI is a build failure. Tested in all four directions — over baseline fails, at baseline passes, under baseline passes and prompts, stale path fails. The first version could never fail at all: it set HERE before sourcing lib.sh, which overwrites HERE, so BASELINE_FILE pointed at a missing file and silently fell back to the current count. Found by testing the gate rather than trusting it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(scaffold): template ships .nvmrc Every new site now pins Node once, and both CI and the deploy read it. Without it the deploy warns and the two pipelines pick a version independently — the kind of difference that surfaces as 'green in CI, broken on the box'. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(hetzner): scaffold sets the deploy key itself, from one configured path new-site.sh printed `gh secret set ...` and called that operator hygiene. What it actually produced was substrata live in production deploying only from a laptop, because a printed instruction is a step that gets skipped. The key is piped from DEPLOY_KEY_PATH straight into `gh secret set` — never read into a variable, a log, or an agent's context — so the safety argument that motivated the manual step is kept while the step disappears. Per-repo on purpose: GitHub Free does not expose org-level secrets to PRIVATE repositories, so an org secret alone would silently cover only part of the fleet. DEPLOY_KEY_PATH joins the other constants in _box-env.sh so there is one path, not one per script. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y9rKLxddothnXEtY6KDziN * fix(ci): make the deploy-ready gate judge the diff, not the workstation The gate inspected the sibling checkouts under DEV_ROOT and nothing else. All 15 are cloned on the workstation, so it printed "all 15 deployed apps have CI"; CI clones this repo only, so the same commit printed fifteen missing repos and exited 1 — red on a diff that touched none of them. Third instance of one class: a gate judging state outside the commit. Its real cost is not the red run, it is that everyone learns the gate is noise and reaches for --no-verify. Split into the two halves that were tangled: REGISTER INTEGRITY — apps.conf lives in this repo, so it is in the diff, so CI must judge it. Now actually checked: field count, unique names, unique numeric ports. Previously nothing validated the register at all. FLEET INSPECTION — needs the checkouts. Where none exist it is announced as NOT RUN and exits 0. Announced, because "no output" and "all clear" looking identical is the bug this file was written to fix. Where some exist, a bad path is still drift and still fails. test:deploy-ready-gate locks it shut from both sides: a malformed register must fail even with no checkouts present, and a bare environment must never claim the fleet passed. Added to verify, so CI runs it in exactly the environment that used to break it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y9rKLxddothnXEtY6KDziN --------- Co-authored-by: Mao Nakamoto <georgy.butaev@revamp-it.ch> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: t <t@t.t> |
||
|
|
d66788a135 |
refactor(infra): studio constants get one home, and the rename gets a command (#399)
* refactor(infra): studio constants get one home, and the rename gets a command Fair criticism: I spent the day arguing for SSOT and then wrote new-site.sh with its own copies of GH_OWNER, BASE_DOMAIN and DEV_ROOT, and hardcoded 'maonakamoto' again in provision-widget.ts. Worse, the pattern already existed — _box-env.sh is literally labelled 'SSOT' for the box address. I did not extend it, I duplicated around it. _box-env.sh now owns GH_OWNER, SITES_BASE_DOMAIN and DEV_ROOT alongside the box address, and new-site.sh and provision-widget.ts read them instead of carrying their own. The 41 workflow files are a different case and worth being precise about: GitHub Actions requires a LITERAL owner/repo in and will not accept a variable, so that duplication cannot be removed. But a duplication you cannot remove is one you have to OWN — leaving it as 'remember to edit 41 files' is exactly the shape of step that gets skipped, the same shape as the git repository Camille never got. So sweep-gh-owner.sh is committed: one command, dry-runnable, optionally self-committing. Dry run against the fleet: 24 repos, all detected correctly. Renaming to an org is now plus one line in _box-env.sh. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(infra): split WORKFLOW_OWNER from GH_OWNER before they diverge Same bug as the last commit, one layer down. The site template hardcoded maonakamoto/fleetcrown in its deploy.yml uses: line, derived from nothing — so every new site would bake in a literal that follows neither an account rename nor a move to an org. And GH_OWNER was quietly doing two jobs: where new site repos are CREATED, and where fleetcrown LIVES. They look identical today and are about to diverge — sites go to an org while fleetcrown stays on the personal account. One name for two values is how a rename half-works. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Mao Nakamoto <georgy.butaev@revamp-it.ch> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
83837d0046 |
ci: call the central auto-merge sweep, now that it can deploy (#322)
This repo was one of two deliberately excluded from the fleet rollout, because its copy of auto-merge-sweep.sh carried something the canonical did not: the DEPLOY RECONCILER. Converting before that landed would have let merges reach main and never reach the box — the exact failure the reconciler exists to prevent, and one this repo has already had (2026-08-05: three PRs merged, main green, zero Deploy runs created). That reconciler is now in the canonical (maonakamoto/dotfiles), generalised behind DEPLOY_WORKFLOW and off by default, so this file enables it explicitly with `deploy_workflow: deploy.yml`. Removing that input makes merges land and never ship. Verified before deleting the local copy: diffed it against the canonical and accounted for every line that differs. All 36 non-comment differences are the `main_*` vs `base_*` variable naming for identical logic, the reconciler now absorbed, and a hardcoded ci.yml re-arm the canonical does via REARM_WORKFLOWS. Nothing unique is lost. That check is not ceremony — the first attempt at choosing a canonical picked the LONGEST variant, which turned out to be missing features ten repos depended on. Also repointed two references that would have become lies the moment the file was deleted: CLAUDE.md and deploy.yml both told the reader the policy lived at scripts/ci/auto-merge-sweep.sh. They now say where it actually lives, and that a fix made here would reach nobody. Fleet duplication: 9 copies -> 8. Co-authored-by: t <t@t.t> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
cc4e892559 |
perf(deploy): the pipeline was waiting, not working (#293)
Merge→live measured 14–27 minutes. The irreducible work in that window is about 80 seconds: build 66s, rsync 4s, restart 4s, verify 7s. Nearly all of the rest was waiting, so nearly all of the fix is removing waits rather than making anything faster. Two waits, measured: 1. The runner drain, 480 of the ship step's 570 seconds. The deploy watched one in-flight agent, then restarted anyway at the cap. The web app had been live and verified for eight of those minutes. Two systems with opposite needs were sharing one job's wall-clock — the app wants to be live now, the runner wants to not kill anyone's work — and the runner won every time. A shorter timeout would only kill agents sooner. The wait itself is fine; the place it happened is what cost. Waiting is expensive in CI and free on the box, so it now happens on the box: the deploy schedules a detached systemd-run unit and returns as soon as the app is verified. The drain gets *longer* (1800s, not 480) and cheaper at the same time, because nothing is holding a runner open for it. 2. The CD reconciler, up to 10 minutes and 18.6 of #284's 26.8. Deploy chains off CI via workflow_run, which never fires for a CI run that GITHUB_TOKEN started — i.e. for every auto-merged PR, the only path that merges code here. The sweep covered that by reconciling on its next tick: correct, self-healing, and late. A dispatch is not a push, so it is not subject to the no-cascade rule. ci.yml now dispatches Deploy itself the moment main goes green. The sweep keeps its reconciler as the safety net, which is the right shape for "did something get missed?" and the wrong one for "did something just happen?". Also caches .next/cache across deploys — the build is the one part of this that is genuinely work, so it is the one part worth shrinking. Not done, and worth saying: I thought CI and Deploy each built the app, so the tested artifact was never the shipped one. That was wrong. ci.yml deliberately skips `next build` because App-Router pages query Postgres during pre-render; the build happens once, in Deploy. There was no discarded build and no artifact to pass. The decoupling has a test, and it asserts the property rather than the patch: the deploy must not block on a drain, the restart must be detached, the script must be shipped before it is invoked, and the drain must stay bounded. Verified the first two assertions fail against the previous version (4 blocking markers, 0 systemd-run) rather than merely passing against this one. Co-authored-by: t <t@t.t> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
15faf227b8 |
fix(deploy): a week-old main still passes "are you on main?" (#285)
Production was rolled back today and self-healed before anyone looked.
CI shipped main at 09:47 and verified it live at 09:48 — the deploy log
says "live build is
|
||
|
|
c8415a348b |
fix(loki,deploy): the approval queue survives a Groq outage; deploys can't ship off-main (#262)
* fix(loki,deploy): the approval queue survives a Groq outage; deploys can't ship off-main "What is pending for approval?" answered "Not in your data." in production while drafts were waiting. Two independent causes, both fixed here. 1. A hand-run deploy shipped a feature branch to the box — twice, minutes apart — rotating the correct CI build out through app.prev and reverting three merged PRs. Prod served a Loki with no approval-queue tool while main had shipped it hours earlier. The symptom was indistinguishable from an application bug and was chased through the app first. scripts/ci/check-deploy-ref.sh now refuses any deploy whose commit is not contained in origin/main, naming both the unreviewed commits and the ones it would roll back. Override is explicit and announces itself. deploy-hetzner.sh calls it before the schema step, so a refusal leaves the box untouched. The existing --ref guard only ever covered HEAD drift DURING a build; this is the invariant that was missing. Second occurrence of this class — see the comment it replaces. 2. Even on the right build the answer was wrong, because the queue was reachable ONLY by tool call. Groq's org-wide TPM window is exhausted: both the 70B and the 8B step-down 429 on every call, the bounded retry expires, the tool loop dies, and Loki answers from seed facts on a TOOLLESS fallback model — which cannot see a tool-only table, so it truthfully reports nothing. pendingApprovalFacts() moves to sources.ts and is seeded into the grounded context on an approval cue, so the question is answerable with the tool loop entirely unavailable. The tool now calls the same function: one definition, both paths. Approvals lead the fact list — the seed is head-sliced, so the subject of the turn must not sit in the tail. Tests: deploy-ref-gate.sh (7) covers the incident shape directly — an off-main branch is refused, an ancestor of main is not. approval-cues.ts (24) pins the cue against the operator's real phrasings, including the typo from the report, because a missed cue is silent and reads as a truthful "nothing is pending". Also folds the duplicated dateLabel (handlers.ts + an inline copy in sources.ts) into one exported helper. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(loki): drop the now-unused getPendingActions import The tool handler delegates to pendingApprovalFacts, so the direct query import is dead. tsc does not flag unused imports; eslint does. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: test <test@test> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
26a8b397f0 | fix(ci): a red base must not trap the PR that repairs it (#195) | ||
|
|
aec0962af2 |
fix(ci): a merge train stuck forever must not print like an idle one (#194)
A red base branch blocks merges — correctly. But when the PR that repairs the base is itself in the queue, the guard blocks the fix for the thing it is blocking on, and neither side can ever move. Observed 2026-08-07 on aoz-housing: a green PR fixing master's E2E seed sat while sweep after sweep exited 0 on "refusing to merge onto a broken base". Every run reported success, so the automation looked healthy and idle rather than permanently stuck. Four commits went undeployed for ~16h behind it. This is the third time in this fleet that a permanent stall has been indistinguishable from an ordinary skip, so fix the class, not the instance: keep the guard (never merge onto a broken base — that is load-bearing) and make the stall loud instead. When the base is red, list the open, non-draft, CLEAN, unheld PRs that cannot land and say how to unstick it. Breaking the tie stays a deliberate call; only its invisibility is removed. Co-authored-by: test <test@test> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
3048995eb2 | fix(ci): stop skipping conflicts, and keep branches current (#191) | ||
|
|
75d03dbdcd |
fix(ci): drain the merge queue oldest-first, not newest-first (#182)
`gh pr list` returns newest-first, and the sweep merges the first eligible PR and stops. So the newest green PR won every sweep, and an older one could wait indefinitely. Not theoretical — observed today. Consecutive sweeps merged #181 and #180 while #155 (green since this morning), #176 and #178 sat untouched and were never even evaluated, because the loop breaks after the first merge. With several agent sessions opening PRs continuously, "newest wins" is starvation. It also starves exactly the wrong PR: the one that has been waiting longest is the one whose checks were proven against the most now-stale main. PR numbers increase monotonically with creation, so sorting by number ascending is FIFO. The ordering was never a decision — it was whatever gh happened to return — so make it one, and say so in the header comment next to the one-car-per-sweep rule it belongs with. Co-authored-by: test <test@test> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
ec2d0d196e |
fix(cd): auto-merged PRs must actually reach the box (#171)
* fix(system): box capacity specs must not wrap under the status word Caught rendering prod /system at 320px: the upgrade-target row was a single baseline-aligned flex row, so the spec text wrapped beneath the "blocked" badge — "…160" on one line, "GB disk" orphaned on the next, reading as two unrelated fragments. Narrow screens now put the spec line on its own full-width row (order-3 + w-full) with the status pushed right beside the type name; sm+ keeps the original single-line layout. Layout utilities only — no new tokens. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(cd): auto-merged PRs must actually reach the box Three PRs merged onto a green main today and none of them deployed. The re-arm looked healthy because CI itself ran — but GitHub does not emit a `workflow_run` event for a run that GITHUB_TOKEN started, so Deploy never chained off the dispatched CI. Every auto-merged commit was landing merged-but-not-live, silently. Only #164 shipped, because a human token pushed it. A chain cannot fix this, because the link GitHub refuses to create is the chain itself. So deployment becomes a reconciler: each sweep compares main's tip against the last successful Deploy and dispatches deploy.yml directly when they differ. Self-healing by construction — a deploy that never fired, or fired and failed, is retried next sweep instead of needing a human to notice. It only ever runs against a tip whose own CI is green, which the guard above it already established, and it stands down while a deploy is in flight. deploy.yml gains workflow_dispatch (and an if/checkout that handle both entry points — `ref:` must not fall through to an empty string, which would silently ship the default branch). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: test <test@test> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
da212284a4 |
ci: green PRs merge and deploy themselves (#165)
Nobody is in the merge loop. The owner does not review PRs, and background-job agent sessions are barred from merging by hand — so a verified, ready change had no way to reach main without a manual step that nobody wants to take. Move the policy into the repo, where it is visible, revocable, and applies uniformly to every PR: a non-draft PR with every check green and no hold label gets squash-merged, then CI is dispatched on main so Deploy ships it. Two design points that are load-bearing, ported from OrangeCat's live run: - One PR per sweep, only onto a green main. A PR's checks prove it against the main it branched from, not against the other queued PRs — batching would put an untested combination on main. - Explicit `gh workflow run ci.yml --ref main` after a merge. A push made with the default GITHUB_TOKEN does not trigger workflows, and Deploy chains off CI via workflow_run, so without it every automated merge lands and silently never deploys. ci.yml gains workflow_dispatch for exactly this. Mergeability is polled rather than read once: GitHub computes it lazily and invalidates it whenever the base moves, so the fast path always sees UNKNOWN on its first look. Cancelled checks are re-run rather than read as failures — ci.yml uses cancel-in-progress, so an unrelated push can strand a PR forever. Hold work back with a draft PR or a hold label. Corollary, now documented in CLAUDE.md: never open a non-draft PR you would not want deployed. Co-authored-by: test <test@test> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |