36 Commits
Author SHA1 Message Date
CatoandClaude Opus 5.5 f8da012c95 feat(notify): Telegram only with a one-tap action — one gateway for every bot (#1540)
* fix(alerts): stop paging on transient systemd-run units; send digests silently

The 5-minute host sweep announced every failed one-off systemd-run unit
(run-p<pid>-i<id>) as its own incident. Each has a fresh name, so no
per-unit cooldown held and the phone rang every five minutes.

The sweep now resets those units and never announces them, and the
STILL FAILING / RECOVERED digests are delivered with disable_notification.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtzUbLhg3oqt4X1NaN

* fix(alerts): quiet by default, ring only for down/intrusion; stop deploy and cron echoes

- lib-alert: all box alerts deliver silently except DOWN/deploy failure/
  intrusion-class messages (_alert_silent)
- host sweep: failed appcron oneshots are the OnFailure notifier's, not repeated
- security check: files a deploy rewrites by design are journal-only

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtzUbLhg3oqt4X1NaN

* ci(box): install the alerting scripts on the box when they change

The alert fixes only take effect once install-host-alerts.sh and
install-security-watch.sh run on the box, and nothing ran them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmtzUbLhg3oqt4X1NaN

* feat(notify): one tap or not at all — every bot reaches the owner through one gateway

The owner's Telegram held ~1,200 unread messages and rang every five minutes
with lines he could do nothing with ("STILL FAILING: run-p…", "SENSITIVE
FILE(S) CHANGED … if this was a deploy, ignore", "built nothing"). New rule,
enforced in code: a message reaches the phone only with a button that does
the thing; everything else is recorded on /today or /system.

- telegram-send: refuses a message without a URL button (NOT_ACTIONABLE);
  adds silent delivery and sendTelegramVoice.
- lib/notify: one gateway (deliverNotice) with the policy — at most 3
  buttons, one incident one message with backed-off reminders, 3/source/hour
  and 12/day caps, sound only for "now" and never 22:00–07:00 Zurich. Voice
  notes for paid plans; a monthly "voice notes come with Personal" notice
  with its pay button for free accounts.
- Routes: /api/notify (token holders, `loki.sh notify`), /api/notify/box
  (the box's lib-alert), /api/orangecat/notify (OrangeCat's bots, signed).
- Box: lib-alert posts every line to Loki's list instead of Telegram; only an
  intrusion goes straight to the phone when Loki is unreachable, with a Box
  doctor button. ivy-health pages only "down and restart failed" with
  Redeploy; clean deploy rollbacks are not paged; fleet-uptime pages only for
  Loki or 3+ apps down; sleeping apps are no longer conformance findings.
- App senders: each kept one now carries its button (Triage it, Review it,
  Watch the fix, Write to them, Restart the gateway, Decide on Control …);
  telemetry/runner/model-id pings and run successes leave Telegram.
- Day plan: the morning brief's prompt is in the repo
  (scripts/openclaw/day-plan) and installed on merge, which also switches off
  jobs that only post swap/memory warnings.
- Workflows install the box alerting, ivy-health, the day plan and OpenClaw's
  photo/video understanding on merge instead of by hand.

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

* feat(telegram): every sender is silent between 22:00 and 07:00 unless it says otherwise

Feedback, studio briefs and the other direct senders skipped the notify
gateway's quiet hours. A send that does not ask for sound now arrives
silently at night in the owner's zone.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-02 07:04:45 +01:00
CatoandClaude Opus 5.5 5f1e283117 fix(scripts): grep -q is never the reader of a pipe under pipefail (#874)
`echo "$x" | grep -q PAT` under `set -o pipefail` can report "not found"
for text that IS there: grep -q exits on its first match and closes the
pipe, the writer takes SIGPIPE (141), and pipefail makes the pipeline
status 141. An `if` then takes the else branch on a successful match.

#587 found this in one file and noted it "only fires when the payload
exceeds the ~4KB pipe buffer". That is not so, and the belief is why
82 copies in 22 scripts survived. Measured today on retire-site's real
1,158-byte plan output with has()'s exact pattern, 3,000 calls each:

  'DRY RUN'        line 3 of 20    echo|grep -q   2/3000 false misses
  'apps.conf row'  line 11 of 20   echo|grep -q   2/3000 false misses
  last phrase      line 20 of 20   echo|grep -q   0/3000
  'DRY RUN'                        here-string    0/3000

Rare per call, but verify makes hundreds of these calls, and the
retire-site suite went red on those two exact phrases twice this week,
passing every rerun. It is worse in a NEGATIVE check - hasnt() read a
false miss as a PASS. And several copies are not tests: deploy-hetzner.sh
exits 1 on a false miss, and the sshd drift watch would raise a false
security alert.

All 82 rewritten to `grep -q PAT <<<"$x"` (a here-string is not a
pipeline, so there is no writer to signal) by a script that only touched
the simple quoted-variable form and reported anything else. Checked: all
22 files pass `bash -n`, every file is a 1:1 line swap (82 lines), and
the 20 line-continuation sites keep the here-string before the trailing
backslash (the first draft of the rewrite got those wrong; caught in a
dry-run diff before anything was written).

#587's comment is corrected so it stops teaching the wrong threshold.

Gate: scripts/test/no-grep-q-in-a-pipe.ts ratchets it repo-wide,
including forms the rewrite skipped (e.g. "$(cmd)" | grep -q), and
self-tests that its detector still fires. Proven by restoring the
original deploy-hetzner.sh line.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 02:57:19 -07:00
CatoandClaude Opus 5 baa8e2e6fb chore(aoz): follow bitbaum/aoz-housing -> bitbaum/aoz-begleitung (#732)
The repo was renamed today. It was the last place the product was still called
Housing: the name row in fleet's registers/retired.json retired "AOZ Housing" as
the PRODUCT name on 2026-09-10, but the repo kept it, and the repo is public.

The deploy name `aoz-wohnen` is deliberately NOT renamed with it. It is an
infrastructure identifier — systemd unit, /opt path, database — nothing on the
box keys on the repo name, and moving it would touch a live site for no visible
gain. apps.conf's comment block already said as much and still does.

The load-bearing change is apps.conf's fourth field. repo-metadata-audit.mjs
keys the register on that path's BASENAME, so while it read /home/g/dev/
aoz-housing the join against GitHub missed and every metadata check for this
repo was silently skipped — the audit went green by not looking at it. The local
checkout was moved to match and its three worktrees repaired (`git worktree
repair`), not pruned: they hold branches.

Two test failures worth keeping, because both were the rename telling the truth:

  - project-mention asserted that "the AOZ housing rebuild" resolves to the
    project. With the slug renamed it does not, and should not. The case exists
    to prove "a slug with a hyphen, typed with a space" matches, so the INPUT
    moved to the current name rather than the expectation being loosened.
  - tab-match asserted a terminal tab literally named "AOZ Housing" matches the
    slug. Same thing: the fixture now uses the name the tab would actually have.

Consequence worth naming: someone who types "aoz housing" at Loki will no longer
be understood. There is an alias mechanism for exactly this shape
(register/build.ts maps the deploy name to the repo), but wiring the retired
name into mention-matching is a product decision, not a rename chore.

Left alone on purpose: scripts/db/retire-stale-projects.ts, whose data row
records the project names the database actually held when that migration ran;
and content/thoughts/*.md, published essays — one of which quotes a filesystem
path observed during a debugging session, so rewriting it would falsify the
anecdote.

The production user_projects row was updated too (name and git_url), because the
database is a second copy of the repo identity and a past rename left 21 rows
pointing at a dead account. New URL proven to resolve: 431bae7.

Tests green: fleet-register 44, project-mention 28, tab-match 10, fleet-map 7,
loki-project-ranking all.


Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-15 12:17:25 -07:00
CatoandClaude Fable 5.1 95c40a9cd8 refactor: rename the product from FleetCrown to Loki (#695)
The product, its assistant, the repo, the host and every unit on the box now
share one name. 638 files, ~3,000 mentions: UI copy, config, env keys
(FLEETCROWN_* -> LOKI_*), systemd units (fleetcrown-* -> loki-*), docs,
articles, the deploy workflow other repos reuse, and nine file names.

- Three article slugs carried the old name and had been shared; permanent
  redirects keep those links alive (next.config.ts).
- test-no-retired-name.sh now also forbids the old product name across the
  whole repo, so the rename cannot creep back through templates and examples.
- ASSISTANT_STACK collapses the product and the assistant into one entry,
  because they are now the same name.

Infra was cut over ahead of this merge: /opt/loki, loki-* units, the `loki`
database and role, loki.orangecat.ch (old host 308s to it; /api, /widget,
/embed keep proxying), GitHub repos bitbaum/loki and bitbaum/loki-releases.
The Resend sending domain stays fleetcrown.orangecat.ch until the new domain
is verified in DNS.


Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 16:13:10 -07:00
Cato 69b5926ff4 chore(register): delete the six experiment sites, and gate what let them linger (#678)
* chore(register): delete the six experiment sites, and gate what let them linger

Six sites from dogfood and site-factory runs on 10-11 September were still
live today, five with GitHub repositories behind them. Two of them read as
real Zurich businesses that do not exist — "Velokiosk — Bike Repair at
Zürich HB" and "Kaffeeklappe – Kaffee to go in Zürich Wiedikon" — on the
founder's own domain. Nobody decided to keep them. They were never removed
once the thing they proved was proved.

All six are gone from the box (service, vhost, /opt, checkout, port, row,
workflows, and this box's deploy key revoked from each repo first), and the
five repositories are deleted. This removes their rows here, which had
drifted from the box copy.

The gate is the point. check-no-experiment-litter.sh fails the build when a
generated throwaway name reaches the committed register — a dated suffix
(-sep11-0040) or a throwaway prefix (dogfood-, factory-, probe-, e2e-). No
grace period: spinning one up for an hour leaves no trace here, so
committing its row IS the moment a test becomes permanent.

It matches names, not kinds. A first version judged kind=demo and flagged
sbb-fundbuero and camille-boulangerie, which are real work that happens to
sit at demo status — exactly the false positive that gets a gate widened
until it catches nothing. No product is ever called factory-sep11-0040.

* docs(retire): delete the project first, or the box puts the site back

Deleting the six sites in the obvious order looked like it worked — units
stopped, vhosts gone, directories removed. Two minutes later:

  [box-prepare] cloning velokiosk-sep10 <- github.com/bitbaum/velokiosk-sep10

and three of the six checkouts were back. A FleetCrown project row that
still names a dirPath is a standing instruction to restore the site, and
it is invisible from the box, so the box cannot know the site was retired
on purpose. The order is now part of the documented cleanup.
2026-09-12 10:39:22 -07:00
CatoandClaude Opus 5 4f465c9582 feat(check): does each registered site's widget actually activate (#640)
Two live sites had had no working widget for months and nothing could have told
us. aoz-housing's token was bound to https://aoz-wohnen.orangecat.ch while the
site is served at aoz.orangecat.ch; sbb-lost-found's was bound to
https://sbb.orangecat.ch, renamed to sbbfundbuero.orangecat.ch. The origin is
written once at provisioning and never looked at again; the host is renamed
whenever the project is.

The state is silent. widget.js loads 200, /api/widget-boot authenticates 200 and
answers {"active":false}, the launcher never mounts, nothing is logged, the page
looks finished. Both are fixed — a rebind updates origins in place and keeps the
token value, so neither site needed a rebuild or a redeploy.

THE FIRST VERSION OF THIS CHECK WAS WRONG AND TESTING CAUGHT IT

It compared each token's `origins` against the register's hosts. Run against
real data it flagged four sites that were completely fine: annushka and
orangecat.ch are not register rows but serve working widgets, fleetcrown does
not put a widget on itself, and one token belonged to an OrangeCat project page
that is not a hosted site. The register is not the universe of hosts with
widgets, so "origins ⊆ register" was never the property anyone wanted.

So ask the site instead. For each registered host: fetch the page, take the
token out of it, ask widget-boot with that host as Origin whether it activates.
No database, no name-mapping between register rows and FleetCrown projects
(exactly the mapping that is unreliable — aoz-wohnen is aoz-housing), and it
catches every way a widget can be dead rather than the one way it can be
mis-bound.

AND IT REPORTS THREE ANSWERS, NOT TWO

The token is injected client-side by next/script, so it reaches the HTML only
inside Next's flight payload. surf-your-life and evig put it there later still —
one preloads the script and attaches the token after hydration — so curl sees no
token on two sites whose widgets work. An earlier sweep called that shape
"widget: NO" on four healthy sites. This prints "token not present in the server
HTML — NOT judged either way" and does not fail on it.

It also self-skips when FleetCrown is unreachable: offline, every site would
look dead, and an instrument failure must not print what an outage prints.

Wired into fleet-register-check beside the shape and reality checks — it needs
the network, which CI does not have. Mutation-proven: pointing a register row at
a host its token does not allow makes it fail and name the site. Against the
real fleet: 23 activate, 2 unjudgeable, 0 dead.


Claude-Session: https://claude.ai/code/session_01G2LBioUzJP4oBL9LeH9qAe

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-11 05:00:47 -07:00
CatoandClaude Opus 5 b5143dac0b feat(register): check the register against reality, and judge it with its own commit (#594)
Two problems, one theme: a fact written in more than one place, and nothing
comparing the copies.

1. NOTHING ASKED WHETHER THE REGISTER STILL DESCRIBED THE BOX

check-deploy-ready.sh judges the register's SHAPE — field count, unique names,
unique ports — and judges it well. Every drift found on 2026-09-10 was
shape-valid and still wrong:

  - aoz-wohnen's `domains` named a host that only 308s. sync-infra.sh rewrites
    each vhost from that field with an unconditional `tee`, so the next sync
    would have deleted the site block that actually serves a live client.
  - revamp-info listed hirnli.orangecat.ch, which has its own hand-written
    vhost — a sync would have declared the host twice, failing `caddy validate`
    and aborting the reload for every OTHER app with it.
  - annushka's API held 4030 with no row while new-site.sh allocated
    max(registered)+1. Four sites away that morning; two by the evening.

None of those fail loudly. A redirect answers 200. An unregistered port is
invisible until something else binds it. A duplicate host does not break until
the next reload.

check-register-reality.sh asks the three questions the shape check cannot:
does every registered domain SERVE ITSELF; is any vhost on the box unbacked by
a row; is anything listening in 4000-4099 the register does not know.

Exceptions are decisions, not silences: register-reality.allow carries a reason
per line. Registering those would be actively WRONG — sync-infra would replace
each hand-written vhost with a plain proxy. Its first run found 4001-4004, which
apps.conf excludes in prose; prose is not machine-readable, so that same fact is
now in a form a script can hold.

2. THE DAILY CHECK READ THE REGISTER FROM origin/main AND THE JUDGE FROM THE TREE

fleet-register-check took great care to read apps.conf from the committed ref,
with a comment explaining that ~15 sessions share the working tree so it is a
scratchpad — then ran `bash scripts/ci/check-deploy-ready.sh` out of that same
scratchpad.

Caught today: ~/dev/fleetcrown sat on another session's branch whose
check-deploy-ready.sh predated #567, so an OLD judge called three perfectly good
rows of a NEW register "drift". The register and the code that judges it now
come from ONE commit (`git archive $REF scripts`), which is what the shim in
~/.local/bin already does one level up for this very reason.

3. A PIPEFAIL TRAP, MEASURED

`printf '%s\n' "$x" | grep -q ...` under `set -o pipefail` reports FAILURE on a
SUCCESSFUL match: grep -q exits at the first hit, the writer takes SIGPIPE, and
pipefail surfaces the writer's death as the pipeline's status. Measured before
believing it: 20/20 false failures on a large payload, 0/20 on a small one —
which is why it presents as a gate that flakes rather than one that is wrong.
Every such construct here is a here-string, which is not a pipeline and has
nothing to signal. (Raised by another session hitting it in
test-site-template.sh; verified independently here.)

Verified: register-reality 10 passed (new — curl and ssh stubbed on PATH, so
every case is offline and deterministic), port-alloc 6, client-ledger 13,
deploy-ready 20. Live run against the box is clean on all three questions.


Claude-Session: https://claude.ai/code/session_01HVudRzEmLqLHvGNqFSpJq6

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 16:21:55 -07:00
CatoandClaude Opus 5 5412b7d769 chore(register): record the four live client engagements as favours, baseline 4 -> 0 (#572)
George, 2026-09-10, asked directly: all four are favours, nobody pays anything
yet. So they are no longer '-'.

  kivvi       RevampIT   favour|0
  aoz-wohnen  AOZ        favour|0     (AOZ Begleitung)
  vitareba    clinic     favour|0
  sink        S-Ink      favour|0

`favour|0` is a RECORDED ANSWER, not a placeholder. It is the opposite of '-':
'-' means nobody knows, `favour|0` means unpaid on purpose. Until now those two
states were indistinguishable, which is exactly why "what am I maintaining for
free" had no answer — the honest answer was "all of it", and nothing said so.

The ledger baseline therefore goes 4 -> 0, and that is the point of writing it
down rather than just knowing it. The ratchet may never rise, so the NEXT live
client engagement cannot silently become the fifth favour: it fails CI unless it
arrives with terms, and new-site.sh already refuses `--status live` on client
work without --plan/--price before the repo or box exist.

  ✓ client ledger: all 4 live client engagement(s) have recorded terms

TESTS DECOUPLED FROM THE FLEET'S COMMERCIAL STATE

Banking this broke three of the gate's own cases, which had pinned "at baseline",
"a baseline of 4" and "all 4 live client engagement(s)". A test that fails when
the thing it guards SUCCEEDS is measuring the register's contents, not the gate —
and it would have broken again on the first real invoice.

The ratchet-direction cases now build their own two-row register and their own
baseline, so they test the DIRECTION regardless of what the fleet charges. The
committed-register case asserts a verdict was produced rather than a count. Added
a case pinning the distinction this commit relies on: `favour|0` must read as
settled, or recording the truth would look identical to never having asked.

Verified: client-ledger 13 passed (1 new), deploy-ready 20, uptime-sweep 66,
apply-schema 34.


Claude-Session: https://claude.ai/code/session_01HVudRzEmLqLHvGNqFSpJq6

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 13:14:10 -07:00
CatoandClaude Opus 5 fefdc64320 fix(register): name the host that actually serves, and stop calling a box path drift (#567)
Three defects, all the same shape: the register recorded an address that was
true once, and something downstream believed it.

1. aoz-wohnen's domain was a REDIRECT, not the canonical host

   The row said `aoz-wohnen.orangecat.ch`. That host only 301s to
   `aoz.orangecat.ch`, which is where AOZ Begleitung actually serves — the box's
   own vhost comment says so ("One product, one URL"), and George settled it
   months ago: "it should consistently be aoz. not wg, not aoz-wohnen."

   This was not cosmetic. sync-infra.sh rewrites /etc/caddy/apps.d/<name>.caddy
   from this field with an unconditional `tee`, so the next sync would have
   emitted a block for the redirect host only and DELETED the aoz.orangecat.ch
   site block — taking a live client's real URL off the air. Fixed by naming the
   canonical host.

2. revamp-info listed a domain that must NOT be generated

   `hirnli.orangecat.ch` is the same app, but it is served by a hand-maintained
   hirnli.caddy (the middleware reads the Host header for tenant chrome). Listing
   it here meant a sync would emit it a SECOND time inside revamp-info.caddy, and
   two site blocks for one address fails `caddy validate` — which sync-infra runs
   immediately before `systemctl reload`, so the reload aborts and every other
   app's pending vhost change silently fails with it.

3. A repo_path on the box was reported as drift, and blocked everyone

   dogfood-site-sep10-1201 was scaffolded directly onto the box, so its
   repo_path is /home/ubuntu/dev/... — a path that cannot exist on the laptop
   however healthy the fleet is. check-deploy-ready.sh called that drift and
   exited 1, failing pre-push for every laptop push, on a register row that was
   correct and a site serving 200. That is the category error this file's own
   header warns about: judging state that is not in front of you.

   Now split by DEV_ROOT: missing under DEV_ROOT is still drift and still fails;
   anywhere else is announced ("not checkable here — repo_path lives on another
   host") and does not fail.

   The CI/CD verdicts were also fixed to count what was INSPECTED, not every
   register row. With one app uninspected they said "all 16 deployed apps have
   it" — absence reading as success, one level up, in the number itself.

The register's `domains` field is provisioning input, not documentation: it must
name the host that serves, and must not name a host that must not be generated.
The register NAME (`aoz-wohnen`), the systemd unit, /opt path and `aoz_wohnen`
database keep the housing-era name on purpose — they are addresses nobody reads,
and renaming them is a migration. The product is AOZ Begleitung; its SSOT is the
app's own brand.ts. Comments now say all of this in the file itself.

Verified: deploy-ready gate 20 passed (2 new cases — a box-side path is
announced and does not fail; the verdict counts only inspected apps),
client-ledger 12, uptime-sweep 66, apply-schema 34.

NOT done here, needs a box change: aoz-wohnen.orangecat.ch's 301 still lives
INSIDE the generated vhost, so a sync drops it (bookmarks break, canonical
survives). It belongs in its own aoz-legacy-redirect.caddy, the way
sink-legacy-redirect.caddy already does it.


Claude-Session: https://claude.ai/code/session_01HVudRzEmLqLHvGNqFSpJq6

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 12:18:42 -07:00
CatoandClaude Opus 5 95e85a511d feat(ci): ratchet the client ledger — no new live client work without terms (#534)
apps.conf carries plan/price columns that were added before the numbers
existed, on the explicit reasoning that "the gaps are the point — right now
'what am I owed this month' and 'what am I maintaining for free' are
unanswerable, which is why these columns exist before the numbers do".

That reasoning was right and nothing acted on it. All 15 rows still read
plan=- price=-, including four LIVE client engagements: kivvi (RevampIT),
aoz-wohnen (AOZ), vitareba (clinic) and sink (S-Ink). The columns made the
gap recordable; they did not make it visible, nothing ever read them, and
months of '-' looked exactly like having no clients. This is the reader.

  check-client-ledger.sh — counts LIVE client-app/client-site rows whose
  plan or price is '-'. Ratcheted at 4: may fall, never rise. Deliberately
  narrow — a product owes nobody an invoice, and a prospect with no price is
  honest, so both are excluded and the near-misses are printed rather than
  silently dropped.

  new-site.sh — the same rule, enforced earlier: --status live on client
  work now requires --plan/--price and refuses at argument validation,
  before the repo, the box and the deploy exist. CI would reject the row
  anyway, but by then the site is created, pushed and serving.

Not wired into the daily fleet-register-check on purpose: a recurring
message about a number that does not change is how alerts get muted. It
fires at the one moment the answer is cheap — the PR that puts a client
app live.

Proved by mutation, both directions, on copies (12 cases): a regression
goes red, an improvement goes green and prints how to bank it, products
are never counted, and a register with nothing to announce still reaches
its verdict. The last one exists because the two trailing announcements
are `[ -n "$x" ] && echo`, a shape that can end a `set -e` script early on
exactly the register that has nothing wrong with it.

Also fixes scripts/hetzner/verify.sh, which read 6 variables from a
12-field line, so $db silently carried "-|S-Ink|client-site|live|-|-|-" on
every row — harmless only while that loop ignores $db, and the same trap
app_lookup() in lib.sh already documents having been bitten by.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-08 11:27:13 -07:00
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>
2026-09-04 10:35:27 +00:00
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>
2026-09-04 00:55:37 +00:00
GandClaude Opus 5 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>
2026-08-31 09:23:30 +00:00
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>
2026-08-29 10:58:08 +00:00
GandClaude Opus 5 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>
2026-08-29 10:00:57 +02:00
GandClaude Opus 5 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>
2026-08-29 09:13:04 +02:00
GandClaude Opus 5 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>
2026-08-28 20:09:20 +02:00
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>
2026-08-28 16:21:27 +00:00
GandClaude Opus 5 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>
2026-08-28 18:04:18 +02:00
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>
2026-08-28 11:41:35 +00:00
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>
2026-08-28 11:45:25 +02:00
GandClaude Opus 5 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>
2026-08-28 09:06:59 +00:00
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>
2026-08-28 10:56:09 +02:00
GandClaude Opus 5 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>
2026-08-28 08:50:55 +00:00
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>
2026-08-28 05:04:32 +00:00
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>
2026-08-27 17:07:52 +00:00
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>
2026-08-16 19:02:34 +00:00
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>
2026-08-15 11:58:29 +00:00
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 fe9395b950 — the commit this deploy shipped". Ten
minutes later /opt/fleetcrown/app was overwritten with a tree ~25
commits old, and for the next ten minutes production served the
previous day's code, including a health endpoint too old to report
which commit it was running. The next unrelated deploy quietly put main
back.

check-deploy-ref.sh was supposed to have ended this class, and it
cannot: it asks "are you on main?", which every commit that ever landed
on main answers yes to, forever. A checkout sitting on last week's main
walks straight through it. The build-ref marker added in #279 makes the
damage visible after the fact, which is how this was found, but nothing
made it impossible.

So gate on the direction of the move instead of the name of the branch:
the commit currently live must be an ANCESTOR of the commit being
shipped, i.e. a deploy may only ever add history. An older commit, or a
sideways jump onto unrelated history, is refused with the two subjects
printed and the fix spelled out. ALLOW_ROLLBACK=1 is the override, so a
deliberate rollback is one word, not a workaround.

Undecidable cases warn and allow on purpose — no marker on the box, a
SHA this checkout has not fetched. This gate must never be the reason a
box that is already broken cannot be repaired.

The gate is its own script rather than a branch inside deploy-hetzner.sh
so it can be tested without deploying anything: ten cases over throwaway
git repos, covering the exact regression, the fast-forward it must not
slow down, the override, and every undecidable path.

Co-authored-by: t <t@t.t>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 10:16:53 +00:00
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>
2026-08-14 03:30:31 +02:00
G 26a8b397f0 fix(ci): a red base must not trap the PR that repairs it (#195) 2026-08-07 10:25:05 +00:00
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>
2026-08-07 09:30:09 +00:00
G 3048995eb2 fix(ci): stop skipping conflicts, and keep branches current (#191) 2026-08-07 07:17:02 +00:00
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>
2026-08-06 10:19:16 +00:00
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>
2026-08-05 17:58:01 +00:00
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>
2026-08-05 19:16:41 +02:00