Files
loki/scripts
CatoandClaude Opus 5 b5143dac0b feat(register): check the register against reality, and judge it with its own commit (#594)
Two problems, one theme: a fact written in more than one place, and nothing
comparing the copies.

1. NOTHING ASKED WHETHER THE REGISTER STILL DESCRIBED THE BOX

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

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

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

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

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

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

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

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

3. A PIPEFAIL TRAP, MEASURED

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

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


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

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 16:21:55 -07:00
..
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00
2026-08-31 09:23:30 +00:00