mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 11:48:24 +01:00
feat/parallel-implement
38
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c63ae4ef61 |
fix(register): Skif has a database, and it is our product (#889)
skif's row said db=- and kind=client-site. db=- makes every deploy skip the schema step, so drizzle/0000_init.sql would never be applied: the signed-in pages would serve against a database with no tables (the exact botsmann shape the format note records). The database now exists on the box: role and db `skif`, pg_hba rules inserted above the reject block, public schema owned by the role, verified by connecting and creating a table. kind=client-site was wrong on its face: Skif is bitbaum's own product, owner=bitbaum, federating to OrangeCat. And bitbaum has no clients. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
13e433c4dd |
chore(register): add skif (4027) (#878)
Co-authored-by: Cato <catomean@users.noreply.github.com> |
||
|
|
171b00cf93 | fix: register dedicated Substrata database (#738) | ||
|
|
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>
|
||
|
|
2d49a2d1c2 |
fix(register): heidi is served, and the register said it was a prospect (#727)
heidi.orangecat.ch answers 200 and has since it launched. Its apps.conf row said `prospect`, and because the studio site derives from this register, that word was rendered on heidi's public page. `live` in this column means the process is SERVED — a provisioning fact, like `client-app` two columns over. It is not a release claim, and nothing in this fleet makes one: everything is beta, OrangeCat included (fleet AGENTS.md, "Names agents must share"). So this row now reads `live` and bitbaum renders "Beta — running, not released", which is both true statements at once. src/config/fleet-sites.ts is derived from this file and is regenerated here rather than hand-edited — scripts/test/fleet-sites-derived.ts caught the drift before CI did, which is the entire point of having the pair. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
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> |
||
|
|
a3f6b6805b |
chore(apps): heidi gets a database (#682)
heidi's row read `db=-`, meaning the deploy's schema step skipped it. It is about to ship drizzle migrations for study groups, and `apply-schema.sh` resolves the target database from THIS column rather than from the app's DATABASE_URL — so without this line the migrations would be silently skipped, exactly as botsmann and printcraft shipped green for months while the pipeline never saw a file. The database, role, pg_hba rules and credentials are provisioned on the box. Provisioning set default privileges FOR ROLE postgres in heidi's public schema, because the schema step runs as the superuser: a table a migration creates is owned by `postgres`, and the app role is granted nothing on a table it does not own. That is the failure vitareba's schema-usable health check exists to catch, and on that database it was repaired by hand afterwards — `pg_default_acl` there is still empty. Setting it before the first table exists is cheaper than granting after every one. The rest of the row was checked at the same time, per the lesson from the hirnli/evig mix-up: port 4025 matches launch.sh, repo_path, domains, owner and app_dir are all current. Only `db` was wrong. Claude-Session: https://claude.ai/code/session_01FzYBD3sZroCAYeRgTYrpfT Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
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. |
||
|
|
e61615c5b7 |
Revert(register): sbb-fundbuero — the SBB name is the pitch, not drift (#649)
Reverts the rename I made earlier today. The demo is being pitched TO SBB, so being named after the prospect is the artefact, not drift. The repo's own README called the name "an open question, not a settled decision"; I settled it, and that was not mine to do. Row, domain, repo_path and the cron unit are back. Port 4016 never moved. lib/tenant.ts is untouched: Nordbahn remains the neutral default tenant, SBB the opt-in livery with noindex — the design that makes pitching it safe. Claude-Session: https://claude.ai/code/session_01HVudRzEmLqLHvGNqFSpJq6 Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
1aa90a64f1 |
chore(register): sbb-fundbuero -> nordbahn-fundbuero on nordbahn.orangecat.ch (#642)
The repo and the public host both carried the name of a real transport company this demo has no connection to. The site has always titled itself Nordbahn Fundbüro, on an operator invented on purpose, and the repo's own Naming section said the working name "is probably the wrong one". The addresses now say what the product says. name sbb-fundbuero -> nordbahn-fundbuero domain sbbfundbuero.orangecat.ch-> nordbahn.orangecat.ch repo_path ~/dev/sbb-fundbuero -> ~/dev/nordbahn-fundbuero (moved) cron unit appcron-sbb-fundbuero-* -> appcron-nordbahn-fundbuero-purge Port 4016 is kept: it is an address with no name in it, and moving it would mean a second migration for nothing. nordbahn-fundbuero#74 already landed the app side (deploy `app:` input, package.json, its own fallback URLs), so this row is what lets the new app be provisioned. The old unit keeps serving until the new one is verified; the old host then becomes a permanent redirect in its own vhost file, which sync-infra cannot regenerate over — the pattern aoz and sink already use. Claude-Session: https://claude.ai/code/session_01HVudRzEmLqLHvGNqFSpJq6 Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
abb00b911c |
feat(register): one register for every project, joined from the owners of each fact (#610)
* feat(register): one register for every project, joined from the owners of each fact
"Which projects do we have, and which one has a site, a FleetCrown profile, an
OrangeCat profile, a Solon organisation?" had no answer. It had seven: apps.conf,
this database, OrangeCat's, Solon's, bitbaum's companies.json, the public footer's
config, and 24 markdown dossiers. Each is right about its own facts and wrong
about the others; joined by hand they disagreed on 5 names, the footer named a
host that had been renamed and missed 12 live ones, the showcase listed hosts
the hosting register did not know, and Caddy served 38 vhosts of which the
register knew 23.
This does not add an eighth list. It adds the JOIN, computed from the owners:
src/lib/register/apps-conf.ts the one parser for apps.conf (hosting SSOT)
src/lib/register/build.ts pure join keyed on the canonical slug
src/lib/register/solon.ts Solon membership via its public org endpoint,
reported UNCHECKED (not "none") when unreachable
GET /api/fleet/register public JSON — consumers derive, never copy
/fleet the same join, rendered
The join key is the repository name. Names have drifted into several spellings
(aoz-housing/aoz-wohnen, datacat/datacat-web, s-ink/sink, sbb-fundbuero/
sbb-lost-found, wild-spirit/annushka); `canonicalSlug` folds every alias that
has actually bitten, and each is pinned by a test. The durable fix is three
nullable columns on user_projects — slug, hosted_app, solon_org_slug — with
scripts/backfill-project-registry.ts to assign them once (drizzle/0065; the
applier is filename-based, matching how 0064 was shipped).
The footer stops being a list anyone edits. src/config/fleet-sites.ts is now
GENERATED from apps.conf by scripts/generate-fleet-sites.ts (the footer is a
client component and cannot read the register at render, and Atlas needs static
anchors), with editorial copy kept in fleet-site-copy.ts keyed by slug. A gate,
scripts/test/fleet-sites-derived.ts, fails the moment the file drifts.
apps.conf itself gets two corrections found by comparing it with the box:
evig (live on 4004 from the main Caddyfile, never registered) and
hirnli.orangecat.ch, which revamp-info's app serves.
Not done here, on purpose: the bitbaum showcase still renders its own
companies.json — it moves to the API once this is live; annushka and bitbaum are
static Caddy roots with no app process and do not fit the register's app shape.
Verified: 145/145 unit files (24 new assertions in fleet-register, drift gate
green), tsc clean, register gates (port-alloc, register-reality, client-ledger)
green with the new rows.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Z7YRpgsEtNjRqr1usHMQY
* fix(register): evig row names its host database, revampit
The deploy-ready gate found drizzle migrations in the evig checkout and a
db of '-', which is the shape that let botsmann serve PGRST205 for months.
evig is not deployed by deploy.sh at all — its own workflow applies its
migrations — but the register should still say which database that is.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Z7YRpgsEtNjRqr1usHMQY
* fix(watchdog): evig left the hand-list the day it entered the register
The hand-list is built to die one row at a time: the test that failed is
the one that forces a duplicate out the moment apps.conf registers it.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Z7YRpgsEtNjRqr1usHMQY
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
|
||
|
|
7e38ca5e0e |
chore(register): add kaffeeklappe-sep11 (4032) (#606)
Co-authored-by: Cato <catomean@users.noreply.github.com> |
||
|
|
b06fde7d85 |
chore(register): factory-sep11-0110 on 4031 — second hosted creation, from the dedicated worktree (#603)
Created by the hosted runner from /home/ubuntu/dev/fleetcrown-factory (a git worktree at origin/main, not the standalone output). This time the repo carries .github/workflows and .nvmrc, its CI passed on push, and the register row persisted in the tree. Its own PR because #602 was merged by the sweep between its first and second commit, so the second never landed. Port 4031, not 4030: the allocator saw 4029 live but unregistered and stepped past it. Claude-Session: https://claude.ai/code/session_018Z7YRpgsEtNjRqr1usHMQY Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
690d47a0aa |
chore(register): factory-sep11-0040 on 4029 — created by the hosted runner, then lost by a deploy (#602)
The first site the fleet created without a human at a terminal. Dispatched as a `hosted_new_site` command (#598), claimed by the hosted runner 0.75 s later, executed in 37 s with ok:true: repo bitbaum/factory-sep11-0040, Caddy vhost, release 20260911-003309-c9d257c, unit factory-sep11-0040-app active, and the promoted day-zero page served on :4029. The register row it appended did not survive. The runner was pointed at /opt/fleetcrown/app/scripts/hetzner/new-site.sh — Next's standalone output, which deploy-hetzner.sh rsyncs with --delete on every ship. The vhost was written at 00:32:53; app/ was re-synced at 00:34:12; the row was gone. A site running on the box with no register entry is the camille failure again, eight days of it compressed into eighty seconds. This restores the row by hand and records what the runner should have been able to keep. Also ships scripts/new-site-dispatch.ts to the runner: deploy-hetzner.sh syncs an explicit list of scripts into /opt/fleetcrown/runner and the dispatch CLI was not on it, so the only way to enqueue a site from the box was to copy the file there by hand — which is how this one was enqueued. Gates: test-port-alloc (6), test-register-reality (10), check-client-ledger (demo kind, no terms owed) all pass with the row. Claude-Session: https://claude.ai/code/session_018Z7YRpgsEtNjRqr1usHMQY Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
b9c3ecc1f9 |
fix(register): sbb-fundbuero's app is at the repo root, not in frontend/ (#590)
The deploy failed with:
resolved sbb-fundbuero → port 4016, dir 'frontend'
scp: open local ".../sbb-fundbuero/frontend/.env.selfhost.local":
No such file or directory
The app collapsed from four services plus a frontend/ into one Next
application at the repository root (bitbaum/sbb-fundbuero#63), so there is no
frontend/ directory any more. This register row still pointed at it, and it is
the row deploy.sh resolves paths from.
`.` is what most apps here already use — aoz-wohnen, petvity, revamp-info,
solon, vitareba and six others.
check-deploy-ready.sh green: 18 apps, CI and CD present for all.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
36ba1dd26c |
chore(register): add velokiosk-sep10 (4028) (#588)
Co-authored-by: Cato <catomean@users.noreply.github.com> |
||
|
|
9d7c77e241 |
chore(register): coldstart-sep10-2339 on 4027 (#586)
Dogfood after #585: repo + deploy.yml exist; register hostname/port so selfhost-deploy and sync-infra can find the app. Port 4027 (4024 is diplodoctor). |
||
|
|
71762e4649 |
fix(cold-start): register lands deploy.yml; scaffold installs/builds/serves (#585)
* fix(register): a site registered from the box gets its shim, its port, and its builder Walked the cold start on production after #569 (velokiosk-sep10). The repo was seeded; then four defects on the register-and-run path: - The OAuth grant had no workflow scope, so GitHub refused to write .github/workflows/deploy.yml and register-site.sh carried on saying the remote may already have it. The grant now requests workflow; the script falls back to the host's own gh login for the shim and fails when the file is not on the remote. - box() named no SSH identity; ubuntu's only key is the CI deploy key, so the box refused itself. box() passes DEPLOY_KEY_PATH when readable. - The durable register was behind main and handed out a port main had already given away. Ports and conflicts are read from both registers, the durable checkout is fast-forwarded when all its rows are on main, and every new row goes to main as a PR. - A dirPath under the box clone root was routed to the operator's laptop because it was present; that runner cannot clone on demand and reported "inject did not stick". projectChannelLock returns cloud for box-rooted workspaces. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0118cLNxoB3dt2w74vU1PH6w * fix(scaffold): a new site that actually installs, builds and serves Diplodoctor was scaffolded on 2026-09-10, provisioned completely — repo, systemd unit, Caddy vhost, register entry — and served 502. Its session diagnosed it and fixed it IN THE DIPLODOCTOR REPOSITORY. The template was left exactly as it was, so the next site would have rediscovered the same three faults from scratch. This is that fix moved to where it belongs. The template was never internally consistent about its package manager. It shipped no lockfile at all, yet its CI ran `npm ci`, which REQUIRES package-lock.json — so a freshly scaffolded site's CI could not pass on its first commit, or any commit. Meanwhile the box deploys with `pnpm run build`. Two managers, one repo, and the half that ran in production was not the half CI described. Everything here converges on pnpm, which is what actually ships. pnpm-workspace.yaml NEW. `allowBuilds: sharp, unrs-resolver`. pnpm 11 refuses to run a dependency's build script unless it is approved and EXITS NON-ZERO when one is not, so without this a fresh clone cannot install and the deploy dies before the build. It must not go in package.json's `pnpm` field: pnpm 11 no longer reads that field and ignores it with a warning, which makes the setting look present while doing nothing. .nvmrc 20 -> 22. pnpm 11 imports node:sqlite, absent before Node 22.13. Harmless while CI used npm; fatal the moment it uses pnpm. ci.yml npm -> pnpm throughout, and the Next cache key now hashes pnpm-lock.yaml instead of package-lock.json — a file that never existed here, and hashFiles() returns an empty string for a missing path, so the key was constant and the cache could never invalidate. package.json `verify` uses pnpm; `packageManager` pins pnpm@11.25.0 so a stray `npm i` cannot mint a second lockfile. Two things this also fixes that were not in diplodoctor's repair. **The scaffold now resolves a lockfile into the first commit.** Without one the repository is born unbuildable in two places at once: CI's `pnpm install --frozen-lockfile` refuses to invent a lockfile, and the box resolves versions afresh on every release, so the site that was verified is not the site that ships. `--lockfile-only` keeps this to a few seconds and unpacks no node_modules. **next 16.2.4 -> 16.3.4.** The template was minting every new site with a CRITICAL unauthenticated RCE — GHSA-2xp9-vwfh-vxw4, the Next image-optimization hole, patched at >=16.3.3. orangecat was patched for this today; the scaffold would have kept issuing fresh vulnerable sites afterwards. **And the port race, which nearly shipped an hour ago.** Ports are allocated from `apps.conf` in a LOCAL checkout, and this studio runs five to ten agent sessions at once, each in its own worktree. A stale copy reports a stale highest port. A dry run in one such checkout offered 4024 for a new site while origin already had diplodoctor on 4024 and heidi on 4025 — two sites, one port, caught by hand one command before it would have shipped. The script now fetches and REFUSES when its register differs from origin/main, naming the pull that fixes it, rather than guessing a number another session already took. Verified: `bash -n` clean; a dry run against an up-to-date register allocates 4026 and the staleness guard passes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Z7YRpgsEtNjRqr1usHMQY * chore(register): causius on 4026 — the first site the fixed scaffold built causius.orangecat.ch is live: systemd active, HTTP 200, its own certificate, on the first deploy. Diplodoctor needed two follow-up pull requests to reach that same state yesterday; this one needed none, because the template was repaired before it was used rather than after. Registered as `product` / `validating` — ours, and not yet claiming to be a live client engagement, so the client-ledger gate is satisfied without inventing terms for something that has no customer. Port 4026 came from a register that the new staleness guard had just verified against origin. The stale local copy this was first attempted from offered 4024, which diplodoctor already holds. Deliberately NOT bought: causius.com and causius.ch are unregistered and stay that way for now, by George's call. The site therefore lives at its free orangecat.ch address, which is exactly the ladder /domains sells — start free, move to your own domain later, keep every link alive. Dogfooding it means the first customer of that offer is us. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Z7YRpgsEtNjRqr1usHMQY * fix(scaffold): site-template CI floor test expects pnpm The scaffold now installs with `pnpm install --frozen-lockfile` (#583 onto main). The floor test still demanded `npm ci`, so verify would fail every run after the template switch even though the template itself is correct. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
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> |
||
|
|
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>
|
||
|
|
cc135862c0 |
chore(register): add heidi (4025) and the missing diplodoctor row (4024) (#566)
heidi.orangecat.ch is provisioned on the box (unit, vhost, monitoring) and needs this row on main before selfhost-deploy.yml can resolve it. diplodoctor was provisioned today and is live on 4024 with a Caddy vhost, but never got its apps.conf row — so the allocator's "max port + 1" would have handed heidi the same port. Registering it is what made 4025 correct. Claude-Session: https://claude.ai/code/session_01KXoMmDTW3jq6xb1JC1Yh4e Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
43d9296ed1 |
chore(register): add dogfood-site-sep10-1201 to apps.conf (#553)
Registered on the studio box after #552 so Make it happen CD dogfood has a durable apps.conf row (port 4023, orangecat.ch host). Co-authored-by: Cato <catomean@users.noreply.github.com> |
||
|
|
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> |
||
|
|
ea4af6174d |
chore(register): rename sbb-lost-found to sbb-fundbuero (#529)
The app is now "SBB Fundbüro" and moves to sbbfundbuero.orangecat.ch. This repo owns the register that provisioning reads, so the rename has to land here before the app's next deploy: sync-infra.sh generates the unit and the Caddy vhost from apps.conf, and deploy.sh resolves /opt/<name> from the same line. A rename in the app repo alone would deploy to a directory the Caddy vhost does not serve. Changed only what is operationally load-bearing plus the docs table: apps.conf (name, domain, repo path), the public site list, the URL seed, the runner hardening InaccessiblePaths, and the port/domain table. Historical incident comments that mention sbb-lost-found are left alone — they record what happened under that name, and rewriting them would make them false. Claude-Session: https://claude.ai/code/session_01NfPenJdSXVtN8SQ9wHG4Hp Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
34f6d27ea6 |
fix(ops): the box register follows revampit to evig, and conformance notices a unit that lost its guards (#475)
revampit was renamed to evig on the box on 2026-09-02 (/opt/revampit -> /opt/evig,
revampit-app -> evig-app). The app repo caught up. This repo — which holds the
box register and the tooling that watches it — did not, and two of the stale
references were load-bearing:
- verify.sh ran `systemctl is-active revampit-app` for a unit that no longer
exists (`inactive`, exit 4), so the full-fleet sweep was permanently FAIL
and never once checked the app that replaced it. A sweep that always fails
is a sweep nobody reads.
- uptime-sweep.sh watched revampit.orangecat.ch, which is now a Caddy `redir`
block — a static 308 the sweep counts as up. That entry answers "is Caddy
alive", not "is the app alive", and would have reported up through an evig
outage. Pointed at evig.orangecat.ch, it probes /api/health for real.
The rest is register hygiene with no live consequence: the push-deploy hook
installed a command at /home/g/dev/revampit/scripts/selfhost-deploy-revampit.sh
(neither path exists any more), and three runner sandboxes listed a
/opt/revampit that is gone while omitting the /opt/evig that replaced it.
The automation, because a fix that only repairs today is worth 1x:
runtime-conformance-audit.sh now asks whether an enabled *-app.service still
has its guardrails — a memory cap and an OnFailure. A rename moves the unit
file; it does NOT move the .service.d/ drop-ins beside it. evig-app ran for two
days with MemoryMax=infinity on a shared box and no failure alert because its
drop-ins were still in the old unit's directory, and nothing noticed, because
these drop-ins are box state that no repo describes. Every other app unit on
the box carries both, which is what makes an exception a finding rather than a
preference. The audit already runs every 6h and alerts per finding, so this
class now pages instead of waiting to be stumbled over.
Evidence, on the real box:
# after restoring evig-app's drop-ins by hand
$ sudo bash runtime-conformance-audit.sh
checked 26 app dirs on node 24.20.0
findings=0 unreadable=0
# negative control: move the drop-ins away again
FINDING|evig|unit has no memory cap (MemoryMax=infinity) on a shared box
FINDING|evig|unit has no OnFailure= — it can die without alerting anyone
$ bash scripts/hetzner/verify.sh
OK evig systemd=active local=200 public=200
... 23 checks, exit 0
`npm run verify` green: tsc clean, eslint 0 errors / 3 warnings, 130/130 unit
test files, 150 home tests, 66 uptime-sweep tests, all ops suites.
Claude-Session: https://claude.ai/code/session_01LmyE2aLaXKB2V7WA3XQprm
Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
34669faf19 |
fix(apps.conf): hirnli has its own database, and is a product not a client site (#464)
The deploy of hirnli's identity migration ran against evig's `revampit`
database and aborted:
NOTICE: relation "users" already exists, skipping <- evig's next-auth users
ERROR: column "user_id" referenced in foreign key constraint does not exist
because evig's `sessions` uses `userId`, not `user_id`. It rolled back and
shipped nothing, so no damage — but the schema step had pointed one app's
migrations at another app's production database, which is the failure this
file's own header warns about for the supabase apps.
Corrects four fields on the revamp-info row:
db revampit -> hirnli Hirnli was split into its own database on
2026-09-02. It is a platform holding many
customers' fundraising research and has no
business inside one customer's app DB —
and it could not create `users` there
anyway, that name is evig's.
domains + hirnli.orangecat.ch The platform host, live since 2026-09-02.
repo_path revamp-info -> hirnli The repo was renamed; this pointed nowhere.
owner/kind RevampIT/client-site -> bitbaum/product
Hirnli is George's platform. Revamp-IT and
evig are CUSTOMERS of it, the first two of
many. Billing a platform to one of its own
tenants is exactly the confusion the owner
column exists to prevent.
`name` deliberately unchanged: it keys /opt/revamp-info and the
revamp-info-app systemd unit, so renaming it is a box-side cutover of its own
(as the evig rename was), not a config edit.
Claude-Session: https://claude.ai/code/session_01HVwg8DKHQktxJuHeLM3xpG
Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
a58961aac8 |
fix(ci): deploy-ready gate now checks CD, not just CI — and fixes a live drift it just found (#419)
Two real gaps surfaced by a fleet-wide CI/CD audit, both now closed: 1. This gate only ever verified CI existence. camille-boulangerie had ci.yml (verify ran green on every push) and no deploy.yml at all — a green push there has never once reached the box. The gate's own stated purpose is "absence must not read as success," and it was doing exactly that for CD. Fixed in a companion PR (bitbaum/camille-boulangerie#2): the gate now detects a Deploy-shaped workflow the same way it detects CI, ratcheted independently so a CI regression and a CD regression can never mask each other under one shared count. deploy-ready-cd.baseline seeded at 0 — every deployed app now genuinely has both, verified fresh, not assumed. 2. apps.conf's `sink` entry pointed at /home/g/dev/aslan-tattoo, which no longer exists — some prior autonomous session renamed the checkout to /home/g/dev/s-ink and nothing updated the register. Running this gate locally caught it immediately (the "drift, not a bare environment" path added earlier today). Fixed the path. Neither of these was visible from CI passing: (1) needs a live check that CI has never run, and (2) can ONLY be caught locally, since it depends on the actual fleet checkouts existing — nothing schedules that check anywhere. That residual gap (no cron ever runs the fleet-inspection half) is reported separately, not fixed here — it needs a real decision about where such a check could run unattended, not a quick patch. scripts/test/deploy-ready-gate.sh gets 4 new cases using synthetic fixture repos (not the real fleet, which could coincidentally look fine) to prove CI and CD are detected independently, including camille's exact shape: a repo with only a CI workflow must be flagged for missing CD, not CI. Claude-Session: https://claude.ai/code/session_01Y9rKLxddothnXEtY6KDziN Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
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> |
||
|
|
14a6226b0d |
fix(infra): printcraft had botsmann's bug too — five migrations the pipeline never saw (#407)
Auditing the class that broke botsmann found exactly one other instance, and printcraft is it: `db` was `-`, which deploy.sh reads as "no database" and skips the schema step entirely, while `app/supabase/migrations` holds five migrations. It has not bitten yet only because its schema was applied by hand. The next migration would have gone the way botsmann's eleven did — nowhere, silently, behind a green deploy. The ledger is baselined at those five rather than applied, and baselining is an assertion, so each one was CHECKED against the live database first: initial_schema all 6 tables exist add_storage_bucket bucket `project-files` exists make_storage_guest_friendly "Anon can upload"/"Anon can read" policies present make_bucket_public project-files public = true restrict_storage_writes "Anon can update"/"Anon can delete" are GONE That last one matters most: it is the change that stopped every visitor being able to delete other people's uploaded memorial portraits. Recording it as applied without checking would have been the exact failure the baseline guard exists to prevent — so it was verified, not assumed. The ledger is written before this manifest change lands, so printcraft's next deploy finds a ledger and applies nothing, rather than hitting the "database already has tables" refusal and aborting. test-apply-schema.sh picks the new entry up automatically — it validates every `supabase:*` schema the manifest declares. 29 checks, up from 28. Claude-Session: https://claude.ai/code/session_01HVwg8DKHQktxJuHeLM3xpG Co-authored-by: t <t@t.t> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|
|
0bb5403852 |
fix(infra): a second app on the shared supabase database needs its own schema (#398)
botsmann has served 503 from `/api/health` because `public.consultations` does
not exist. It never existed: all ELEVEN of its migrations were unapplied, and
no deploy ever noticed.
The manifest is why. botsmann's `db` field was `-`, and deploy.sh reads that as
"no database" and skips the schema step entirely — so every deploy went green
while shipping code written against a schema nobody had applied. apply-schema.sh
even documents this app by name ("orangecat and botsmann use the SAME supabase
database"); it was simply never reached.
Setting `db` to a database name would have been worse than the bug. One
supabase database backs several apps, orangecat owns `public` and its 128
tables, and botsmann's 001 defines `CREATE OR REPLACE FUNCTION
update_updated_at()` — a name public ALREADY holds. Applying it there would
have silently redefined the function orangecat's triggers call. Table names
collide too (`conversations`, `documents`, `waitlist`).
So the db field learns a third form, `supabase:<schema>`, and botsmann gets its
own schema exactly as printcraft already has one:
* apply-schema.sh creates the schema, grants PostgREST's roles usage AND
default privileges (a one-off GRANT would miss every table the migrations
are about to create), and runs the batch under `SET LOCAL search_path` —
which is what actually keeps unqualified DDL out of public.
* The ledger moves beside the tables it describes. A shared
`public._deploy_schema_history` would mix two apps' tags and make "up to
date" meaningless for both.
* The baseline guard counts the app's OWN tables. Counting public let another
app's 128 tables hide an empty schema.
* Extension schemas are resolved, not hardcoded: pgvector lives in the
`printcraft` schema because printcraft's migration created it unqualified,
so `vector` is not reachable from a bare search_path.
* gen-env.sh treats `supabase:*` as having no host DATABASE_URL — those apps
have no row in ~/.db-credentials and would have failed there.
Two things that were gates in name only:
* The destructive guard scanned raw text, so `DELETE FROM rate_limits` inside
the BODY of `CREATE FUNCTION cleanup_rate_limits()` counted as a destructive
migration. Three such lines across two of botsmann's migrations would have
aborted the whole deploy on code that deletes nothing at apply time. Bodies
are now blanked before the scan, line numbers preserved. A gate that fails
red on good code is the worst kind — the only way past it is to switch it
off.
* Applied is not the same as REACHABLE. PostgREST serves only the schemas in
PGRST_DB_SCHEMAS; anything else answers PGRST205 "Could not find the table",
which is the very 503 this fixes. After applying, the step now refuses
rather than warns, and prints the exact command.
New test-apply-schema.sh, wired into `test:ops` and therefore `verify`: 28
checks, no box, no database, no checkout. Both directions are pinned — `-` still
means skip so this cannot start provisioning schemas for camille or substrata,
a real DROP TABLE still blocks, and botsmann's actual 11 migrations are run
through the guard. Mutation-checked: allowing `supabase:public` through fails a
test.
Claude-Session: https://claude.ai/code/session_01HVwg8DKHQktxJuHeLM3xpG
Co-authored-by: t <t@t.t>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
|
||
|
|
84706fb9c1 |
feat(infra): the site scaffold — register, new-site.sh, widget provisioning (#395)
#394 auto-merged on its first commit, so the rest of this work landed on a branch that was already closed. This is that remainder, rebuilt on main. **apps.conf becomes the register.** It knew port, domain, repo and database; it did not know who anything belongs to or whether they pay, so "what am I owed this month" was unanswerable and the answers lived as prose in bitbaum Status lines — "first client in progress", "city relationship unverified", "one real clinic". Six fields added: owner, kind, status, plan, price, since. plan and price are '-' everywhere on purpose; the gaps are the point. lib.sh needed its parser widened first — `read -r ... DB` lets bash's last variable swallow every extra field, so appending columns would have silently turned DB into "petvity|bitbaum|product|live|-|-". A 6-field line still parses exactly as before. **new-site.sh** does repo → register → box → deploy in one command. Substrata took nine manual steps today; Camille took the same route a week ago and skipped two of them — creating the repository and registering it — then ran in production for eight days with no version control, which made the studio's central claim untestable for the site built to demonstrate it. Those two steps have no visible payoff on the day, which is exactly why a machine should do them. Guards, because a slug becomes a DNS label, a certificate subject, a directory and a systemd unit: non-DNS-safe slugs, slugs already registered, hostnames already served, and reserved names — infrastructure like supabase, and impersonation like security, where a valid certificate on our own domain is a phish rather than a website. Ports come from the register, not ss -ltnp: a port free on the box but claimed here belongs to something not currently running. **provision-widget.ts** creates the FleetCrown project and mints a token bound to that site's origin. The widget is why this is not a dev shop — the owner points at their own page and an agent changes it — so it is provisioned at birth rather than later. Idempotent and deliberately non-rotating: rotating would silently invalidate a snippet already live on a customer's site. Non-fatal in the scaffold, because a missing widget is a minute's work while a half-finished scaffold is a mess. **The template ships tokens that say in the file that leaving them unchanged is a bug.** Twenty-four identical sites would destroy the thing being sold. Verified: guards refuse five bad inputs, dry-run allocates the next port and prints every step, template installs and builds static pages clean, and the widget provisioner was proved against the live database by giving Substrata its project and token — now serving in production. Co-authored-by: Mao Nakamoto <georgy.butaev@revamp-it.ch> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
ef7aa7fe53 |
chore(infra): register substrata on port 4022 (#394)
Its own repo, its own deploy, its own design system. The orangecat.ch subdomain is an address, not an affiliation — the same relationship petvity and botsmann have, and it moves to its own domain when one is bought without this entry changing shape. Co-authored-by: Mao Nakamoto <georgy.butaev@revamp-it.ch> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
846005d146 |
chore(hetzner): move sink to its own domain sinktattoo.com (#185)
The studio now owns sinktattoo.com, so the orangecat.ch subdomain is no longer the canonical home. Serves the apex and www; sink.orangecat.ch keeps a 308 to the new domain so anything already pointing there still lands. Co-authored-by: Mao Nakamoto <georgy.butaev@revamp-it.ch> |
||
|
|
a01bb332fd |
chore(hetzner): register sink (S.Ink tattoo portfolio) on port 4019 (#184)
New self-hosted app: one-page portfolio at sink.orangecat.ch. No database. Port 4019 is the next free slot after solon (4018). Co-authored-by: Mao Nakamoto <georgy.butaev@revamp-it.ch> |
||
|
|
308f32c833 |
chore(projects): retire swiss-longevity-hub and link Bitbaum runtime
Merge SLH into surf-your-life on prod, drop orphaned box DB, remove SLH from hetzner manifest, and wire Bitbaum user_projects dir for local dispatch. Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
68ecdd2260 |
fix(terminal): copy-on-select, paste, and a detected-link bar for wrapped URLs
The embedded xterm had three real defects on the auth path (`claude setup-token` prints a long OAuth URL): - Copy was impossible: xterm keeps its selection in a canvas layer, not the DOM, so the browser's native copy grabbed nothing. Mirror every non-empty selection to the system clipboard (copy-on-select) + keep ⌘C/Ctrl-Shift-C. - No paste: add ⌘V / Ctrl-Shift-V → clipboard into the PTY. - Wrapped links were uncatchable: xterm's link addon detects per visual row, so a URL wrapped across 5 rows was clickable only on row 1. The byte stream keeps each URL on one logical line — scan the output and surface whole URLs in a real-DOM LinkBar (clickable + one-click Copy), independent of wrapping. Font is already correct GeistMono (verified loaded); remaining gap vs a native GPU terminal is inherent to a browser DOM-rendered grid. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|
|
c6bc058cb4 |
chore: purge Vercel / Neon / managed-Supabase across the codebase
Self-hosted on Hetzner is the only reality now; the leftover references were
stale at best and a security hole at worst. Thorough sweep across code, config,
scripts, docs, and comments (84+ files). Self-hosted supabase.orangecat.ch is
kept; historical migration records stay accurate.
Functional / security fixes:
- cron-auth: prod detection was process.env.VERCEL (unset on the box!), so the
fail-closed 'CRON_SECRET unset -> 503' gate never fired in production. Now
keys on NODE_ENV=production. (security)
- auth trustHost: dropped the dead process.env.VERCEL===1 branch.
- AppFooter: read the baked-in build SHA instead of VERCEL_GIT_COMMIT_SHA/ENV.
- project bootstrap: removed 'neon projects create' + the Vercel deploy brief;
DB option is now self-hosted Postgres, deploy guidance is the self-hosted flow.
- db-url: removed the legacy NEON_DATABASE_URL* fallbacks (+ updated its test).
Infra / removals:
- deleted .github/workflows/vercel-deploy.yml and scripts/db/dump-from-{neon,supabase}.sh.
- stripped NEON_* env fallbacks from db dump/restore/sync scripts.
User-facing:
- desktop offline overlay no longer blames a 'Vercel hiccup'; privacy page +
PRIVACY_POLICY subprocessors now say Hetzner self-hosted / self-hosted Postgres.
Plus ~50 comment/doc rewrites (Vercel -> the cloud host/the box; Neon -> Postgres).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
||
|
|
625595db93 |
feat(infra): full Vercel/Supabase/Neon exit — SSOT manifest + deploy tooling for 16 self-hosted apps
apps.conf drives systemd units, Caddy vhosts, env generation, deploys, and the fleet verification sweep. Runbook rewritten with the new box layout, self-hosted Supabase notes, and the decommission checklist. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |