Commit Graph
17 Commits
Author SHA1 Message Date
CatoandClaude Opus 5 58174f45ef fix(hardcoded): give every duplicated constant one home (#758)
* fix(hardcoded): give every duplicated constant one home

A sweep of all 44 repos' default branches for literals that duplicate an
existing source of truth. Loki's share, in four groups.

WRONG, and live on the public footer. src/config/fleet-site-copy.ts still
called the Zürich clinic "VitaReBa", a name retired on 2026-09-10 — its own
title says "Vita · Metabolische Psychiatrie & Systemische Longevity". The
generated fleet-sites.ts carried it onto loki.orangecat.ch, where it was
serving until this commit. Fixed at the copy file, which is the one place that
owns a site's own words, and the footer regenerated from it.

WOULD HAVE WRITTEN STALE DATA. scripts/seed-fleet-site-urls.ts kept a hand-typed
slug → URL map "read 2026-08-06". Two of its fifteen entries pointed at hosts
retired since (aoz-wohnen.orangecat.ch, revampit.orangecat.ch), so running it
would have filled empty live_url columns with addresses that only 308. It now
derives the map from apps.conf — the same register the footer is generated from
— which also fixes the six live sites the hand list never had. Verified: 19
sites, zero retired hosts.

THE BOX ADDRESS, in seven places. scripts/hetzner/_box-env.sh has been the SSOT
for it all along and sixteen scripts source it; four did not, and the shared
deploy workflow — reused by ~20 repos — had the IP inline twice, so moving the
box meant twenty edits. The workflow now reads the org-level Actions variable
HETZNER_IP and fails loudly if it is unset, rather than ssh-ing to an empty
string. loki's own deploy.yml had `vars.HETZNER_IP || '<literal>'`, a fallback
that guaranteed the variable was never needed and so never noticed if wrong.

ONE LAPTOP, baked into shipped code. site-cd-local.ts listed /home/g/.ssh and
/home/ubuntu/.ssh as deploy-key candidates beside os.homedir() — which already
IS those paths, since loki-app runs as `ubuntu` and a laptop runs as its owner;
both spelled one homedir for one named person. install-push-deploy.sh wired
hooks to /home/g/dev/loki, link-prod-runtime.ts to /home/g/dev/bitbaum, and
scripts/fleet printed an install line only true on one machine: all now DEV_ROOT
or the script's own resolved path.

The two scripts in scripts/local are INSTALLED BY COPY into ~/.local/bin and run
there by systemd timers, so they resolve _box-env.sh beside the real file first,
then under DEV_ROOT, and exit loudly if neither exists — a security check that
cannot find its target must not look like one that found nothing.

Deliberately unchanged: the slug alias map (the mechanism that makes a rename
safe), an executed migration's data row, the retired-handle detector's own
handle list, and test fixtures reproducing past incidents.

Verified: fleet-sites-derived in sync (14 sites), bash -n on every edited
script, and the branch's only remaining literals are in scripts/test fixtures.

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

* fix(push-deploy): the generated hook must not bake one laptop's path

install-push-deploy.sh writes the hook body through an UNQUOTED heredoc, so
$HERE expanded at generation time and the absolute path of one machine was
committed into every repo's .husky/pre-push. kivvi and botsmann both carried it;
anyone cloning those repos got a hook pointing into a stranger's home directory,
and re-running the installer would have put it straight back after those repos
were cleaned.

The hook now resolves ${DEV_ROOT:-$HOME/dev}/loki/... at RUN time, so the
generator stops re-introducing what the cleanup just removed.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 02:03:58 -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
cf3d9ed52e fix(deploy): hand the VAPID public key to the build, so push can work at all (#490)
#488 stopped the hydration failure by rendering nothing until past the server
render. It could not restore the feature: the browser still received an empty
NEXT_PUBLIC_VAPID_PUBLIC_KEY, so subscribe() had no application server key and
push notifications were dead in production regardless.

The missing half was never in the code. deploy.yml's build step declared no
`env:` at all, so every NEXT_PUBLIC_* was inlined empty while the box ran with
this one set. Fixed by creating the repo variable and passing it to the build.

A variable, not a secret: the value is compiled into the client bundle and
handed to every browser that subscribes. Hiding it would be theatre, and a
secret's log masking would only obscure the verification.

Verified before trusting the value, because a wrong key fails silently at send
time and this one gets baked into every future bundle:

  - decodes to 65 bytes, first byte 0x04 — a valid uncompressed P-256 point
  - the public key is the MATE of VAPID_PRIVATE_KEY on the box (derived the
    point from the private scalar and compared; no secret printed)
  - VAPID_SUBJECT is a valid mailto:/https: scheme

One trap on the way: the box stores the value quote-wrapped (len 89 = 87 + 2).
dotenv strips those when the server loads them, so runtime was fine — but
copying it verbatim into the variable would have inlined literal quotes and
produced a broken key that looks correct in every listing.

The gate's KNOWN_GAPS entry is deleted rather than edited, so removing either
the variable or the env: line now fails the check instead of silently killing
push again. Mutation-proven both ways: line removed -> 4 passed, 1 failed
naming the var; restored -> 5 passed, 0 failed.


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

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-05 08:27:25 +00: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
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
4d1c9f1fe7 chore: migrate the fleet to the bitbaum org (#415)
* chore(ci): GitHub owner catomean -> bitbaum

* docs(hetzner): update _box-env.sh comments for the completed org migration

The GH_OWNER/WORKFLOW_OWNER comments described a future state (repos moving
to bitbaum while fleetcrown stayed personal) that sweep-gh-owner.sh just
made true, then obsolete: fleetcrown itself is in bitbaum now too. Comments
describing a plan that already happened are worse than no comment — they
send the next reader looking for a divergence that isn't there.

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

* chore(desktop): release 0.8.15 — the org-migration owner literals

Same shape as 0.8.14: desktop/ carries two literal owner references (issue
link, updater feed owner) that a fleet-wide rename touches, and
desktop-release-drift.ts correctly refuses to let that ship without a
version bump — a repo whose desktop app silently points at a dead update
feed is worse than one that fails the gate.

This should be the last time it's an account name: the org is the stable
home from here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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 07:45:50 +02: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
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
dependabot[bot] 54230ad85f chore(deps): bump actions/cache from 4 to 6 (#295)
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 6.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-15 12:17:59 +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
ab0dfd0b2e fix(cd): stop creating Deploy runs that can only skip, and write the rule down (#172)
Two grafts from #170, which found the same root cause independently while
#171 was in flight.

`branches: [main]` on the workflow_run trigger: a PR's CI is not a ship
signal, so filter it at the trigger instead of creating a Deploy run that
exists only to skip. Those skipped runs are what made the outage hard to
read — the deploy history looked busy while nothing shipped.

The CLAUDE.md rule is the point, though. The GITHUB_TOKEN no-cascade rule
biting one level deeper is not something the next person will re-derive from
a green CI badge and a stale site, and this class already cost two sessions
independently. Also records that "merged" is not "live" — the check that
would have caught it in seconds.

Credit to #170 for both.

Co-authored-by: test <test@test>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-05 18:07:05 +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
a4a57b1da1 fix(deploy): install bridge subpackage deps in CI before building it (#115)
deploy.yml ran `npm ci` at the root only, so bridge/node_modules was empty and
`npm --prefix bridge run build` (tsc) failed with 'Cannot find module pg'. The
app build passed and CI verify passed — this gap only bit the isolated CI deploy
runner (local builds already had bridge/node_modules). Add `npm --prefix bridge ci`.

Co-authored-by: test <test@test>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-28 10:57:09 +02:00
dependabot[bot] ab51e39670 chore(deps): bump actions/setup-node from 6 to 7 (#81)
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 6 to 7.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-24 00:50:27 +02:00
dependabot[bot] 6e13b4b9fa chore(deps): bump actions/checkout from 6 to 7 (#79)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-24 00:50:21 +02:00
Mao NakamotoandClaude Opus 4.8 0dd31f19f5 chore(devops): gate deploy.yml behind DEPLOY_VIA_CI switch
Make the CI-deploy workflow safe to merge to main while its prerequisites
(HETZNER_SSH_KEY secret, local hook disabled) aren't in place yet: the deploy
job now also requires repo variable DEPLOY_VIA_CI == 'true'. Unset → dormant, so
merging changes nothing until you flip the switch. Apply guide updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 20:49:36 +02:00
Mao NakamotoandClaude Opus 4.8 cc4c58fcbf chore(devops): prepare blast-radius containment (#1) + CI-gated deploy (#2)
Both prepared, NOT applied. Inert until you act — see
docs/development/devops-prep-apply-guide.md.

#1 — box-runner blast radius:
- scripts/hetzner/harden-box-runner.sh installs a systemd drop-in that makes the
  co-tenant /opt/<app> dirs, /opt/backups, and /home/ubuntu/.ssh kernel-
  inaccessible to the runner AND every agent PTY it spawns. Keeps User=ubuntu
  (the claude CLI lives in /home/ubuntu, so no user migration needed). Safe: the
  runner only touches its own dir + fresh clones under /home/ubuntu/dev, never a
  co-tenant /opt (verified in box-workspace.ts). --dry-run / --revert supported.
- install-box-runner.sh bakes the same InaccessiblePaths into the unit for fresh
  installs.

#2 — CI-gated deploy:
- .github/workflows/deploy.yml runs ONLY after CI succeeds on main, builds
  (schema-only Postgres service), and ships via deploy-hetzner.sh --no-build so
  the flock/rollback/verify logic carries over. A red CI → no deploy. Needs a
  HETZNER_SSH_KEY secret; the local push-deploy hook must be disabled to avoid
  double deploys (documented).
- scripts/setup-branch-protection.sh (opt-in, separate) requires the CI check
  before merge — rejects direct pushes to main, so only for a PR-based flow.

bash -n + deploy.yml structural checks clean; drop-in dry-run verified.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-07 20:49:36 +02:00