feat(id): brand PartID through Drizzle and Zod schemas#16966
Merged
kitlangton merged 1 commit intodevfrom Mar 11, 2026
Merged
Conversation
ed64744 to
d5c8a5e
Compare
ead55c3 to
6e18851
Compare
2 tasks
d5c8a5e to
38743b8
Compare
6e18851 to
aba9bb0
Compare
38743b8 to
672c2ed
Compare
484a3c7 to
7476637
Compare
672c2ed to
0a80b9f
Compare
- Introduces Effect branded PartID type in session/schema.ts
with .make(), .ascending(), and .zod statics
- Flows PartID through Drizzle PartTable.id, PartBase.id zod schema,
revert.partID, server routes, and all call sites
- Replaces all Identifier.ascending("part") with PartID.ascending()
- Updates tests to use proper branded IDs
7476637 to
0cdc6f0
Compare
demostanis
pushed a commit
to demostanis/opencode
that referenced
this pull request
Mar 19, 2026
demostanis
pushed a commit
to demostanis/opencode
that referenced
this pull request
Mar 20, 2026
CybLow
added a commit
to CybLow/opencode
that referenced
this pull request
Mar 23, 2026
…validation crash Plugins that hook into chat.message can push new parts into the parts array with non-compliant IDs (missing the required prt prefix). This causes Session.updatePart() to throw a ZodError since v1.2.25 when branded PartID validation was introduced (anomalyco#16966). After Plugin.trigger(chat.message) returns, re-assign any invalid part IDs with PartID.ascending() so misbehaving plugins cannot crash the core. Fixes anomalyco#18780
6 tasks
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.
Stacked on #16964 (WorkspaceID).
Summary
PartIDtype with.make(),.ascending(), and.zodstaticsPartIDthrough DrizzlePartTable.id,PartBase.idzod schema,revert.partID, and server routesIdentifier.ascending("part")withPartID.ascending()across the session stackTest plan
bun turbo typecheckpassesbun testpasses