Skip to content

feat(id): brand WorkspaceID through Drizzle and Zod schemas#16964

Merged
kitlangton merged 7 commits intodevfrom
feat/branded-workspace-id
Mar 11, 2026
Merged

feat(id): brand WorkspaceID through Drizzle and Zod schemas#16964
kitlangton merged 7 commits intodevfrom
feat/branded-workspace-id

Conversation

@kitlangton
Copy link
Contributor

@kitlangton kitlangton commented Mar 11, 2026

Stacked on #16956 (MessageID).

Summary

  • Introduce Effect branded WorkspaceID type with .make(), .ascending(), and .zod statics
  • Flow WorkspaceID through Drizzle columns (WorkspaceTable.id, SessionTable.workspace_id), WorkspaceContext, and server boundaries
  • Brand plain strings at boundaries (HTTP query params, headers, imports) via WorkspaceID.make()

Test plan

  • bun turbo typecheck passes
  • bun test passes

@kitlangton kitlangton force-pushed the feat/branded-message-id branch from 3b865e2 to 2ca9fb5 Compare March 11, 2026 03:19
@kitlangton kitlangton force-pushed the feat/branded-workspace-id branch 2 times, most recently from d5c8a5e to 38743b8 Compare March 11, 2026 13:55
@kitlangton kitlangton changed the title feat(workspace): brand WorkspaceID through Drizzle and Zod schemas feat(id): brand WorkspaceID through Drizzle and Zod schemas Mar 11, 2026
Base automatically changed from feat/branded-message-id to feat/branded-session-id March 11, 2026 20:45
@kitlangton kitlangton force-pushed the feat/branded-session-id branch from b38a9c1 to 860610c Compare March 11, 2026 23:08
@kitlangton kitlangton force-pushed the feat/branded-workspace-id branch from 38743b8 to 672c2ed Compare March 11, 2026 23:08
@kitlangton kitlangton marked this pull request as ready for review March 11, 2026 23:15
Base automatically changed from feat/branded-session-id to dev March 11, 2026 23:16
Introduce Effect branded ProjectID type into Drizzle table columns
and Zod schemas so the brand flows through z.infer automatically.
Adds ProjectID.zod helper to bridge Effect brands into Zod,
eliminating manual Omit & intersect type overrides.
- Remove unnecessary WorkspaceInfoType alias import
- Use input.projectID instead of config.projectID in workspace create
- Compare against ProjectID.global instead of String coercion in test
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
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 force-pushed the feat/branded-workspace-id branch from 672c2ed to 0a80b9f Compare March 11, 2026 23:21
@kitlangton kitlangton enabled auto-merge (squash) March 11, 2026 23:22
@kitlangton kitlangton merged commit 16a6d6f into dev Mar 11, 2026
8 checks passed
@kitlangton kitlangton deleted the feat/branded-workspace-id branch March 11, 2026 23:30
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
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