Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Commit 6732df4

Browse files
os-warrenclaude
andauthored
fix(types): the import boundary keeps the descriptions it imports (objectui#9034) (#9086)
* fix(types): the import boundary keeps the descriptions it imports (objectui#9034) `stripImportedDefaults` dropped the `.describe()` of every schema it derived. A zod 4 description is registry state keyed by the node, not `def` state, so neither derivation carried it: `.removeDefault()` returns the inner node, and the protocol spells its guidance `.default(v).describe(d)` — `d` sat on the outer node that was discarded; and `cloneWithDef` builds `new Ctor({...def})`, which copies `def.checks` faithfully and the description not at all. Measured across the published surface of @objectstack/spec 17.4.0: 2024 of 2024 described ZodDefault nodes and 1364 described container nodes arrived on this side with no description. Both now go through one rule, `withDescriptionOf`, and 0 are lost. The identity property is untouched: reference-equal node count across the same surface is 9665 before and 9665 after. The carry uses `.describe()` rather than a write to `_zod.parent` because it must CLONE — on the `.optional().default()` branch, taken 267 times, the replacement node is one of the spec's own objects. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jmxdo7bmeqCQHLSfmLVX9w * test(types): point the rest-less-tuple carve-out at the card it was filed as The carve-out in the identity-property pin referenced a placeholder number while the finding was still unfiled. It is objectui#9088. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jmxdo7bmeqCQHLSfmLVX9w --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7e50e84 commit 6732df4

3 files changed

Lines changed: 554 additions & 6 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@object-ui/types': patch
3+
---
4+
5+
`stripImportedDefaults` no longer drops the `.describe()` of the schemas it imports from `@objectstack/spec`.
6+
7+
A zod 4 description is registry state keyed by the node, not `def` state, so neither of the boundary's two derivations carried it: `.removeDefault()` returns the inner node (the protocol spells its guidance `.default(v).describe(d)`, so `d` sat on the outer node that was discarded), and `cloneWithDef` builds `new Ctor({...def})`, which copies `def.checks` faithfully and the description not at all. Measured across spec 17.4.0: 2024 of 2024 described `ZodDefault` nodes and 1364 described container nodes reached this package with no description; after the fix, 0 are lost.
8+
9+
Both derivations now go through one rule, `withDescriptionOf`. The identity property is unchanged — a subtree with no `ZodDefault` in it still comes back reference-equal, and the count of reference-equal nodes across the published spec surface is the same before and after.

0 commit comments

Comments
 (0)