Skip to content

feat(core): add shard-routable run-ops id format and resolveShard - #4750

Merged
d-cs merged 2 commits into
mainfrom
feat/core-gen-2-id-tri-13423
Aug 21, 2026
Merged

feat(core): add shard-routable run-ops id format and resolveShard#4750
d-cs merged 2 commits into
mainfrom
feat/core-gen-2-id-tri-13423

Conversation

@d-cs

@d-cs d-cs commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a second generation of run-ops id, plus the resolver that reads a store key straight out of an id. A gen-2 id keeps the existing 26-character layout, but the character at index 24 becomes a routing shard key instead of a region code, and the version character at index 25 becomes "2". Nothing mints gen-2 ids yet, so this is inert on merge.

Design

The version character is a single character, so the gen-1 and gen-2 shape checks can never both match. That is what makes the two generations provably disjoint rather than disjoint by convention.

resolveShard(id) // gen-2 body    -> its shard key, [a-z0-9]
                 // gen-1 v1 body -> "new"
                 // anything else -> "legacy"

resolveShard is total: it returns a key for any input string, including an empty or malformed one, and never throws. classifyResidency keeps its signature and its two values, and now reports gen-2 ids as part of the dedicated family, so existing consumers of that boolean are unaffected.

The body stays 26 characters rather than 27 deliberately. The older 27-character format is still in the wild and has to keep resolving to legacy, and a longer gen-2 shape would need probabilistic disambiguation against it. A rare misroute is not an acceptable property for a routing key.

The one behavior change is that a 26-character body ending in "2" now routes by its shard key instead of falling back to legacy. Two test assertions pinned the old result and are updated here. A repository-wide search confirms they are the only two of their kind.

Verified against the full run-store corpus (68 files, 370 tests) with no test-file changes there, plus the run-engine residency and waitpoint suites. No changeset: the new surface has no caller, so a version bump would tell a user nothing.

@changeset-bot

changeset-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f229dda

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The change adds version-2 run-ops IDs with validated shard characters, shared timestamp handling, parsing, and generation. parseRunId now recognizes both gen-1 and gen-2 formats. Residency resolution routes gen-2 IDs by shard, gen-1 IDs to the new store, and other IDs to legacy storage. Tests cover validation, ordering, uniqueness, classification, malformed inputs, and compatibility between identifier generations.

Merge Risk: 🔵 Low · up to da7eb

The PR adds inert gen-2 run-ops ID parsing and shard resolution without a production caller, but new test paths still use mocked system time and omit required crumb markers; it is mergeable with explicit owner follow-up on these bounded concerns.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change and testing, but it omits the required issue link, checklist, changelog, and screenshots sections. Add the required template sections, complete the checklist, link the issue, and document testing and changelog details.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the new shard-routable run-ops ID format and the resolveShard function.
Docstring Coverage ✅ Passed Docstring coverage is 92.31% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 4 files.
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 feat/core-gen-2-id-tri-13423

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@d-cs d-cs self-assigned this Aug 21, 2026
coderabbitai[bot]

This comment was marked as resolved.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@d-cs
d-cs force-pushed the feat/core-gen-2-id-tri-13423 branch from 5c36a45 to 70a3df0 Compare August 21, 2026 10:28
@pkg-pr-new

pkg-pr-new Bot commented Aug 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

@trigger.dev/build

npm i https://pkg.pr.new/@trigger.dev/build@f229dda

trigger.dev

npm i https://pkg.pr.new/trigger.dev@f229dda

@trigger.dev/core

npm i https://pkg.pr.new/@trigger.dev/core@f229dda

@trigger.dev/python

npm i https://pkg.pr.new/@trigger.dev/python@f229dda

@trigger.dev/react-hooks

npm i https://pkg.pr.new/@trigger.dev/react-hooks@f229dda

@trigger.dev/redis-worker

npm i https://pkg.pr.new/@trigger.dev/redis-worker@f229dda

@trigger.dev/rsc

npm i https://pkg.pr.new/@trigger.dev/rsc@f229dda

@trigger.dev/schema-to-json

npm i https://pkg.pr.new/@trigger.dev/schema-to-json@f229dda

@trigger.dev/sdk

npm i https://pkg.pr.new/@trigger.dev/sdk@f229dda

commit: f229dda

Comment thread packages/core/src/v3/isomorphic/friendlyId.test.ts Outdated
coderabbitai[bot]

This comment was marked as resolved.

d-cs added 2 commits August 21, 2026 12:48
A gen-2 id keeps the 26-char layout but carries a routing shard key at
index 24 and version "2" at index 25, so a store can be picked from the
id alone with no directory lookup. The version char is one character, so
the v1 and gen-2 shape checks are mutually exclusive by construction.

resolveShard is total: a gen-2 body returns its shard key, a v1 body
returns "new", and everything else returns "legacy" without throwing.
classifyResidency keeps its signature and now reports gen-2 ids as part
of the dedicated family.

Nothing mints gen-2 ids yet. The only behavior change is that a 26-char
body ending in "2" now routes by its shard key instead of falling back
to legacy.
@d-cs
d-cs force-pushed the feat/core-gen-2-id-tri-13423 branch from da7ebab to f229dda Compare August 21, 2026 11:49
@d-cs
d-cs marked this pull request as ready for review August 21, 2026 11:49
@d-cs
d-cs merged commit c5c2ea9 into main Aug 21, 2026
66 checks passed
@d-cs
d-cs deleted the feat/core-gen-2-id-tri-13423 branch August 21, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants