Skip to content

feat(id): brand MessageID through Drizzle and Zod schemas#16956

Merged
kitlangton merged 3 commits intofeat/branded-session-idfrom
feat/branded-message-id
Mar 11, 2026
Merged

feat(id): brand MessageID through Drizzle and Zod schemas#16956
kitlangton merged 3 commits intofeat/branded-session-idfrom
feat/branded-message-id

Conversation

@kitlangton
Copy link
Contributor

@kitlangton kitlangton commented Mar 11, 2026

Stacked on #16953 (SessionID).

Summary

  • Introduce Effect branded MessageID type with .make(), .ascending(), and .zod statics
  • Flow MessageID through Drizzle columns and Zod schemas across session logic, message-v2, prompt, compaction, tools, server routes, and CLI
  • Brand plain strings at boundaries (CLI args, SDK types, HTTP params) via MessageID.make()

Test plan

  • bun turbo typecheck passes
  • bun test passes

@kitlangton kitlangton marked this pull request as ready for review March 11, 2026 02:46
@kitlangton kitlangton marked this pull request as draft March 11, 2026 02:56
@kitlangton kitlangton removed the beta label Mar 11, 2026
@kitlangton kitlangton marked this pull request as ready for review March 11, 2026 03:04
opencode-agent bot added a commit that referenced this pull request Mar 11, 2026
Same pattern as ProjectID/SessionID: add branded MessageID type with
MessageID.zod and MessageID.ascending() helpers, type Drizzle columns
with $type<MessageID>(), and replace all Identifier.schema("message")
and z.string() usages. Brand flows through z.infer automatically.
- Replace MessageID.make(Identifier.ascending("message")) with MessageID.ascending()
- Remove as any casts in import.ts by destructuring out column-stored fields
- Revert unrelated account.ts changes
@kitlangton kitlangton force-pushed the feat/branded-message-id branch from 3b865e2 to 2ca9fb5 Compare March 11, 2026 03:19
opencode-agent bot added a commit that referenced this pull request Mar 11, 2026
opencode-agent bot added a commit that referenced this pull request Mar 11, 2026
opencode-agent bot added a commit that referenced this pull request Mar 11, 2026
opencode-agent bot added a commit that referenced this pull request Mar 11, 2026
opencode-agent bot added a commit that referenced this pull request Mar 11, 2026
opencode-agent bot added a commit that referenced this pull request Mar 11, 2026
opencode-agent bot added a commit that referenced this pull request Mar 11, 2026
opencode-agent bot added a commit that referenced this pull request Mar 11, 2026
opencode-agent bot added a commit that referenced this pull request Mar 11, 2026
opencode-agent bot added a commit that referenced this pull request Mar 11, 2026
The rebase dropped the MessageID test fix. Tests were using plain
strings ("test-id", "parent-id") which fail zod's startsWith("msg")
validation.
@kitlangton kitlangton changed the title feat(session): brand MessageID through Drizzle and Zod schemas feat(id): brand MessageID through Drizzle and Zod schemas Mar 11, 2026
@kitlangton kitlangton merged commit b38a9c1 into feat/branded-session-id Mar 11, 2026
8 checks passed
@kitlangton kitlangton deleted the feat/branded-message-id branch March 11, 2026 20:45
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