Release door: POST /api/release frees a community's name on its IDSS claim secret, verified through the broker (idss ADR 0276) #148

Closed
opened 2026-09-24 05:20:22 +00:00 by ben · 2 comments
Owner

Why (ruled 2026-09-24, idss ADR 0276 — Ben, option A on idss#1805)

A community destroyed on IDSS keeps its app page on Coa forever: the broker frees the server and the .idss.nz name, Coa has no door that frees a name. Proven on the cold manual re-test of whakatohea-demo: the 09-16 page still in communities/whakatohea-demo/ refused the re-founding with 409 slug-taken; it was freed by hand (git rm -rqf, GOTCHAS 14's dirty status.json).

The door

POST /api/release body { "slug": "<slug>" }, header Authorization: Bearer <the community's claim secret> (idss ADR 0135).

  1. Coa does NOT learn or store secrets. It calls the broker: POST https://broker.idss.nz/v1/subdomains/verify { "host": "<slug>.idss.nz" } with the same Bearer (idss side ships this; 204 = the secret claimed that host, 403 = wrong secret, 404 = host not claimed). Anything but 204 → Coa answers 403 {error:'forbidden'} and touches nothing.
  2. On 204: remove communities/<slug>/ (page, status, logo, installers under installers/<slug>/ if the installer store is per-slug), commit release: <slug>, pull --rebase, push — the same publisher chain as publish, but tolerant of a dirty status.json (GOTCHAS 14: git rm -rf, never a refusal on local modifications). GET /c/<slug>/status.json → 404 afterwards; GET /c/<slug> → 404.
  3. Idempotent: releasing a slug that is not held answers 404 {error:'not-found'}; a repeat after success answers 404 too. Never 500 on a missing dir.
  4. A community mid-build (state: building) is released too — the build's callback for a released slug is answered 404 and ignored.

The fake

rehearsal-coa (idss cmd/rehearsal-coa) refuses a release without a valid secret exactly as this door does — the lesson of idss#1806/#1807: the fake must fail the way production fails. Coordinate the verify semantics with the idss ticket.

Tests

  • release with a valid secret → 204/200, store dir gone, status 404, a commit on main.
  • wrong secret → 403, nothing touched. Unknown slug → 404.
  • dirty status.json (patchStatus after publish) → still released.
  • broker unreachable → 502 {error:'broker'}, nothing touched.

Relates to: idss ADR 0276, idss#1805, idss#1785 (broker LEAVE), DDR 0007 (this repo), GOTCHAS 14.

## Why (ruled 2026-09-24, idss ADR 0276 — Ben, option A on idss#1805) A community destroyed on IDSS keeps its app page on Coa forever: the broker frees the server and the `.idss.nz` name, Coa has no door that frees a name. Proven on the cold manual re-test of `whakatohea-demo`: the 09-16 page still in `communities/whakatohea-demo/` refused the re-founding with `409 slug-taken`; it was freed by hand (`git rm -rqf`, GOTCHAS 14's dirty `status.json`). ## The door `POST /api/release` body `{ "slug": "<slug>" }`, header `Authorization: Bearer <the community's claim secret>` (idss ADR 0135). 1. Coa does NOT learn or store secrets. It calls the broker: `POST https://broker.idss.nz/v1/subdomains/verify` `{ "host": "<slug>.idss.nz" }` with the same Bearer (idss side ships this; 204 = the secret claimed that host, 403 = wrong secret, 404 = host not claimed). Anything but 204 → Coa answers 403 `{error:'forbidden'}` and touches nothing. 2. On 204: remove `communities/<slug>/` (page, status, logo, installers under `installers/<slug>/` if the installer store is per-slug), commit `release: <slug>`, pull --rebase, push — the same publisher chain as `publish`, but tolerant of a dirty `status.json` (GOTCHAS 14: `git rm -rf`, never a refusal on local modifications). `GET /c/<slug>/status.json` → 404 afterwards; `GET /c/<slug>` → 404. 3. Idempotent: releasing a slug that is not held answers 404 `{error:'not-found'}`; a repeat after success answers 404 too. Never 500 on a missing dir. 4. A community mid-build (`state: building`) is released too — the build's callback for a released slug is answered 404 and ignored. ## The fake `rehearsal-coa` (idss `cmd/rehearsal-coa`) refuses a release without a valid secret exactly as this door does — the lesson of idss#1806/#1807: the fake must fail the way production fails. Coordinate the verify semantics with the idss ticket. ## Tests - release with a valid secret → 204/200, store dir gone, status 404, a commit on main. - wrong secret → 403, nothing touched. Unknown slug → 404. - dirty `status.json` (patchStatus after publish) → still released. - broker unreachable → 502 `{error:'broker'}`, nothing touched. Relates to: idss ADR 0276, idss#1805, idss#1785 (broker LEAVE), DDR 0007 (this repo), GOTCHAS 14.

swarm-claim host=matou-dev-server-01 run=11148
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=11148 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #148 — status success

✅ close-report gates passed — every claim verified against main; PR #149 (#149) was already merged (a reconcile pass landed it before this close-report ran) and the merge closed this issue via closes #148.

envelope
{
  "issue": 148,
  "status": "success",
  "commits": [
    "f5c286e5dd5d6fd49794d4c1577233d9eeca7e9a"
  ],
  "changed_files": [
    "packages/schema/src/release.ts",
    "packages/schema/src/index.ts",
    "packages/schema/test/release.test.ts",
    "server/src/broker.ts",
    "server/src/routes/release.ts",
    "server/src/app.ts",
    "server/src/community-store.ts",
    "server/src/git-publisher.ts",
    "server/src/installer-store.ts",
    "server/test/release.test.ts",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "CI=true pnpm install --frozen-lockfile",
      "exit_code": 0
    },
    {
      "command": "CI=true pnpm -r typecheck",
      "exit_code": 0
    },
    {
      "command": "CI=true pnpm -r test",
      "exit_code": 0
    }
  ],
  "criteria": {
    "POST /api/release body {slug}, Authorization: Bearer <claim secret>": "server/src/routes/release.ts parses ReleaseRequestSchema body and reads the Authorization bearer; ReleaseRequestSchema (packages/schema/src/release.ts, strict) rejects a secret in the body — test packages/schema/test/release.test.ts",
    "Coa does not learn/store secrets; calls broker POST /v1/subdomains/verify {host} with the same Bearer; 204=ok else forbidden": "server/src/broker.ts httpBroker.verifyClaim posts {host:'<slug>.idss.nz'} with Authorization: Bearer <secret>; 204→ok, else forbidden. release.ts passes the bearer straight through and never persists it — test 'asks the broker with the host and the bearer secret' in server/test/release.test.ts",
    "Anything but 204 -> 403 forbidden and touches nothing": "release.ts returns 403 {error:'forbidden'} on a non-ok verdict before any removal — test 'wrong secret -> 403, nothing touched, no release commit'",
    "On 204: remove communities/<slug>/ (page,status,logo) and per-slug installers, commit release:<slug>, publisher chain; GET status.json/page -> 404": "release.ts calls installers.removeAll + store.remove + publisher.release; CommunityStore.remove (server/src/community-store.ts) and InstallerStore.removeAll (server/src/installer-store.ts) rm -rf; GitPublisher.release (server/src/git-publisher.ts) commits `release: <slug>` via commit(['-A', dir]) same retry/serialisation as publish — test 'valid secret -> 200, store dir gone, page 404, one release commit' and 'removes the per-slug hosted installers too'",
    "Tolerant of a dirty status.json (never a refusal on local modifications)": "store.remove force-rm's the whole dir (comment cites GOTCHAS 14); git add -A stages the deletion regardless of a prior in-place status.json edit — test 'a dirty status.json (patched after publish) is still released'",
    "Idempotent: unknown or already-freed slug -> 404 not-found; never 500 on a missing dir": "release.ts checks store.exists before the broker and returns 404 {error:'not-found'}; remove uses force so a missing dir never throws — tests 'unknown slug -> 404, and never reaches the broker' and 'a repeat after a successful release -> 404'",
    "A community mid-build (state: building) is released too; its build-complete callback is 404'd and ignored": "release removes the dir whatever the state; build-complete's existing unknown-slug path returns 404 — test 'a build-complete callback for a released mid-build slug is answered 404 and ignored'",
    "broker unreachable -> 502 {error:'broker'}, nothing touched": "httpBroker returns broker-error on a fetch throw or 5xx; release.ts maps it to 502 {error:'broker'} before any removal — test 'broker unreachable -> 502, nothing touched'",
    "Tests (release valid/wrong/unknown/dirty/broker)": "server/test/release.test.ts (11 cases) + packages/schema/test/release.test.ts (3 cases); full workspace CI=true pnpm -r typecheck && pnpm -r test green"
  },
  "summary": "Added POST /api/release: a community destroyed on IDSS frees its Coa name on its claim secret, verified through the broker (idss ADR 0276), removing the store dir and per-slug installers and committing release:<slug>.",
  "reason": "Implements the release door #148 on the server + schema seam with full test coverage; merged to main via PR #149 with the CI seam green.",
  "blockers": []
}
**close-report** for #148 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; PR #149 (https://git.matou.nz/Matou/coa/pulls/149) was already merged (a reconcile pass landed it before this close-report ran) and the merge closed this issue via `closes #148`. <details><summary>envelope</summary> ```json { "issue": 148, "status": "success", "commits": [ "f5c286e5dd5d6fd49794d4c1577233d9eeca7e9a" ], "changed_files": [ "packages/schema/src/release.ts", "packages/schema/src/index.ts", "packages/schema/test/release.test.ts", "server/src/broker.ts", "server/src/routes/release.ts", "server/src/app.ts", "server/src/community-store.ts", "server/src/git-publisher.ts", "server/src/installer-store.ts", "server/test/release.test.ts", "STATUS.md" ], "tests": [ { "command": "CI=true pnpm install --frozen-lockfile", "exit_code": 0 }, { "command": "CI=true pnpm -r typecheck", "exit_code": 0 }, { "command": "CI=true pnpm -r test", "exit_code": 0 } ], "criteria": { "POST /api/release body {slug}, Authorization: Bearer <claim secret>": "server/src/routes/release.ts parses ReleaseRequestSchema body and reads the Authorization bearer; ReleaseRequestSchema (packages/schema/src/release.ts, strict) rejects a secret in the body — test packages/schema/test/release.test.ts", "Coa does not learn/store secrets; calls broker POST /v1/subdomains/verify {host} with the same Bearer; 204=ok else forbidden": "server/src/broker.ts httpBroker.verifyClaim posts {host:'<slug>.idss.nz'} with Authorization: Bearer <secret>; 204→ok, else forbidden. release.ts passes the bearer straight through and never persists it — test 'asks the broker with the host and the bearer secret' in server/test/release.test.ts", "Anything but 204 -> 403 forbidden and touches nothing": "release.ts returns 403 {error:'forbidden'} on a non-ok verdict before any removal — test 'wrong secret -> 403, nothing touched, no release commit'", "On 204: remove communities/<slug>/ (page,status,logo) and per-slug installers, commit release:<slug>, publisher chain; GET status.json/page -> 404": "release.ts calls installers.removeAll + store.remove + publisher.release; CommunityStore.remove (server/src/community-store.ts) and InstallerStore.removeAll (server/src/installer-store.ts) rm -rf; GitPublisher.release (server/src/git-publisher.ts) commits `release: <slug>` via commit(['-A', dir]) same retry/serialisation as publish — test 'valid secret -> 200, store dir gone, page 404, one release commit' and 'removes the per-slug hosted installers too'", "Tolerant of a dirty status.json (never a refusal on local modifications)": "store.remove force-rm's the whole dir (comment cites GOTCHAS 14); git add -A stages the deletion regardless of a prior in-place status.json edit — test 'a dirty status.json (patched after publish) is still released'", "Idempotent: unknown or already-freed slug -> 404 not-found; never 500 on a missing dir": "release.ts checks store.exists before the broker and returns 404 {error:'not-found'}; remove uses force so a missing dir never throws — tests 'unknown slug -> 404, and never reaches the broker' and 'a repeat after a successful release -> 404'", "A community mid-build (state: building) is released too; its build-complete callback is 404'd and ignored": "release removes the dir whatever the state; build-complete's existing unknown-slug path returns 404 — test 'a build-complete callback for a released mid-build slug is answered 404 and ignored'", "broker unreachable -> 502 {error:'broker'}, nothing touched": "httpBroker returns broker-error on a fetch throw or 5xx; release.ts maps it to 502 {error:'broker'} before any removal — test 'broker unreachable -> 502, nothing touched'", "Tests (release valid/wrong/unknown/dirty/broker)": "server/test/release.test.ts (11 cases) + packages/schema/test/release.test.ts (3 cases); full workspace CI=true pnpm -r typecheck && pnpm -r test green" }, "summary": "Added POST /api/release: a community destroyed on IDSS frees its Coa name on its claim secret, verified through the broker (idss ADR 0276), removing the store dir and per-slug installers and committing release:<slug>.", "reason": "Implements the release door #148 on the server + schema seam with full test coverage; merged to main via PR #149 with the CI seam green.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/coa#148
No description provided.