flux-pr-5574
Zod (TypeScript) · W2 · GPT-5.3 Codex
Tests passed. 2/2 commands passed. Strength: weak.
pnpm buildnpx vitest run packages/zod/src/v4/classic/tests/registries.test.ts -t "re\-registering\ same\ id\ silently\ overwrites|toJSONSchema\ throws\ on\ duplicate\ id\ across\ different\ schemas|toJSONSchema\ allows\ same\ schema\ with\ same\ id"Partial score: 2/2
Trajectory
unknown · partial order onlyCanonical trajectory missing; showing coarse derived order only.
Quality
Equivalence Reasoning
stylistic
The patch removes registry-time duplicate-ID rejection and shifts duplicate detection to JSON Schema conversion when multiple registry entries are emitted together. It allows duplicate IDs at registration, and conversion now throws when the same ID maps to different schemas, matching the task intent via a different internal design (`Map<string, Set<Schema>>` + conversion-time check).
Code Review
The patch partially meets the goal (registration no longer rejects duplicate IDs and registry conversion now checks for duplicates), but it appears narrower than intended and introduces a concrete edge-case bug in ID cleanup logic.
The new duplicate check is scoped to `toJSONSchema` when input is a registry (`registry._idmap` pass). This does not implement duplicate-ID detection in the shared multi-schema extraction flow, so distinct schemas with the same ID can still evade this guard outside that specific path.
Re-registration/removal cleanup uses truthy checks (`if (prevId)` and `if (id)`), so an empty-string ID is not removed from `_idmap`/`_schemaIdMap`. This can leave stale mappings and produce incorrect conversion behavior.