You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
registry.remove() deletes an id that now belongs to another schema, dropping it from toJSONSchema(registry) #6640
add() lets a later schema take over an id (#5574, pinned by the "re-registering same id silently overwrites" test), but remove() deletes _idmap[id] for any schema whose metadata carries that id, including one that no longer owns it:
Reproduced on main at 2bf7b06. The fix is a one-line guard in remove() (only delete the id entry when it still points at the schema being removed), with a test, on a branch since PRs are limited to collaborators: main...andrewstellman:zod:registry-remove-owner.
Found by Quality Playbook, an AI code-review tool, with Claude; I reviewed the change.
This implements the ownership guard proposed by andrewstellman: removing the previous ID owner preserves the replacement. The regression fails before and passes afterward, including repeated removal and JSON Schema export. Local remove/add timings were approximately 101/103 ns before/after, retained registry memory was unchanged, and gzip bundle growth was 7 bytes for classic and 8 for Mini.
All 8,323 tests, type checks, build, lint/format, and resolution/integration checks passed locally with Nub 0.8.3 and pinned Node 24.21.0; hooks were not bypassed. Performance numbers are local estimates, and hosted CI has not run. Prepared with AI assistance and verified locally.
Activity
anuj-hrcg commentedon Oct 1, 2026
Could a maintainer review this independent fix and cherry-pick it if suitable? GitHub denied my account permission to create an upstream PR.
Compare · Commit
This implements the ownership guard proposed by andrewstellman: removing the previous ID owner preserves the replacement. The regression fails before and passes afterward, including repeated removal and JSON Schema export. Local remove/add timings were approximately 101/103 ns before/after, retained registry memory was unchanged, and gzip bundle growth was 7 bytes for classic and 8 for Mini.
All 8,323 tests, type checks, build, lint/format, and resolution/integration checks passed locally with Nub 0.8.3 and pinned Node 24.21.0; hooks were not bypassed. Performance numbers are local estimates, and hosted CI has not run. Prepared with AI assistance and verified locally.