Skip to content

feat(id): brand SessionID through Drizzle and Zod schemas#16953

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

feat(id): brand SessionID through Drizzle and Zod schemas#16953
kitlangton merged 11 commits intodevfrom
feat/branded-session-id

Conversation

@kitlangton
Copy link
Contributor

@kitlangton kitlangton commented Mar 11, 2026

Stacked on #16948 (ProjectID).

Summary

  • Introduce Effect branded SessionID type with .make(), .descending(), and .zod statics
  • Flow SessionID through Drizzle columns (SessionTable.id, session_id FKs, parent_id)
  • Replace all Identifier.schema("session") and sessionID: z.string() with SessionID.zod
  • Brand plain strings at boundaries (CLI args, imported data) via SessionID.make()

Test plan

  • bun turbo typecheck passes
  • bun test passes

@kitlangton kitlangton marked this pull request as ready for review March 11, 2026 02:19
@kitlangton kitlangton changed the title Brand SessionID through Drizzle and Zod schemas feat(id): brand SessionID through Drizzle and Zod schemas Mar 11, 2026
Base automatically changed from feat/session-id-brand to dev March 11, 2026 20:44
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: add branded SessionID type with
SessionID.zod helper, type Drizzle columns with $type<SessionID>(),
and replace all z.string()/Identifier.schema("session") usages.
Brand flows through z.infer automatically, mapped at boundaries.
- import.ts: inline SessionID.make() in toRow spread, use row.id for session_id
- export.ts: brand sessionID at CLI arg boundary, remove redundant as string cast
SessionID.make("test-session") and MessageID.make("test-id") bypass
zod validation but safeParse still checks startsWith prefixes at
runtime. Use the proper constructors that generate valid prefixed IDs.
@kitlangton kitlangton force-pushed the feat/branded-session-id branch from b38a9c1 to 860610c Compare March 11, 2026 23:08
@kitlangton kitlangton enabled auto-merge (squash) March 11, 2026 23:14
@kitlangton kitlangton merged commit cb67465 into dev Mar 11, 2026
8 checks passed
@kitlangton kitlangton deleted the feat/branded-session-id branch March 11, 2026 23:16
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