provision/kit: carry the tenant bootstrap write token provisioner -> ProvisionResult -> KitSchema -> kit.json (#121, ADR 0008) #130

Open
opened 2026-09-04 20:07:11 +00:00 by matou-build-agent · 0 comments

Source: #121 / ADR 0008 (bootstrap token that binds to the org AID via TOFU). The coa-side plumbing that carries the write token from the provisioner into the kit.

What (all in this repo — server/, packages/schema/)

  • httpProvisioner.provision() (server/src/tenant-provisioner.ts) parses the write token from the POST /admin/tenants response and returns it in ProvisionResult ({ ok: true; configUrl: string; writeToken?: string }). staticProvisioner returns none (local/dev has no tenant).
  • KitSchema (packages/schema/src/kit.ts, the source of truth) gains an optional field configWriteToken (absent for self-hosted / static-provisioned kits).
  • startBuild (server/src/build-pipeline.ts) threads the provisioner's writeToken into the kit; CommunityStore.writeKit persists it into kit.json.

Contract

  • Token field on the /admin/tenants response per matou-infrastructure #12 (default token). coa tests inject a fetch stub, so this is implementable against the agreed shape ahead of the infra change landing.

Security note (ADR 0008)

  • kit.json is served publicly at /c/<slug>/kit.json — this is by design: the token is bootstrap-only and its power expires at the TOFU bind (matou-infrastructure #13). Do not treat it as a repo secret, but never echo it into server logs.

Acceptance

  • httpProvisioner returns writeToken parsed from the admin response; staticProvisioner omits it (TDD, red first).
  • KitSchema validates a kit with and without configWriteToken; writeKit/readKit round-trip it.
  • startBuild writes configWriteToken into kit.json when the provisioner returned one.
  • make test green.

Depends on

  • matou-infrastructure #12 (token mint — for the response contract; codeable against the stub in parallel).

Out of scope

  • Setting MATOU_CONFIG_SERVER_TOKEN in the build env (that is the coa-builds child); matou-app backend behaviour; feature toggles / nav (phase 4).

Filed by the coa standing session turning Ben's #121 ruling into the cross-repo breakdown.

**Source:** #121 / **ADR 0008** (bootstrap token that binds to the org AID via TOFU). The coa-side plumbing that carries the write token from the provisioner into the kit. ## What (all in this repo — `server/`, `packages/schema/`) - `httpProvisioner.provision()` (`server/src/tenant-provisioner.ts`) parses the write token from the `POST /admin/tenants` response and returns it in `ProvisionResult` (`{ ok: true; configUrl: string; writeToken?: string }`). `staticProvisioner` returns none (local/dev has no tenant). - `KitSchema` (`packages/schema/src/kit.ts`, the source of truth) gains an **optional** field `configWriteToken` (absent for self-hosted / static-provisioned kits). - `startBuild` (`server/src/build-pipeline.ts`) threads the provisioner's `writeToken` into the kit; `CommunityStore.writeKit` persists it into `kit.json`. ## Contract - Token field on the `/admin/tenants` response per matou-infrastructure #12 (default `token`). coa tests inject a `fetch` stub, so this is implementable against the agreed shape ahead of the infra change landing. ## Security note (ADR 0008) - `kit.json` is served **publicly** at `/c/<slug>/kit.json` — this is **by design**: the token is bootstrap-only and its power expires at the TOFU bind (matou-infrastructure #13). Do not treat it as a repo secret, but never echo it into server logs. ## Acceptance - [ ] `httpProvisioner` returns `writeToken` parsed from the admin response; `staticProvisioner` omits it (TDD, red first). - [ ] `KitSchema` validates a kit with and without `configWriteToken`; `writeKit`/`readKit` round-trip it. - [ ] `startBuild` writes `configWriteToken` into `kit.json` when the provisioner returned one. - [ ] `make test` green. ## Depends on - matou-infrastructure #12 (token mint — for the response contract; codeable against the stub in parallel). ## Out of scope - Setting `MATOU_CONFIG_SERVER_TOKEN` in the build env (that is the coa-builds child); matou-app backend behaviour; feature toggles / nav (phase 4). _Filed by the coa standing session turning Ben's #121 ruling into the cross-repo breakdown._
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.

Blocks Depends on
You do not have permission to read 1 dependency
Reference
Matou/coa#130
No description provided.