Repository navigation
feat(pm-service): PM tenant store schema + migrations (component A slice 1, #12825) - #13054
Merged
Merged
Conversation
…ice 1, #12825) New pm-stack/pm-service package (PM service, Workers edition — component A of #9078, design §8 slice 1). The tenant store is one schema in the tenant's Turso DB (component E tenant plane): - migrations/0001_pm_tenant_store.sql: board registry rows (#9060 §1 BoardDef as data), collector snapshots, the merged item pool, hierarchy/link records (#9060 §11), Metadata copies (#9060 §12), roadmap rows, milestones + release close-out snapshots (#9060 §4), reconcile findings, and the writer-of-record lease row (design §5). - migrate.ts: version-ordered runner; each migration applies in a transaction and is recorded in pm_schema_migrations (the schema version record); recorded-name drift fails loudly. - schema.ts: the wire shapes + validators the store holds, mirrored field-for-field from #9060 and the laptop collector's landed output types (aggregator model.ts / board-registry.ts). - test/tenant-store.test.ts: 15 conformance tests (45 assertions) against bun:sqlite — migration idempotence + drift, the landed board registry round-trip, pool-item byte-faithful JSON with extracted keys, §11 until/reason fencing, the §12 example block, lease fencing, §4 accounting checks, and the E §2.3 guard: no token/key/secret/credential column in any table. Suite wired into pm-stack-tests.yml (nightly) in the same assert-exists style as the decision-events-worker suite, and registered in .github/test-suite-registry.json. No dependency on E1 (#12796): that is the central tenancy DB schema, a different plane — these migrations target a per-tenant DB only and neither read nor write the tenancy DB.
|
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 17 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: ✅ CompletedThis 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. |
dezren39
added a commit
that referenced
this pull request
Nov 23, 2026
…st + IngestDO (component A slice 2, #12826) Stacked on slice 1 (PR #13054): the collector imports the tenant store's SqlDb surface and lands rows in the tables slice 1's migration defines (pm_boards registry in, pm_snapshots/pm_items/ pm_item_metadata/pm_reconcile_findings out); pm-stack/pm-service does not exist on main yet, so this branch bases on xaltha/12825-tenant-store and the PR retargets to main when #13054 merges. Per design §3 (doc/2026-11-23T03-22-03Z_design_pm-service-workers-edition): - pool.ts: the SAME GraphQL pool query the laptop collector runs (fields, views, parent, blockedBy/blocking, labels, milestones, subIssuesSummary), parameterized by board node id, plus the parser mapping it to the ProjectPoolItem/ProjectAudit shapes slice 1 pinned. A port, not an import — pm-service deploys as one Worker bundle; slice 8's conformance suite pins parity. - fetch.ts: one board's paginated snapshot fetch; the stored ETag rides page 1 as If-None-Match and a 304 ends the run with no page fetches and no writes; rate-budget headers captured. - ingest-do.ts: IngestDO, one per board — serializes the board's runs and holds its cursors (ETag/last-snapshot watermark) and GitHub rate-budget state. Derived state only (invariant 6). - store.ts: registry reads (validated BoardDefs), snapshot landing (per-board pool replacement, so a failed board keeps its prior pool), §12 Metadata-copy upserts, ingest findings. - collector.ts: runHostedCollector — per board, a per-org App installation token is minted through the injected tenancy seam, used for that board's fetch, and dropped; epic/spawn ancestry resolves over the MERGED pool so cross-board chains resolve; snapshots land with writer='hosted' + lease epoch provenance. Acceptance (test/collector.test.ts, 9 tests): a run ingests every registry board; a forced failure on one board leaves the other boards' pools intact and records an ingest-failure finding; cursors make a second run incremental (one conditional request per board, no writes); no token value persists in any tenant-DB table, DO state, or the run report (E §2.3, test-pinned). Plus cross-board epic resolution, Metadata copies, rate-budget deferral, and IngestDO serialization. Suite registered as pm-service.collector and the pm-stack-tests step renamed to cover both pm-service suites. Full package: 24 tests pass (15 slice-1 + 9 new), tsc --noEmit clean, both run in the sandbox with bun.
This was referenced Nov 23, 2026
impl(pm-stack): Workers dashboard surfaces — V1 parity list (component A slice 4, from #9079)
#12829
Open
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.
Component A slice 1 (design §8 item 1, under #9079): the PM tenant store — schema + migrations for the hosted PM service.
What lands
New package
pm-stack/pm-service(PM service, Workers edition) withsrc/tenant-store/:migrations/0001_pm_tenant_store.sql— one schema in the tenant's Turso DB (component E tenant plane) holding the full PM store per design §3: board registry rows (pm stack: multi-board hierarchy + full task genealogy #9060 §1BoardDef, stored as data), collector snapshots, the merged item pool, hierarchy/link records (pm stack: multi-board hierarchy + full task genealogy #9060 §11: relation, status, provenance), Metadata copies (pm stack: multi-board hierarchy + full task genealogy #9060 §12), roadmap rows, milestones + release-milestone close-out snapshots (pm stack: multi-board hierarchy + full task genealogy #9060 §4), reconcile findings, and the writer-of-record lease row (design §5:{board_id, writer, epoch, heartbeat_at}).migrate.ts— version-ordered migration runner; each migration applies in a transaction and is recorded inpm_schema_migrations(the schema-version record); a recorded name that drifts from the file on disk fails loudly. Runtime-agnostic over a minimalSqlDbsurface.schema.ts— the wire shapes the store holds (BoardDef,LinkRecord,PmMetadataBlock,WriterLease) + validators, mirrored field-for-field from pm stack: multi-board hierarchy + full task genealogy #9060 and the laptop collector's landed output types (pm-stack/aggregator/src/model.ts,board-registry.ts).sqlite.ts— bun:sqlite adapter for tests/local tooling (a tenant DB is SQLite-shaped wherever it lives; Turso/libSQL speaks the same dialect).Acceptance mapping (#12825)
PROJECT_BOARDSregistry entries round-trip as rows, aProjectPoolItemstores byte-faithful JSON with extracted keys, §11 historical/removed fencing (until + reason) is enforced by both validator and CHECK constraints, and the §12 worked-example Metadata block validates and round-trips.Sequencing note
No dependency on E1 (#12796): that issue is the central tenancy DB schema — a different plane. This slice neither reads nor writes the tenancy DB; siblings #12796/#12803 are untouched.
Evidence
bun testinpm-stack/pm-service: 15 pass, 0 fail, 45 assertions (run locally in the sandbox against bun:sqlite; the suite's venue is CI — see below).bun run typecheck: clean.pm-stack-tests.ymlin the same assert-exists style as the decision-events-worker suite, and registered in.github/test-suite-registry.jsonaspm-service.tenant-store.Closes #12825
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.