Skip to content

feat(api): artifact subsystem foundation (schema + lifecycle + queue)#1994

Merged
cdcore09 merged 26 commits into
cdcore09/site-redesignfrom
cdcore09/artifact-foundation
May 24, 2026
Merged

feat(api): artifact subsystem foundation (schema + lifecycle + queue)#1994
cdcore09 merged 26 commits into
cdcore09/site-redesignfrom
cdcore09/artifact-foundation

Conversation

@cdcore09
Copy link
Copy Markdown
Contributor

Summary

Plan 1 of 5 from the events / announcements / forms brainstorm. Lands the shared substrate that the next four plans (events, announcements, forms, broadcast) all sit on top of. No user-facing UI in this PR — that arrives in Plans 2-5.

  • Migration 0022 extends events with status/revision/author_id/scope/host_group_id/host_org_id/external_url/thumbnail_key; adds announcements, forms, form_submissions, artifact_reviews, artifact_comments, broadcast_requests, broadcast_channels; six new pg enums. Existing events backfilled to published/public, then defaults flipped to draft/community for new inserts.
  • Lifecycle library at packages/api/src/lib/lifecycle/: valid-transitions table, approval counter with self-promotion guard, effectiveStatus read-time auto-transitions (events→completed past end_date; announcements→expired past expires_at), and applyTransition orchestrator (validates, persists review row, counts approvals, publishes on threshold of 2 distinct non-author reviewers, emits audit). Drizzle adapter implements the DB surface.
  • Policies: canEditArtifact (staff or author-on-draft/changes_requested) and canReviewArtifact (staff + not-the-author).
  • Comments sanitizer: trims + length-caps comment bodies; plain text only.
  • New endpoints: GET /admin/queue (UNION ALL across in_review events/announcements/forms with type/scope filters) and GET /announcements/active-banner (returns at most one announcement; null in v1 until Plan 3 wires it up).
  • Test infra: integration helpers (testApp wrapper, seedArtifacts for fixtures) + TEST_BYPASS_AUTH env-gated middleware bypass that's inert in production (verified: not in wrangler.jsonc, no request-controlled path can set it).

Stats

23 commits, 193 vitest tests pass (8 transitions + 7 effectiveStatus + 5 approvals + 8 applyTransition + 4 comments + 8 policy + 3 queue route + 1 integration smoke + the pre-existing suite). Full repo typecheck clean.

Test plan

  • CI green (Cloudflare Pages preview deploys; CircleCI legacy on site-redesign-base PRs may error — expected)
  • curl https://<staging>/api/announcements/active-banner returns {"banner":null}
  • curl -H 'Authorization: Bearer <staff token>' https://<staging>/api/admin/queue returns {"ok":true,"rows":[]}
  • Integration smoke passes against staging (DATABASE_URL=<staging> npx vitest run src/lib/lifecycle/integration.test.ts)
  • No usage of TEST_BYPASS_AUTH in any wrangler.jsonc / env config

Plan + spec

  • Spec: docs/superpowers/specs/2026-05-20-events-announcements-forms-design.md
  • Plan: docs/superpowers/plans/2026-05-20-artifact-subsystem-foundation-implementation.md
  • Plans 2-5 to follow: events, announcements, forms, broadcast — each builds on this foundation.

cdcore09 added 26 commits May 20, 2026 15:56
Brainstormed spec captures the v1 design: three concrete artifact
tables (events, announcements, forms) with shared status/scope enums,
six polymorphic cross-cutting tables (reviews, comments, broadcast
requests + channels, revisions, form submissions), tier-flat authoring
with a two-distinct-approver publish gate on the current revision,
per-channel broadcast approval with hybrid posting strategies (native
site_banner + workspace_chat, manual handoff for external social,
blocked-on-#1965 for newsletter), Coltorapps headless form builder,
unified /admin/queue triage surface, and an auth-gated /events/submit
flow for member submissions. Sessions, committees, sponsors, n8n
autoposting, and newsletter sending stay out of v1.
Plan 1 of 5 covering migration 0022 (events extension + 5 new tables +
6 enums), Drizzle schema modules, lifecycle library (transitions,
approvals, effectiveStatus, applyTransition orchestrator with Drizzle
adapter), canEditArtifact / canReviewArtifact policies, comment
sanitizer, GET /admin/queue (UNION ALL across in_review artifacts),
GET /announcements/active-banner stub, and TEST_BYPASS_AUTH integration
harness with a full submit → 2-approve → publish smoke. Plans 2-5
(events, announcements, forms, broadcast) sit on this foundation.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying usrse-github-io with  Cloudflare Pages  Cloudflare Pages

Latest commit: 351f8b4
Status:⚡️  Build in progress...

View logs

@cdcore09 cdcore09 merged commit 31a0f2b into cdcore09/site-redesign May 24, 2026
0 of 2 checks passed
@cdcore09 cdcore09 deleted the cdcore09/artifact-foundation branch May 24, 2026 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant