server: TenantProvisioner — coa-shared tenant via POST /admin/tenants (phase-3 plan Task 3) #70

Closed
opened 2026-08-31 05:20:15 +00:00 by ben · 2 comments
Owner

Plan

docs/superpowers/plans/2026-08-31-coa-phase-3.md Task 3.

Deliverable

server/src/tenant-provisioner.ts: TenantProvisioner.provision(slug) → {ok:true, configUrl} | {ok:false, error}; httpProvisioner({adminUrl, token, publicUrl, fetch}) POSTs ${adminUrl}/admin/tenants {slug} with Authorization: Bearer, 201 and 409 succeed with configUrl = ${publicUrl}/${slug}, other statuses/network errors → {ok:false, error:'<status> <body≤200>'}; staticProvisioner(publicUrl). AppDeps.provisioner; defaultDeps() picks http when COA_SHARED_ADMIN_TOKEN is set (env COA_SHARED_ADMIN_URL, COA_SHARED_PUBLIC_URL), else static. Test server/test/tenant-provisioner.test.ts (plan text).

Acceptance

  • Plan tests pass verbatim; fetch is always injected (no network).
  • pnpm -r typecheck && pnpm -r test green.

depends_on

  • schema (Task 1)

Phase gate

Feature toggles / nav order in builds are phase 4. Never delete or rewrite anything under communities/ (ADR 0002/0003); phase 3 rewrites only kit.json, status.json, index.html. No test reaches the real network, sends real mail, dispatches a real build or provisions a real tenant.

## Plan `docs/superpowers/plans/2026-08-31-coa-phase-3.md` **Task 3**. ## Deliverable `server/src/tenant-provisioner.ts`: `TenantProvisioner.provision(slug) → {ok:true, configUrl} | {ok:false, error}`; `httpProvisioner({adminUrl, token, publicUrl, fetch})` POSTs `${adminUrl}/admin/tenants` `{slug}` with `Authorization: Bearer`, 201 **and 409** succeed with `configUrl = ${publicUrl}/${slug}`, other statuses/network errors → `{ok:false, error:'<status> <body≤200>'}`; `staticProvisioner(publicUrl)`. `AppDeps.provisioner`; `defaultDeps()` picks http when `COA_SHARED_ADMIN_TOKEN` is set (env `COA_SHARED_ADMIN_URL`, `COA_SHARED_PUBLIC_URL`), else static. Test `server/test/tenant-provisioner.test.ts` (plan text). ## Acceptance - Plan tests pass verbatim; fetch is always injected (no network). - `pnpm -r typecheck && pnpm -r test` green. ## depends_on - schema (Task 1) ## Phase gate Feature toggles / nav order in builds are phase 4. Never delete or rewrite anything under `communities/` (ADR 0002/0003); phase 3 rewrites only `kit.json`, `status.json`, `index.html`. No test reaches the real network, sends real mail, dispatches a real build or provisions a real tenant.

This was generated by AI during triage.

Ruled by agent under ADR 0174 (two-way-door doctrine) — veto anytime

Ruling: ready-for-agent. TenantProvisioner (http + static); AppDeps.provisioner wired env-gated.

Why this is a two-way door: it is revertible by a later commit or label change, and provable by the tests the plan specifies — which never reach the real network, send real mail, dispatch a real build or provision a real tenant. It is not on the one-way-door list: the credential bytes, real GitHub dispatch/release and live coa-shared tenant are already carved out into the human ticket #79 and the session tickets #80/#81; env-gated defaults keep the wired code inert (noop/static, 503/unconfigured) until those land.

What proves it: server/test/tenant-provisioner.test.ts with fetch injected — no real network, and staticProvisioner is the default when COA_SHARED_ADMIN_TOKEN is unset.

The ticket body is a complete agent brief (Deliverable / Acceptance / depends_on). The native Forgejo dependency links already mirror the plan's graph, so the swarm ready-list filter holds this ticket until its blockers close.

> *This was generated by AI during triage.* ## Ruled by agent under ADR 0174 (two-way-door doctrine) — veto anytime **Ruling:** `ready-for-agent`. TenantProvisioner (http + static); AppDeps.provisioner wired env-gated. **Why this is a two-way door:** it is revertible by a later commit or label change, and provable by the tests the plan specifies — which never reach the real network, send real mail, dispatch a real build or provision a real tenant. It is not on the one-way-door list: the credential bytes, real GitHub dispatch/release and live coa-shared tenant are already carved out into the human ticket #79 and the session tickets #80/#81; env-gated defaults keep the wired code inert (noop/static, 503/unconfigured) until those land. **What proves it:** `server/test/tenant-provisioner.test.ts` with `fetch` injected — no real network, and `staticProvisioner` is the default when `COA_SHARED_ADMIN_TOKEN` is unset. The ticket body is a complete agent brief (Deliverable / Acceptance / depends_on). The native Forgejo dependency links already mirror the plan's graph, so the swarm ready-list filter holds this ticket until its blockers close.
Author
Owner

Ruled by agent under the two-way-door doctrine — veto anytime. The deliverable is fully on main (worker commit 6c5261e; files + tests + AppDeps wiring verified; seam green on 1724dcb), but the worker died before its close-report and its PR was a fully-merged shell (now closed). Closing so the ready list unblocks #74. Proof: pnpm -r typecheck && pnpm -r test green on the main head.

Ruled by agent under the two-way-door doctrine — veto anytime. The deliverable is fully on `main` (worker commit `6c5261e`; files + tests + `AppDeps` wiring verified; seam green on `1724dcb`), but the worker died before its close-report and its PR was a fully-merged shell (now closed). Closing so the ready list unblocks #74. Proof: `pnpm -r typecheck && pnpm -r test` green on the main head.
ben 2026-08-31 21:42:07 +00:00
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.

Reference
Matou/coa#70
No description provided.