feat(compat): registerTool/registerPrompt accept raw Zod shape, auto-wrap with z.object() #1901
Claude / Claude Code Review
completed
Apr 27, 2026 in 44m 12s
Code review found 1 potential issue
Found 2 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 1 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | packages/core/src/util/zodCompat.ts:39-44 |
isZodRawShape vacuously accepts arrays / non-plain objects, silently bypassing the line-66 guard |
Annotations
Check warning on line 44 in packages/core/src/util/zodCompat.ts
claude / Claude Code Review
isZodRawShape vacuously accepts arrays / non-plain objects, silently bypassing the line-66 guard
nit: dropping the `values.length > 0` check (for the `{}` fix) means `isZodRawShape` now vacuously accepts any object with no own enumerable properties — `[]`, `[z.string()]`, `new Date()`, `new Map()`, `/regex/` all return `true`, get wrapped as `z.object({})` (or `z.object({'0': zString})` for the array), and silently bypass the line-66 `TypeError` that was added per review for JS/`as any` callers. Same posture as the still-open `null` case on line 61, but with a *silent* failure mode instead
Loading