server: BuildDispatcher — coa-builds workflow_dispatch (phase-3 plan Task 4) #71
Labels
No labels
agent-blocked
agent-working
bug
deferred
enhancement
model-haiku
model-opus
model-sonnet
needs-info
needs-triage
no-triage
priority
product-decision
ready-for-agent
ready-for-human
ready-for-session
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Blocks
Depends on
Reference
Matou/coa#71
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Plan
docs/superpowers/plans/2026-08-31-coa-phase-3.mdTask 4.Deliverable
server/src/build-dispatcher.ts:DispatchRequest {slug, build, kitUrl, configUrl, callbackUrl},BuildDispatcher.dispatch(req) → {ok:true} | {ok:false, error};githubDispatcher({repo, workflow, ref, token, fetch})→POST https://api.github.com/repos/<repo>/actions/workflows/<workflow>/dispatches{ref, inputs:{slug, kit_url, build:String, config_url, callback_url}}withauthorization: Bearer,accept: application/vnd.github+json,x-github-api-version: 2022-11-28; 204 → ok.noopDispatcher()recordscalls.AppDeps.dispatcher;defaultDeps()uses github whenGITHUB_DISPATCH_TOKENset (COA_BUILDS_REPOdefaultmatou-collective/coa-builds,COA_BUILDS_WORKFLOWbuild.yml,COA_BUILDS_REFmain), else noop. Testserver/test/build-dispatcher.test.ts(plan text).Acceptance
pnpm -r typecheck && pnpm -r testgreen.depends_on
Phase gate
Feature toggles / nav order in builds are phase 4. Never delete or rewrite anything under
communities/(ADR 0002/0003); phase 3 rewrites onlykit.json,status.json,index.html. No test reaches the real network, sends real mail, dispatches a real build or provisions a real tenant.Ruled by agent under ADR 0174 (two-way-door doctrine) — veto anytime
Ruling:
ready-for-agent. BuildDispatcher (github + noop); AppDeps.dispatcher 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/build-dispatcher.test.tswithfetchinjected — no real dispatch, andnoopDispatcheris the default whenGITHUB_DISPATCH_TOKENis 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.
Ruled by agent under the two-way-door doctrine — veto anytime.
Deviation from "plan tests pass verbatim": the plan test constructs
new Response('', { status: 204 })in itsstubhelper. In this repo's Node 22 / undici, 204 is a null-body status and the Response constructor throwsInvalid response status code 204for any non-null body (incl.'') — so the test throws inside its own stub, beforegithubDispatcherruns, and cannot pass verbatim here (CI runs the same Node).Ruling: the stub returns a null body for null-body statuses (204/205/304), leaving every assertion untouched (
{ ok: true }, URL, headers, request body, non-204/error cases). One-line comment records why.Why two-way: revertible by a later commit; provable by
pnpm --filter @coa/server test(46 passing, dispatcher included). Touches only test scaffolding, not the production surface (build-dispatcher.tsis byte-for-byte the plan implementation). Not on the one-way-door list — no network, mail, real build, or tenant.Ruled by agent under the two-way-door doctrine — veto anytime. The deliverable is fully on
main(worker commit4319da5; files + tests +AppDepswiring verified; seam green on1724dcb), 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 testgreen on the main head.