feat(core): id-shape residency classifier + ksuid mint primitives (run-ops split base)#4112
Conversation
🦋 Changeset detectedLatest commit: a2261e9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 28 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
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 due to trivial changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (7)
WalkthroughThis PR adds KSUID generation and decoding to 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
@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: |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…dlyId Production mints ksuid runs explicitly via generateKsuidId() at gated trigger sites; the mutable process-global only ever let tests puppet RunId/WaitpointId.generate() into ksuids and cannot express per-org behavior. Delete setKsuidMintEnabled/isKsuidMintEnabled and the flag branch; generateInternalId() and IdUtil now always mint cuid. Tests drive the ksuid path via generateKsuidId() directly, preserving the 25-vs-27 disjoint-length, k-sortability, uniqueness, and payload round-trip coverage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Consumer packages (e.g. @internal/zod-worker) typecheck core's source under a target below ES2020, where BigInt literals (123n) raise TS2737. Use BigInt(...) calls, which those targets accept.
Fall back to node:crypto webcrypto when globalThis.crypto is unavailable (Node 18.20), share the ksuid length constant with the residency classifier, and tighten the ksuid/residency tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
bde3714 to
a98ebac
Compare
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
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)
📜 Recent review details⏰ Context from checks skipped due to timeout. (8)
|
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title clearly summarizes the main additive change: residency classification plus KSUID minting primitives for the run-ops split. |
| Description check | ✅ Passed | The description covers the required What, Why, and Tests content and is mostly aligned with the template despite some missing template 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/pr01-core-residency
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.
…migration runner (#4113) ## What The **dedicated run-ops database** foundation for the split: a standalone Prisma package plus the infra to run and migrate it. - **`internal-packages/run-ops-database`** — a new Prisma package (`@internal/run-ops-database`) whose schema mirrors the run-execution tables that will live on the dedicated DB, with its own generated client, migrations, and migration runner. - **`prisma/schema.parity.test.ts`** — a parity test that guards the run-ops schema against drift from the control-plane schema for the mirrored tables. - **Docker** — a Postgres 17 service (`docker/Dockerfile.postgres17`, `docker/docker-compose.yml`) so the dedicated DB is available locally under the run-ops compose profile. - **Testcontainers** — hetero fixtures (PG14 legacy + PG17 dedicated) so later PRs can exercise cross-database behaviour with real containers rather than mocks. ## Why This is the **second PR in the run-ops split stack**, stacked on the core primitives. It stands up the dedicated database and its tooling. There is **no runtime wiring** into the webapp here — the app does not read or write this DB yet; that arrives in later PRs. On its own this PR only adds a package, a docker service, and test fixtures. ## Tests Schema-parity test for the run-ops schema; hetero testcontainer fixture smoke test. ## Notes - Draft, **stacked on #4112** (`runops/pr01-core-residency`). Review that one first; this diff is against it. - Server-change / changeset note to be added at stack-assembly time. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What
Foundation for the run-ops database split: an isomorphic id-shape residency classifier and the ksuid mint primitives, added to
@trigger.dev/coreunderv3/isomorphic.runOpsResidency.ts— classifies a run id by its shape: 25-char cuid →LEGACY, 27-char ksuid →NEW. Pure and environment-free (safe on both client and server).friendlyId.ts— ksuid mint primitives and id helpers.v3/isomorphic/index.ts.Why
This is the base of a stacked series implementing the run-ops DB split (routing run-execution data to a dedicated database by id-shape). Later PRs in the series consume this classifier and these primitives to route reads and writes across the two databases.
On its own this PR is purely additive — new isomorphic helpers with unit tests, no runtime wiring, and no behaviour change to existing code paths.
Tests
Unit tests for the classifier (
runOpsResidency.test.ts) and the id / mint primitives (friendlyId.test.ts).Notes
main; subsequent PRs in the series build on top of this one.@trigger.dev/corewill be added before this is marked ready for review.🤖 Generated with Claude Code