feat(api): artifact subsystem foundation (schema + lifecycle + queue)#1994
Merged
Conversation
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.
…ents + forms + polymorphic tables)
…evision bump, document non-transactional)
5 tasks
This was referenced May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
eventswithstatus/revision/author_id/scope/host_group_id/host_org_id/external_url/thumbnail_key; addsannouncements,forms,form_submissions,artifact_reviews,artifact_comments,broadcast_requests,broadcast_channels; six new pg enums. Existing events backfilled topublished/public, then defaults flipped todraft/communityfor new inserts.packages/api/src/lib/lifecycle/: valid-transitions table, approval counter with self-promotion guard,effectiveStatusread-time auto-transitions (events→completed past end_date; announcements→expired past expires_at), andapplyTransitionorchestrator (validates, persists review row, counts approvals, publishes on threshold of 2 distinct non-author reviewers, emits audit). Drizzle adapter implements the DB surface.canEditArtifact(staff or author-on-draft/changes_requested) andcanReviewArtifact(staff + not-the-author).GET /admin/queue(UNION ALL across in_review events/announcements/forms with type/scope filters) andGET /announcements/active-banner(returns at most one announcement; null in v1 until Plan 3 wires it up).testAppwrapper,seedArtifactsfor fixtures) +TEST_BYPASS_AUTHenv-gated middleware bypass that's inert in production (verified: not inwrangler.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
curl https://<staging>/api/announcements/active-bannerreturns{"banner":null}curl -H 'Authorization: Bearer <staff token>' https://<staging>/api/admin/queuereturns{"ok":true,"rows":[]}DATABASE_URL=<staging> npx vitest run src/lib/lifecycle/integration.test.ts)TEST_BYPASS_AUTHin anywrangler.jsonc/ env configPlan + spec
docs/superpowers/specs/2026-05-20-events-announcements-forms-design.mddocs/superpowers/plans/2026-05-20-artifact-subsystem-foundation-implementation.md