server: /api/submit stores, renders, emails, publishes; GET /c/:slug (phase-2 plan Task 6) #33

Closed
opened 2026-08-28 21:00:26 +00:00 by ben · 1 comment
Owner

Plan

docs/superpowers/plans/2026-08-28-coa-phase-2.md Task 6.

Deliverable

Rewrite server/src/routes/submit.ts: parse → probe (self-hosted) → store.exists → 409 {error:'slug-taken', slug} → render via deps.render → store.write (status page-ready) → mailer.sendPageReady (failure → patchStatus({emailError})) → publisher.publish (failure → patchStatus({publishError})) → 200 {accepted:true, slug, pageUrl, backendReport?, status}. New server/src/routes/community-page.ts mounted at /c: GET /c/:slug → stored index.html; GET /c/:slug/logo.(svg|png); 404 {error:'not-found'}; slug checked against SLUG_RE. AppDeps.render (default renderCommunityPage). Update the phase-gate line in CLAUDE.md and docs/CODING-STANDARDS.md to phase 2 wording (plan text). Tests: extend server/test/submit.test.ts with testDeps(root) (plan's five phase-2 tests; phase-1 tests switched off defaultDeps() so nothing writes into the real communities/); new server/test/community-page.test.ts.

Acceptance

  • Happy path writes the directory, sends one mail with the right pageUrl, publishes the slug, returns 200 with status.state === 'page-ready'.
  • Second identical submit → 409, nothing new written, no second mail.
  • Mailer throwing / publisher {ok:false} → still 200; status.emailError / status.publishError recorded.
  • 400 writes, emails, publishes nothing.
  • /c/nope and /c/../etc/passwd → 404.
  • pnpm -r typecheck && pnpm -r test green.

depends_on

  • server: POST /api/submit — validate only (#13)
  • server: CommunityStore (Task 2)
  • server: GitPublisher (Task 3)
  • templates: community page renderer (Task 4)
  • server: Mailer (Task 5)

out_of_scope

make resend (Task 7); site changes (Task 8).

Phase gate

No build dispatch, no coa-shared provisioning, no status transitions beyond page-ready (phase 3). Never delete or rewrite anything under communities/ (ADR 0002/0003).

## Plan `docs/superpowers/plans/2026-08-28-coa-phase-2.md` **Task 6**. ## Deliverable Rewrite `server/src/routes/submit.ts`: parse → probe (self-hosted) → `store.exists` → 409 `{error:'slug-taken', slug}` → render via `deps.render` → `store.write` (status `page-ready`) → `mailer.sendPageReady` (failure → `patchStatus({emailError})`) → `publisher.publish` (failure → `patchStatus({publishError})`) → `200 {accepted:true, slug, pageUrl, backendReport?, status}`. New `server/src/routes/community-page.ts` mounted at `/c`: `GET /c/:slug` → stored `index.html`; `GET /c/:slug/logo.(svg|png)`; 404 `{error:'not-found'}`; slug checked against `SLUG_RE`. `AppDeps.render` (default `renderCommunityPage`). Update the phase-gate line in `CLAUDE.md` and `docs/CODING-STANDARDS.md` to phase 2 wording (plan text). Tests: extend `server/test/submit.test.ts` with `testDeps(root)` (plan's five phase-2 tests; phase-1 tests switched off `defaultDeps()` so nothing writes into the real `communities/`); new `server/test/community-page.test.ts`. ## Acceptance - Happy path writes the directory, sends one mail with the right `pageUrl`, publishes the slug, returns 200 with `status.state === 'page-ready'`. - Second identical submit → 409, nothing new written, no second mail. - Mailer throwing / publisher `{ok:false}` → still 200; `status.emailError` / `status.publishError` recorded. - 400 writes, emails, publishes nothing. - `/c/nope` and `/c/../etc/passwd` → 404. - `pnpm -r typecheck && pnpm -r test` green. ## depends_on - server: POST /api/submit — validate only (#13) - server: CommunityStore (Task 2) - server: GitPublisher (Task 3) - templates: community page renderer (Task 4) - server: Mailer (Task 5) ## out_of_scope `make resend` (Task 7); site changes (Task 8). ## Phase gate No build dispatch, no `coa-shared` provisioning, no status transitions beyond `page-ready` (phase 3). Never delete or rewrite anything under `communities/` (ADR 0002/0003).
Author
Owner

Claimed by the interactive session — working plan Task 6 after #32 merges; branch agent/issue-33.

Claimed by the interactive session — working plan Task 6 after #32 merges; branch agent/issue-33.
ben closed this issue 2026-08-30 00:42:39 +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/coa#33
No description provided.