Repository navigation
pm-stack: orchestration state schema contract (#5005 phase 1, P1 vetting slice) - #8458
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2532da6c82
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…nal (#8856) The 20261111_0001 up migration made orch_items.state NOT NULL with a non-empty check, but the writer contract makes TierItem.state optional (aggregator model.ts) and the contract corpus's decision item omits state entirely, so a valid snapshot was rejected (Codex P2 on PR #8458). Absent state is now NULL; a state that is present must still be non-empty: CHECK (state IS NULL OR btrim(state) <> ''). Probe: test-orchestration-migration.sh gains a state-less insert mirroring the corpus decision item (imports cleanly, state NULL) and a blank-state rejection case. Full harness passes on disposable PostgreSQL 16.
…ting slice Target-store decision (recorded on #5005 with document evidence): orchestration state is new PM state, so it starts in Supabase muse-dev2 under the #3142 placement — public schema, new orch_* group, per SHARED-SCHEMA-MIGRATION-PLAN.md's inherited constraints. The #6581 Supabase-to-Turso wave plan migrates existing Supabase table sets and does not classify orchestration state. This slice is the P1 schema-vetting step in the #6103 shape: specifies the target, applies nothing to muse-dev2, copies no rows, changes no writer or reader. orchestration.json stays authoritative until the writer-cutover slice. - migrations/20261111_0001_orchestration_state.up.sql: public.orch_runs (append-only run log: one row per pass, carrying the complete export document, so the generated export is the newest run's document and the #898 dashboard shape is preserved by construction) and public.orch_items (current tier / classification state: queryable columns + the item verbatim in JSONB, tier check-constrained to needsDrew/needsOrchestrator, run FKs, seen-order and document-identity checks). RLS on both; service_role gets append/read on the log and the replace set on the state table. - Down migration refuses to drop populated tables, per #6103. - ORCHESTRATION.md: the contract — column maps to the current orchestration.json fields, the writer contract the cutover slice must follow (one transaction per pass: insert run, replace items, regenerate the file export), and rollback at every stage. - test-orchestration-migration.sh: disposable-PostgreSQL-16 test in the test-migration.sh shape — privilege/RLS probes, service_role operation under RLS, six constraint rejections, snapshot-replace flow, down-migration guard and clean rollback. Verified passing on the laptop this run. Queue task 14783, lane code-g.
…nal (#8856) The 20261111_0001 up migration made orch_items.state NOT NULL with a non-empty check, but the writer contract makes TierItem.state optional (aggregator model.ts) and the contract corpus's decision item omits state entirely, so a valid snapshot was rejected (Codex P2 on PR #8458). Absent state is now NULL; a state that is present must still be non-empty: CHECK (state IS NULL OR btrim(state) <> ''). Probe: test-orchestration-migration.sh gains a state-less insert mirroring the corpus decision item (imports cleanly, state NULL) and a blank-state rejection case. Full harness passes on disposable PostgreSQL 16.
… identity fields (#8857)
c278f24 to
cf25944
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Agent note — task 17224 done (lane any-b): PR #8458 shepherded to merge
Shepherd work: branch rebased onto current main (3 commits, clean). Both Codex P2 findings were already fixed on the branch (nullable orch_items.state for #8856; IS TRUE identity checks for #8857) but never dispositioned — both threads were replied to with the fix commits and test evidence and resolved (replies 4575586462, 4575586552). Verification on the rebased head: pm-stack/shared-schema/test-orchestration-migration.sh passed in full on disposable PostgreSQL 16, including the state-less corpus item importing with NULL state and every missing/JSON-null identity rejection probe. Immediately before merging: PR MERGEABLE/CLEAN, no failing or pending checks on the rebased head (the old head's mcpx-test lint failure was against the pre-rebase base and did not recur). Finding issues #8856 and #8857 are closed with this evidence. |
Part of #5005 (phase 1 of epic #3142) — the P1 schema-vetting slice, in the #6103 shape. Refs #5005; does not close it (writer cutover + reader flip are the follow-on slices named in the contract).
Target-store decision (step 1 of the task, recorded on #5005)
Supabase
muse-dev2,publicschema, neworch_*group. Evidence, all verified fresh this run:pm-stack/SHARED-SCHEMA-MIGRATION-PLAN.md: "Long-term: migrate the pm stack into Supabase — refactor component state into schemas for central management #3142 supersedes pm stack: centralize all service data as shared tables in one database schema #1744's one-local-libSQL default for new state: start new PM state in Supabasemuse-dev2… not in a new local libSQL file, except where the service already runs on libSQL (projector)." Orchestration state is new PM state; the orchestration pass does not run on libSQL.agent.mirror_*,ci.events,agent.events+agent.quota_records, RETIRE-49). Full-text check: zero mentions of orchestration; file-based state has no table for a wave to move, and the plan does not classify it.pmp_linksbackup legs complete (PR feat(backup): archive pmp_links-only export on all three PM dashboard backup legs (#1744) #5315 merged 2026-11-05); pm stack: centralize all service data as shared tables in one database schema #1744 coordination satisfied by following its shared-schema conventions.The tension is named on #5005, not hidden: if Drew classifies orchestration state into a future Turso wave, these tables move by the same shadow → parity → flip pattern, and the file export remains the fallback until that flip verifies.
What lands
public.orch_runs— the run log (successor toorchestrator-log.md): one append-only row per orchestration pass carrying the complete export document, so the generatedorchestration.jsonis the newest run'sdocumentand the impl(aggregator): slice 2 — mobile, needs-Drew/needs-orchestrator tiers, time-granular roadmap, session clarity #898 dashboard shape is preserved by construction. Document-identity checks pindocument.runId/versionto the columns.public.orch_items— current tier/classification state: queryable columns (tiercheck-constrained toneedsDrew/needsOrchestrator, kind/state/reason/ref/since/last_seen) + the item verbatim in JSONB for the fields that stay render-level (horizon,question,recommendedAction). Run FKs withON DELETE RESTRICT;last_seen_at >= sinceenforced.service_roleappends/reads the log (no UPDATE/DELETE — history is not rewritable) and holds the replace set on the state table.ORCHESTRATION.md— the contract: field maps, the writer contract the cutover slice must follow (one transaction per pass: insert run → replace items → regenerate the file, which stays written every pass as export + rollback), and what this slice is not.test-orchestration-migration.sh— disposable PostgreSQL 16 test modeled ontest-migration.sh.Not in this slice (by design): no DDL applied to
muse-dev2, no rows copied, no writer/reader change — the files stay authoritative until the cutover slice verifies a pass reading its state back from the tables with the dashboard serving the generated export unchanged.Verification
bash pm-stack/shared-schema/test-orchestration-migration.shon the laptop: all probes pass — RLS/privilege shape,service_roleoperating under RLS, six constraint rejections (mismatched runId, mismatched version, unknown tier, item/document id mismatch, orphan run FK, last-seen before since), snapshot-replace carryingfirst_seen_run_idforward, down-migration guard on populated tables, clean rollback on empty ones.Queue task 14783 · lane code-g.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.