Conversation
…s.ts Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: miles-kt-inkeep <miles-kt-inkeep@users.noreply.github.com>
…nference drizzle-zod's createSelectSchema/createInsertSchema can't infer the TypeScript generic from jsonb().$type<ResolvedRef>(), falling back to a permissive anyOf union. Explicitly override ref with ResolvedRefSchema in both select and insert schemas for TriggerInvocation, ScheduledTriggerInvocation, DatasetRun, and EvaluationRun. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
There was a problem hiding this comment.
Clean, focused fix. The .extend({ ref: ResolvedRefSchema }) / ref: () => ResolvedRefSchema overrides are consistent with the existing pattern used by conversations, tasks, and contextCache. The OpenAPI snapshot correctly narrows both TriggerInvocation and ScheduledTriggerInvocation ref fields. Update schemas inherit the override through .partial() as expected.
There was a problem hiding this comment.
PR Review Summary
(0) Total Issues | Risk: Low
✅ Clean Review
This PR correctly fixes drizzle-zod's inability to infer TypeScript generics from jsonb().$type<ResolvedRef>() by explicitly extending schemas with ResolvedRefSchema.
What the PR does well:
- Precisely targeted: Only fixes schemas that are actually exposed in OpenAPI (
TriggerInvocation,ScheduledTriggerInvocation) - Follows established patterns: Uses the same
.extend({ ref: ResolvedRefSchema })approach used elsewhere in the codebase - Future-proofs insert schemas: Adds
refoverride toDatasetRunInsertSchemaandEvaluationRunInsertSchemafor consistency, even though their Select schemas aren't currently exposed in the API - OpenAPI snapshot validates the fix: Changes from permissive
anyOf: [string, number, boolean, null, object, array]to proper$ref: "#/components/schemas/ResolvedRef"
Verification notes:
- Confirmed
DatasetRunSelectSchemaandEvaluationRunSelectSchemado NOT need therefoverride because their routes are commented out / not used in any API endpoint - The fix is correctly scoped to only the schemas that appear in API responses
✅ APPROVE
Summary: Clean, well-targeted fix that addresses a drizzle-zod limitation for JSONB type inference. The PR correctly identifies which schemas need the override (those exposed in OpenAPI) and applies the fix consistently. Ship it! 🚀
Discarded (4)
| Location | Issue | Reason Discarded |
|---|---|---|
schemas.ts:1308 |
Missing ref override on DatasetRunSelectSchema |
Schema not exposed in OpenAPI - dataset-runs routes are commented out |
schemas.ts:1365 |
Missing ref override on EvaluationRunSelectSchema |
Schema not exposed in OpenAPI - EvaluationRunApiSelectSchema not used in any route |
schemas.ts:1151,1269,1298 |
Pattern diverges from Task/Conversation/ContextCache precedents | These precedents also don't expose ref in OpenAPI; the PR is correctly targeted to schemas that ARE exposed |
schemas.ts:1308,1365 |
Inconsistent override pattern across Select schemas | Not applicable - only schemas exposed in OpenAPI need the fix |
Reviewers (3)
| Reviewer | Returned | Main Findings | Consider | While You're Here | Inline Comments | Pending Recs | Discarded |
|---|---|---|---|---|---|---|---|
pr-review-standards |
0 | 0 | 0 | 0 | 0 | 0 | 0 |
pr-review-types |
1 | 0 | 0 | 0 | 0 | 0 | 1 |
pr-review-consistency |
3 | 0 | 0 | 0 | 0 | 0 | 3 |
| Total | 4 | 0 | 0 | 0 | 0 | 0 | 4 |
Note: All reviewer findings were discarded after verification that DatasetRunSelectSchema and EvaluationRunSelectSchema are not exposed in OpenAPI (routes commented out / schema not used).
8d1515c to
1cd775e
Compare




















Summary
reffields with explicitResolvedRefSchemain select and insert schemas forTriggerInvocation,ScheduledTriggerInvocation,DatasetRun, andEvaluationRunrefrenders as$ref: ResolvedRefinstead ofanyOf: [string, number, boolean, null, object, array]Context
Addresses review comment —
drizzle-zodcan't infer the TypeScript generic fromjsonb().$type<ResolvedRef>(), so it falls back to a maximally permissive schema. The fix follows the same pattern already used byconversations,tasks, andcontextCache.Test plan
pnpm --filter @inkeep/agents-api openapi:update-snapshotpasses$ref: "#/components/schemas/ResolvedRef"for bothTriggerInvocationandScheduledTriggerInvocation🤖 Generated with Claude Code