Skip to content

refactor(compat): move zod helpers to zodCompat.ts; throw on invalid …

0febd83
Select commit
Loading
Failed to load commit list.
Merged

feat(compat): registerTool/registerPrompt accept raw Zod shape, auto-wrap with z.object() #1901

refactor(compat): move zod helpers to zodCompat.ts; throw on invalid …
0febd83
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Apr 27, 2026 in 13m 51s

Code review found 2 potential issues

Found 6 candidates, confirmed 2. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 2
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit packages/core/test/util/standardSchema.test.ts:4-20 zodCompat tests left in standardSchema.test.ts after source split
🟡 Nit packages/core/src/util/zodCompat.ts:48-53 Runtime guard uses isStandardSchema, not isStandardSchemaWithJSON

Annotations

Check warning on line 20 in packages/core/test/util/standardSchema.test.ts

See this annotation in the file changed.

@claude claude / Claude Code Review

zodCompat tests left in standardSchema.test.ts after source split

nit: 0febd83 moved `isZodRawShape`/`normalizeRawShapeSchema` into `zodCompat.ts` per the review ask to keep `standardSchema.ts` library-agnostic, but the unit tests for them were added to `standardSchema.test.ts` (which now imports from `'../../src/util/zodCompat.js'`). The same cohesion rationale applies to the test file — consider moving the two new `describe` blocks to `packages/core/test/util/zodCompat.test.ts` so the test layout mirrors the source split.

Check warning on line 53 in packages/core/src/util/zodCompat.ts

See this annotation in the file changed.

@claude claude / Claude Code Review

Runtime guard uses isStandardSchema, not isStandardSchemaWithJSON

nit: the new runtime guard calls `isStandardSchema(schema)`, which only checks for `~standard.validate` — but the function returns `StandardSchemaWithJSON | undefined` and downstream (`standardSchemaToJsonSchema`, `promptArgumentsFromStandardSchema`) dereferences `schema['~standard'].jsonSchema`. A bare `StandardSchemaV1` (validate-only, no `jsonSchema` extension) still passes here and then throws a deferred TypeError on `tools/list`. Swap to `isStandardSchemaWithJSON(schema)` (already exported