broker: wizard-rent reds on 'claim already taken' — the current REHEARSAL_SLUG (rehearsal-c) is orphan-claimed at the broker, no code path releases it #757

Closed
opened 2026-08-24 23:34:31 +00:00 by matou-build-agent · 1 comment

Failure

Drive 20260824T232052Z, leg wizard-rent, red on the S4a rent step:

expect(locator).toBeVisible() failed
Locator: locator('[data-status="address"]')
Timeout: 480000ms

error-context.md's DOM snapshot at timeout shows the rent card never advanced past the claim step:

paragraph: claim — That community name is already taken, so the gateway couldn't be reserved — pick a different name. that name is already taken
button "Retry"

This is internal/founding/access.go:379-384 — RentServer calls o.broker.ClaimSubdomain (access.go:375) for the community slug, gets back claim.Available == false, and returns a BrokerError{Stage: "claim"} without ever reaching the rent/provision step the test at journey.rented.spec.ts:173 waits on (s4aRent, fixtures/wizard.ts:171-173).

Root cause

The slug being claimed is rehearsal-c (confirmed by test-results/.../state/founding-state.json: draft.details.slug == "rehearsal-c"), which is REHEARSAL_SLUG from the environment (app/tests/e2e/journey.rented.spec.ts:207, falling back to scripts/lib/swarm-identity.sh:41's rehearsal-b default only when unset — here it's overridden to rehearsal-c). Per docs/GOTCHAS.md #32, the slug rotates by hand from rehearsal-b when Let's Encrypt walls the identifier set, which happened 2026-08-24 (drive 20260824T003513Z).

rehearsal-c is now itself claimed at the broker and stuck: broker/internal/broker/broker.go:379-384's claim path 409s whenever a reservation is REDEEMED or still inside its unredeemed TTL (broker.go:219-225 lapsedLocked). Issue #754 (commit 9d38ccbdd0456603109755526b903f1a4eac8c0f, landed 2026-08-24T19:50:42Z, hours before this drive) added a 24h TTL (DefaultReservationTTL, broker.go:106) so an abandoned unredeemed claim self-heals — but by design it does NOT add any admin/force-release path (the #754 commit message explicitly rejected that option for security-posture reasons), and a v1/v2 legacy record is grandfathered as permanently REDEEMED with no TTL at all (broker/internal/broker/store.go:23-39, broker.go:114-118).

So whichever of these is true, there is currently no way for this checkout or a rehearsal drive to unstick rehearsal-c on its own:

  • if rehearsal-c was claimed by an earlier orphaned drive in v3 format, it self-heals only after its own 24h TTL — which may not have elapsed yet (the slug only rotated to rehearsal-c earlier the same day);
  • if it predates the #754 migration (v1/v2 on-disk), it is grandfathered REDEEMED forever and the TTL never applies to it at all.

What plugging it needs

This is broker/ops state outside this checkout (the broker's own reservation ledger), not a defect I can name an exact line fix for or verify with a local test. A human/ops worker needs to:

  1. Check the broker's actual reservation ledger for rehearsal-c.idss.nz — is it v3-unredeemed-and-within-TTL, or a grandfathered legacy record?
  2. If within TTL: either wait out the 24h window, or rotate REHEARSAL_SLUG again (per GOTCHAS #32's documented procedure, in .sandcastle/.env on the executor — outside this checkout).
  3. If grandfathered-legacy: #754 deliberately left no force-release route; decide whether that gap needs a new ticket (e.g. a narrowly-scoped admin release limited to the rehearsal-* slug family, which are never real communities, without widening the security posture for real slugs).

No code in this checkout is mechanically wrong; RentServer's claim-then-persist logic and the broker's TTL/redeem model are both behaving as designed against a live ledger this run's evidence can't fully inspect.

drive 20260824T232052Z red at wizard-rent: expect(locator).toBeVisible() failed Locator: locator('[data-status="address"]') Expected: visible Timeout: 480000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 480000ms
evidence: test-results/…/20260824T232052Z/ on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)

## Failure Drive `20260824T232052Z`, leg `wizard-rent`, red on the S4a rent step: ``` expect(locator).toBeVisible() failed Locator: locator('[data-status="address"]') Timeout: 480000ms ``` `error-context.md`'s DOM snapshot at timeout shows the rent card never advanced past the claim step: > paragraph: claim — That community name is already taken, so the gateway couldn't be reserved — pick a different name. that name is already taken > button "Retry" This is `internal/founding/access.go:379-384` — `RentServer` calls `o.broker.ClaimSubdomain` (access.go:375) for the community slug, gets back `claim.Available == false`, and returns a `BrokerError{Stage: "claim"}` without ever reaching the rent/provision step the test at `journey.rented.spec.ts:173` waits on (`s4aRent`, `fixtures/wizard.ts:171-173`). ## Root cause The slug being claimed is `rehearsal-c` (confirmed by `test-results/.../state/founding-state.json`: `draft.details.slug == "rehearsal-c"`), which is `REHEARSAL_SLUG` from the environment (`app/tests/e2e/journey.rented.spec.ts:207`, falling back to `scripts/lib/swarm-identity.sh:41`'s `rehearsal-b` default only when unset — here it's overridden to `rehearsal-c`). Per `docs/GOTCHAS.md` #32, the slug rotates by hand from `rehearsal-b` when Let's Encrypt walls the identifier set, which happened 2026-08-24 (drive `20260824T003513Z`). `rehearsal-c` is now itself claimed at the broker and stuck: `broker/internal/broker/broker.go:379-384`'s claim path 409s whenever a reservation is REDEEMED or still inside its unredeemed TTL (`broker.go:219-225 lapsedLocked`). Issue #754 (commit `9d38ccbdd0456603109755526b903f1a4eac8c0f`, landed 2026-08-24T19:50:42Z, hours before this drive) added a 24h TTL (`DefaultReservationTTL`, `broker.go:106`) so an abandoned unredeemed claim self-heals — but by design it does NOT add any admin/force-release path (the #754 commit message explicitly rejected that option for security-posture reasons), and a v1/v2 legacy record is grandfathered as permanently REDEEMED with no TTL at all (`broker/internal/broker/store.go:23-39`, `broker.go:114-118`). So whichever of these is true, there is currently no way for this checkout or a rehearsal drive to unstick `rehearsal-c` on its own: - if `rehearsal-c` was claimed by an earlier orphaned drive in **v3** format, it self-heals only after its own 24h TTL — which may not have elapsed yet (the slug only rotated to `rehearsal-c` earlier the same day); - if it predates the #754 migration (**v1/v2** on-disk), it is grandfathered REDEEMED forever and the TTL never applies to it at all. ## What plugging it needs This is broker/ops state outside this checkout (the broker's own reservation ledger), not a defect I can name an exact line fix for or verify with a local test. A human/ops worker needs to: 1. Check the broker's actual reservation ledger for `rehearsal-c.idss.nz` — is it v3-unredeemed-and-within-TTL, or a grandfathered legacy record? 2. If within TTL: either wait out the 24h window, or rotate `REHEARSAL_SLUG` again (per GOTCHAS #32's documented procedure, in `.sandcastle/.env` on the executor — outside this checkout). 3. If grandfathered-legacy: #754 deliberately left no force-release route; decide whether that gap needs a new ticket (e.g. a narrowly-scoped admin release limited to the `rehearsal-*` slug family, which are never real communities, without widening the security posture for real slugs). No code in this checkout is mechanically wrong; `RentServer`'s claim-then-persist logic and the broker's TTL/redeem model are both behaving as designed against a live ledger this run's evidence can't fully inspect. drive `20260824T232052Z` red at `wizard-rent`: `expect(locator).toBeVisible() failed Locator: locator('[data-status="address"]') Expected: visible Timeout: 480000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 480000ms ` evidence: `test-results/…/20260824T232052Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596) <!-- rehearsal-sig: 3b0b824f61b8 -->
Author
Member

Close report — #757

Ruled by agent under ADR 0174 — veto anytime.

Landed: bb8eecff on origin/main (session: #757 — a slug's claim secret now OUTLIVES the run that minted it; #754's reservation TTL never reached this wedge).

The ticket's diagnosis was right about the symptom and wrong about the cure

The ticket offered two readings of the stuck rehearsal-c reservation — v3-unredeemed-and-within-TTL (wait 24h) or v1/v2-grandfathered (needs a new admin path) — and said neither could be settled without the broker's ledger. Both readings are wrong, and it turns out dig settles it from outside the ledger entirely.

Against the authoritative NS (dolly.ns.cloudflare.com), 2026-08-25T00:2xZ:

rehearsal-c.idss.nz                 A     168.144.165.255
*.rehearsal-c.idss.nz               CNAME rehearsal-c.idss.nz.
_acme-challenge.rehearsal-c.idss.nz CNAME 1d9420c8-5fe0-4c33-b330-bc1291286403.acme.rehearsal-c.idss.nz.
acme-dns.rehearsal-c.idss.nz        A     168.144.165.255

That is exactly the set Zone.PutRecords writes (ADR 0128 + #508's acme-dns delegation). Only Issuer.Point writes it — and Point calls Registry.Redeem the moment the zone write lands (broker.go). So rehearsal-c is REDEEMED, and a redeemed reservation never lapses (#278).

DefaultReservationTTL bounds only an UNREDEEMED claim — one that died before S5's point. Every drive that reaches S5 redeems. #754 healed a case the standing drive does not hit; the drive's own wedge is permanent, not a 24-hour wait. GOTCHAS #80's rule ("an abandoned claim self-heals in one lease window — no human ever reads the ledger") was too broad and is amended.

A second probe pins it further: POST /v1/subdomains/offboard for rehearsal-c.idss.nz bearing a freshly generated secret answers 403, not 400 and not 204 — the name is held and its stored secret is non-empty, so it is not a v1 legacy record awaiting trust-on-first-use adoption either. (403 is a pure read; nothing was mutated.)

Reading trap, now recorded in GOTCHAS #80: *.idss.nz answers A 143.198.134.168 (the mail droplet) for every unclaimed name at any depth (RFC 4592). "The A record resolves" proves nothing about a slug. Only a value differing from the wildcard's, or a CNAME/NS the wildcard cannot serve, proves a specific record exists.

The real defect, and the fix

The offboard that frees a redeemed name needs its claim secret. That secret is the wizard's — minted at S5 into that run's state dir, which was the only place it ever lived, and which retention prunes. A red drive whose teardown offboard failed took the one key with it. That is the whole wedge.

Fixed harness-side (scripts/lib/rehearsal-droplet.sh), needing no new broker authority:

  • oc_slug_secret_remember / oc_slug_claim_secrets — a per-slug store at test-results/slug-claims/<slug>.secrets, 0700/0600, gitignored. These are secrets: never the repo, never an issue body — the cert store's posture (#532).
  • Both teardowns (rented and own-VPS) remember the run's secret before spending it, so a teardown whose offboard fails still leaves the key behind.
  • oc_slug_secrets_harvest is the bootstrap for a slug wedged before the store existed: it mines the retained run dirs, taking a secret only from a run whose state names this slug.
  • oc_rented_offboard_stale_slug spends them in oc_rented_preflight, before the wizard claims. OC_RENTED_SWEEP_STALE=0 stands it down alongside the droplet sweep.

The sweep probes with offboard, never a claim-check — 400 = nobody holds it, 403 = not ours, 204 = freed. A claim-check of a free slug MINTS a reservation whose secret the sweep would throw away, wedging the very name it came to free for the whole TTL. I know because I did it: my first read of the broker claim-checked rehearsal-b, which was free, and minted a reservation on it. Undone immediately — offboard with the minted secret returned 204, and dig confirmed the delete touched nothing, because rehearsal-b had no specific records at all (it was the apex wildcard answering all along). Net state on rehearsal-b: unchanged. That trap is now a test and a GOTCHAS line.

Red-before-green in scripts/tests/rehearsal-rented-target-test.sh (new Half 4, suite now 21 checks): store round-trip + perms, harvest picks only this slug's runs and walks newest-first, the sweep stops at the first 204, never calls /claim, is never fatal when every secret is refused, honours the hatch, and a failed teardown still remembers. Siblings re-run green (swarm-identity-test.sh, rehearsal-rented-certs-test.sh, check-harness-drift.sh).

On the ticket's step 3 — does the gap need a broker ticket?

Ruling: no admin/force-release. It is a security-posture widening — a new authority that can take a name from its holder — which is a one-way door under ADR 0174 and which #754 rejected for the same reason. And nothing needs it: the drive already legitimately holds the secret, it was simply throwing it away. Narrowing such a path to the rehearsal-* family would put rehearsal semantics inside the production broker to buy something the harness can do for free.

What is NOT closed — read this before the next drive

  1. rehearsal-c was still held at close (403 above). The fix gives the next rented drive the first chance to free it: oc_slug_secrets_harvest will mine the retained test-results/drive-rented/*/state dirs on the executor for the secret that minted this reservation, and the sweep will spend it. I could not verify that any retained run dir still holds it — this session runs on matou-dev-server-01, and the drive host's run dirs, the executor's .sandcastle/.env, and the mail droplet's ledger are all unreachable from here (no netbird peer to the mail droplet; no REHEARSAL_SLUG/DO token in this host's .sandcastle/.env).
  2. If the sweep cannot free it, the drive says so by name at preflight rather than rediscovering the wedge eight minutes deep at S5, and names the only doors left: rotate REHEARSAL_SLUG (GOTCHAS #32, .sandcastle/.env on the executor) or read the broker ledger by hand. No new ticket is pre-filed for that — the standing drive's own reporter will file it with live evidence if it happens.
  3. Follow-up #758 filed (needs-triage): the broker destroys a rented gateway without touching the DNS that names it. rehearsal-c.idss.nz and its wildcard still resolve to 168.144.165.255, and doctl compute droplet list shows no idss-gateway-* droplet in the account at all — that address is back in DigitalOcean's pool while our zone still points a wildcard and an ACME delegation at it. Rehearsal blast radius today; the same code path carries a real community's name.

STATUS.md lead and GOTCHAS #80 updated in the same commit.

## Close report — #757 **Ruled by agent under ADR 0174 — veto anytime.** Landed: `bb8eecff` on `origin/main` (`session: #757 — a slug's claim secret now OUTLIVES the run that minted it; #754's reservation TTL never reached this wedge`). ### The ticket's diagnosis was right about the symptom and wrong about the cure The ticket offered two readings of the stuck `rehearsal-c` reservation — v3-unredeemed-and-within-TTL (wait 24h) or v1/v2-grandfathered (needs a new admin path) — and said neither could be settled without the broker's ledger. Both readings are wrong, and it turns out `dig` settles it from outside the ledger entirely. Against the authoritative NS (`dolly.ns.cloudflare.com`), 2026-08-25T00:2xZ: ``` rehearsal-c.idss.nz A 168.144.165.255 *.rehearsal-c.idss.nz CNAME rehearsal-c.idss.nz. _acme-challenge.rehearsal-c.idss.nz CNAME 1d9420c8-5fe0-4c33-b330-bc1291286403.acme.rehearsal-c.idss.nz. acme-dns.rehearsal-c.idss.nz A 168.144.165.255 ``` That is exactly the set `Zone.PutRecords` writes (ADR 0128 + #508's acme-dns delegation). Only `Issuer.Point` writes it — and `Point` calls `Registry.Redeem` the moment the zone write lands (`broker.go`). **So `rehearsal-c` is REDEEMED, and a redeemed reservation never lapses (#278).** `DefaultReservationTTL` bounds only an UNREDEEMED claim — one that died *before* S5's point. Every drive that reaches S5 redeems. **#754 healed a case the standing drive does not hit**; the drive's own wedge is permanent, not a 24-hour wait. GOTCHAS #80's rule ("an abandoned claim self-heals in one lease window — no human ever reads the ledger") was too broad and is amended. A second probe pins it further: `POST /v1/subdomains/offboard` for `rehearsal-c.idss.nz` bearing a freshly generated secret answers **403**, not 400 and not 204 — the name is held *and* its stored secret is non-empty, so it is not a v1 legacy record awaiting trust-on-first-use adoption either. (403 is a pure read; nothing was mutated.) **Reading trap, now recorded in GOTCHAS #80:** `*.idss.nz` answers `A 143.198.134.168` (the mail droplet) for *every* unclaimed name at *any* depth (RFC 4592). "The A record resolves" proves nothing about a slug. Only a value differing from the wildcard's, or a CNAME/NS the wildcard cannot serve, proves a specific record exists. ### The real defect, and the fix The offboard that frees a redeemed name needs its claim secret. That secret is the **wizard's** — minted at S5 into that run's state dir, which was the only place it ever lived, and which retention prunes. A red drive whose teardown offboard failed took the one key with it. That is the whole wedge. Fixed harness-side (`scripts/lib/rehearsal-droplet.sh`), needing **no new broker authority**: - `oc_slug_secret_remember` / `oc_slug_claim_secrets` — a per-slug store at `test-results/slug-claims/<slug>.secrets`, 0700/0600, gitignored. These are secrets: never the repo, never an issue body — the cert store's posture (#532). - Both teardowns (rented and own-VPS) remember the run's secret **before** spending it, so a teardown whose offboard *fails* still leaves the key behind. - `oc_slug_secrets_harvest` is the bootstrap for a slug wedged before the store existed: it mines the retained run dirs, taking a secret only from a run whose state names *this* slug. - `oc_rented_offboard_stale_slug` spends them in `oc_rented_preflight`, before the wizard claims. `OC_RENTED_SWEEP_STALE=0` stands it down alongside the droplet sweep. The sweep probes with **offboard, never a claim-check** — 400 = nobody holds it, 403 = not ours, 204 = freed. A claim-check of a *free* slug MINTS a reservation whose secret the sweep would throw away, wedging the very name it came to free for the whole TTL. I know because I did it: my first read of the broker claim-checked `rehearsal-b`, which was free, and minted a reservation on it. Undone immediately — offboard with the minted secret returned 204, and `dig` confirmed the delete touched nothing, because `rehearsal-b` had no specific records at all (it was the apex wildcard answering all along). Net state on `rehearsal-b`: unchanged. That trap is now a test and a GOTCHAS line. Red-before-green in `scripts/tests/rehearsal-rented-target-test.sh` (new Half 4, suite now 21 checks): store round-trip + perms, harvest picks only this slug's runs and walks newest-first, the sweep stops at the first 204, never calls `/claim`, is never fatal when every secret is refused, honours the hatch, and a failed teardown still remembers. Siblings re-run green (`swarm-identity-test.sh`, `rehearsal-rented-certs-test.sh`, `check-harness-drift.sh`). ### On the ticket's step 3 — does the gap need a broker ticket? **Ruling: no admin/force-release.** It is a security-posture widening — a new authority that can take a name from its holder — which is a one-way door under ADR 0174 and which #754 rejected for the same reason. And nothing needs it: the drive already legitimately *holds* the secret, it was simply throwing it away. Narrowing such a path to the `rehearsal-*` family would put rehearsal semantics inside the production broker to buy something the harness can do for free. ### What is NOT closed — read this before the next drive 1. **`rehearsal-c` was still held at close** (403 above). The fix gives the *next* rented drive the first chance to free it: `oc_slug_secrets_harvest` will mine the retained `test-results/drive-rented/*/state` dirs on the executor for the secret that minted this reservation, and the sweep will spend it. **I could not verify that any retained run dir still holds it** — this session runs on `matou-dev-server-01`, and the drive host's run dirs, the executor's `.sandcastle/.env`, and the mail droplet's ledger are all unreachable from here (no netbird peer to the mail droplet; no `REHEARSAL_SLUG`/DO token in this host's `.sandcastle/.env`). 2. If the sweep cannot free it, the drive **says so by name at preflight** rather than rediscovering the wedge eight minutes deep at S5, and names the only doors left: rotate `REHEARSAL_SLUG` (GOTCHAS #32, `.sandcastle/.env` on the executor) or read the broker ledger by hand. No new ticket is pre-filed for that — the standing drive's own reporter will file it with live evidence if it happens. 3. **Follow-up #758 filed** (`needs-triage`): the broker destroys a rented gateway without touching the DNS that names it. `rehearsal-c.idss.nz` and its wildcard still resolve to `168.144.165.255`, and `doctl compute droplet list` shows **no `idss-gateway-*` droplet in the account at all** — that address is back in DigitalOcean's pool while our zone still points a wildcard and an ACME delegation at it. Rehearsal blast radius today; the same code path carries a real community's name. STATUS.md lead and GOTCHAS #80 updated in the same commit.
matou-build-agent 2026-08-25 00:40:27 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#757
No description provided.