Skip to content

feat(id): brand PartID through Drizzle and Zod schemas#16966

Merged
kitlangton merged 1 commit intodevfrom
feat/branded-part-id
Mar 11, 2026
Merged

feat(id): brand PartID through Drizzle and Zod schemas#16966
kitlangton merged 1 commit intodevfrom
feat/branded-part-id

Conversation

@kitlangton
Copy link
Contributor

@kitlangton kitlangton commented Mar 11, 2026

Stacked on #16964 (WorkspaceID).

Summary

  • Introduce Effect branded PartID type with .make(), .ascending(), and .zod statics
  • Flow PartID through Drizzle PartTable.id, PartBase.id zod schema, revert.partID, and server routes
  • Replace all Identifier.ascending("part") with PartID.ascending() across the session stack

Test plan

  • bun turbo typecheck passes
  • bun test passes

@kitlangton kitlangton force-pushed the feat/branded-workspace-id branch from ed64744 to d5c8a5e Compare March 11, 2026 13:30
@kitlangton kitlangton force-pushed the feat/branded-part-id branch from ead55c3 to 6e18851 Compare March 11, 2026 13:31
@kitlangton kitlangton force-pushed the feat/branded-workspace-id branch from d5c8a5e to 38743b8 Compare March 11, 2026 13:55
@kitlangton kitlangton force-pushed the feat/branded-part-id branch from 6e18851 to aba9bb0 Compare March 11, 2026 13:55
@kitlangton kitlangton changed the title feat(session): brand PartID through Drizzle and Zod schemas feat(id): brand PartID through Drizzle and Zod schemas Mar 11, 2026
@kitlangton kitlangton force-pushed the feat/branded-workspace-id branch from 38743b8 to 672c2ed Compare March 11, 2026 23:08
@kitlangton kitlangton force-pushed the feat/branded-part-id branch 2 times, most recently from 484a3c7 to 7476637 Compare March 11, 2026 23:21
@kitlangton kitlangton force-pushed the feat/branded-workspace-id branch from 672c2ed to 0a80b9f Compare March 11, 2026 23:21
@kitlangton kitlangton marked this pull request as ready for review March 11, 2026 23:29
Base automatically changed from feat/branded-workspace-id to dev March 11, 2026 23:30
- 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
@kitlangton kitlangton force-pushed the feat/branded-part-id branch from 7476637 to 0cdc6f0 Compare March 11, 2026 23:31
@kitlangton kitlangton enabled auto-merge (squash) March 11, 2026 23:32
@kitlangton kitlangton merged commit 090f636 into dev Mar 11, 2026
8 checks passed
@kitlangton kitlangton deleted the feat/branded-part-id branch March 11, 2026 23:40
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant