feat(run-ops): read presenters — de-join control-plane relations + read-through hydration#4122
Conversation
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (11)
|
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title is concise and clearly summarizes the main read-through/de-join presenter change. |
| Description check | ✅ Passed | The description is mostly complete and aligns with the template, with clear What/Why/Tests/Notes sections. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✨ Finishing Touches
📝 Generate docstrings
- Create stacked PR
- Commit on current branch
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Commit unit tests in branch
runops/pr08-presenters
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.
Comment @coderabbitai help to get the list of available commands.
5de29cb to
5c2d010
Compare
9b6eee8 to
94eaef6
Compare
@trigger.dev/build
trigger.dev
@trigger.dev/core
@trigger.dev/python
@trigger.dev/react-hooks
@trigger.dev/redis-worker
@trigger.dev/rsc
@trigger.dev/schema-to-json
@trigger.dev/sdk
commit: |
8fb6e8a to
4e08dc7
Compare
6e4c0de to
48c395b
Compare
4e08dc7 to
11dc0b7
Compare
f8b64bd to
e145839
Compare
11dc0b7 to
a9bc9e6
Compare
e145839 to
6cd0085
Compare
a9bc9e6 to
277ecea
Compare
6cd0085 to
5ccf63f
Compare
277ecea to
2bba3b8
Compare
f7cf260 to
d31f2e9
Compare
0f1da3f to
5a17a98
Compare
d31f2e9 to
4bfd808
Compare
5a17a98 to
6b7fb6d
Compare
4bfd808 to
9197016
Compare
6b7fb6d to
ac94ac3
Compare
9197016 to
fa0d473
Compare
ac94ac3 to
62ce160
Compare
fa0d473 to
50463ce
Compare
62ce160 to
2be7e51
Compare
50463ce to
e33cfc4
Compare
5189c23 to
15d6987
Compare
3538e4e to
e497155
Compare
15d6987 to
4862283
Compare
e497155 to
ef571f9
Compare
4862283 to
abb6c01
Compare
ef571f9 to
766138c
Compare
a4deee1 to
7ed8483
Compare
…ad-through hydration Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- readRedirectMarker fails open on an unprovisioned marker table (undefined_table): the known-migrated read optimization must never break the run-list read path when the marker table is absent. - expose runOps new/legacy handles through the db.server test seam so the routed-store reads resolve to the real containers. - hoist the runStore ref so the vi.mock factory no longer hits a TDZ. - correct the getActivity bucket expectation: a 6h window buckets into 72 five-minute buckets (chooseBucketSeconds targets ~72), not 6. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… only Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…r09 presenters
Comment/label hygiene pass over the PR09 presenter read-routing work. No
product logic, assertions, seeds, or test structure changed — only comment
text and test/it titles.
- Remove the SPLIT-NEUTRAL scaffolding comment on TaskDetailPresenter.getActivity.
- Drop `// --- ... ---` comment fencing across the touched test files, keeping
the behavioral text.
- Strip Task/Step enumeration prefixes from comments and it/test titles, keeping
the behavioral descriptions.
- Remove Definition-of-Done ("DoD") framing and RED/GREEN TDD phase commentary.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tPresenter hydrate select GET /api/v1/waitpoints/tokens/:id returned HTTP 500 under split routing. The hydrate() select in ApiWaitpointPresenter included the connectedRuns RELATION, but it is never referenced in the returned object (all scalars) — dead code left over from the presenters de-join pass (48ae62b70), which stripped relations from WaitpointListPresenter but missed this one. Under split routing a standalone cuid token classifies LEGACY, so readThroughRun probes the scalar-only run-ops NEW client FIRST. The dedicated run-ops Waitpoint model is scalar-only (relations de-normalized), so Prisma threw PrismaClientValidationError: Unknown field connectedRuns before the legacy fallback could run. Removing the block makes the select all-scalar and valid against both the control-plane client and the scalar-only run-ops-new client. No return-shape, type, or SDK change. Regression test: extends apiWaitpointPresenter.readthrough.test.ts with a heteroRunOpsPostgresTest case that uses the REAL scalar-only run-ops client (prisma17) as the split-mode NEW client and seeds a cuid token on the legacy side. Fails before the fix (Unknown field connectedRuns), passes after (resolves via the legacy fallback). Not caught by the existing heteroPostgresTest cases because those run the full control-plane schema on both sides. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…d-through presenter design
The pr04-era ApiBatchResultsPresenter.split.test.ts asserted a bare
`new ApiBatchResultsPresenter()` routes the batch-row lookup through the
runStore singleton (via vi.mock("~/v3/runStore.server")) so a NEW-resident
ksuid batch resolves. pr08's call() supersedes that contract: a bare
presenter has readThrough === undefined, so splitEnabled is false and it
takes #callPassthrough, which reads this._replica.batchTaskRun directly
(not through runStore). The test therefore fails against pr08 and encodes a
design that no longer exists.
Both cases it covered are already covered by pr08's own
apiBatchResultsPresenter.readthrough.test.ts against the current #callSplit
API: (a) a NEW-resident batch resolving under split (batch row + items on the
NEW DB, resolved via newClient) and (b) a genuinely-missing batch returning
undefined (split on). Remove the redundant, superseded test.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…epair read-side test shims - WaitpointPresenter: default omitted read-through clients to the presenter's own replica instead of the global run-ops singletons, so single-DB/self-host reads hydrate the waitpoint and its connected runs from one DB. - SpanPresenter test: bind proxy-returned store methods to the target so private field access holds for all methods (e.g. findRunOnPrimary), not just findRun/findRuns. - ApiRetrieveRunPresenter read-route test: select scalar lockedToVersionId and fold the resolved lockedToVersion per node, matching the presenter's current shape. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… testcontainer The RunStore singleton is built once at import and its error-normalizing wrapper memoizes each Prisma model delegate on first access. The test's delegating proxy returned current.taskRun directly, so the store cached the first test's container-bound delegate and later tests (fresh containers) failed with "Database test_0 does not exist". Object-valued delegates now return a stable per-key sub-proxy the store can safely cache, re-delegating to the live current client on each access. Production code is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…c empty CH window Two webapp unit-test shards were red on this branch: - Shard 6 (apiRetrieveRunPresenter.readroute.test.ts): the organizationDataStoresRegistry singleton is constructed at import (pulled in transitively via the ClickHouse factory instance) and immediately fires a `forever` pRetry(loadFromDatabase) plus a setInterval reload against db.server's $replica. In CI (no Postgres on localhost) those retry forever and saturate the worker event loop, timing out an awaiting test's hook. Mock the instance module to a no-op in test/setup.ts, mirroring the other eager-singleton stubs. No unit test uses this singleton — the registry-behavior tests construct the class directly — so this is safe and should also help other shards/branches that import the presenter graph. - Shard 2 (nextRunListPresenter.readthrough.test.ts): the two empty-state tests seeded a run then assumed it had NOT yet replicated to ClickHouse within the page window, so result.runs would be empty. That held on a slow local stack but raced on CI, where replication had completed and the run surfaced (length 1, not 0). Scope those two calls to a `to` one hour in the past; the CH page filters created_at <= to, so a just-created run is deterministically excluded regardless of replication timing. The PG existence probe has no time filter, so it still finds the row and hasAnyRuns stays true — the exact behavior each test verifies. Reproduced both failures and verified the fix under a CI-faithful env (DATABASE_URL + REDIS at dead ports, GITHUB_ACTIONS=true, --no-file-parallelism): shard 2 now 18 files / 118 tests green, shard 6 now 16 files / 212 tests green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…NEW-resident batch Adds the route-level sibling of the other readroute presenter tests. Seeds a NEW-resident (ksuid) batch + member on the NEW store and asserts the presenter wired as the route wires it (splitEnabled + newClient + legacyReplica) resolves it, while a passthrough-only build of the same presenter returns undefined -- the exact 404 the route produced before the fix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7ed8483 to
77236dd
Compare
…n's client In passthrough mode (readRoute provided but splitEnabled false) the empty-state probe read runOpsNew while the page scan reads _replica, so a configured-but-read-disabled run-ops DB could make the 'no batches' hint disagree with the page. Gate the probe on splitEnabled first. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What
Reworks the read-side presenters so they no longer depend on control-plane relations being co-located with the run subgraph. This is a read-path-only change — no writes, no schema, no runtime flag flips.
For every presenter that previously joined across what is becoming a database boundary, the join is removed from the primary query and the missing data is instead hydrated per-run through the run store. The pattern is a pair of internal helpers (
#callSplit/#callPassthrough): when the split is active, the presenter selects only scalar/id-shaped columns from the primary query and hydrates the run-subgraph fields via a read-through lookup; when it isn't, it falls back to the existing passthrough path. Presenters key their behaviour on id-shape only — they don't consult a per-record "known-migrated" flag.Presenters touched:
ApiBatchResultsPresenter,ApiRetrieveRunPresenter,ApiRunListPresenter,ApiRunResultPresenterApiWaitpointPresenter,ApiWaitpointListPresenter,WaitpointPresenter,WaitpointListPresenter,WaitpointTagListPresenterBatchPresenter,BatchListPresenter,NextRunListPresenterRunPresenter,RunStreamPresenter,SpanPresenter,TestTaskPresenterA dead
connectedRunsrelation is dropped from theApiWaitpointPresenterhydrate select.New read-through / read-route tests cover each presenter under both the split-active and passthrough paths. A superseded
ApiBatchResultsPresenter.split.test.tsis removed and the remainingApiBatchResultsPresenter.test.tstrimmed — its coverage is subsumed by the newapiBatchResultsPresenter.readthroughsuite.Why
Part of the run-ops database split. This is PR8 of the series (PR8/9/10) and covers the read path only: it makes presenters correct against a split store before any routes are switched to route reads (PR9) or the split is actually enabled (PR10). Landing the read-side rework on its own keeps the behaviour-changing activation isolated at the top of the stack.
Tests
pnpm run test --filter webappfor the affected presenter suites. New suites exercise both the split-active read-through path and the passthrough path for each reworked presenter.Notes
Draft, stacked on #4119 (
runops/pr07-replication). Review that first; this diff is against it.Server-change / changeset note to be added at stack-assembly time.
🤖 Generated with Claude Code