This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
Commit 4f0fbce
test(types): pair the objectui#9034 census default arm by the source's optin, not the output's type (#9532)
Part of #9103 — the **pairing half**, which is the whole of this round's
declared file surface. Two items the card also names sit in
`packages/types/src/zod/imported-defaults.ts`; that file is the SOURCE
this census measures, the dispatch fences it off, and correcting a
census is not a licence to move what it measures. They are listed under
**Acceptance notes** and #9103 stays open for them.
## The defect — and what it is not
⛔ **The repair objectui#9086 shipped is correct.** The card says so in
its own first line, and nothing here touches `stripImportedDefaults`.
What was narrow is the **instrument** and the integers it wrote into
prose.
The census decided which node was the stripped twin of a default's inner
type by reading the **output's** `def.type`. Re-derived from the source,
the `default` arm re-wraps **conditionally**:
```ts
const inner = walk(schema.removeDefault());
const next = isAlreadyOptional(inner) ? inner : z.optional(inner);
```
So on the `.optional().default()` spelling the output is a `ZodOptional`
**whether or not a wrap was added**. The old rule could not tell the two
apart, paired the spec's own `ZodOptional(T)` against `walk(T)`, matched
no child label, and **stopped**.
The repair branches on `optin` of the node `.removeDefault()` returns —
the same question `isAlreadyOptional` asks, on the only side that still
holds the answer.
## Premise check — re-measured at the current tree, ⛔ not carried from
the card
PR #9496 landed on `imported-defaults.ts` at 15:01:35Z today
(`8700d6d93700828eff4d6a8f145add8a0f1ac412`), and `git merge-base
--is-ancestor` puts it in this branch's base (exit 0; repo is not
shallow; a control commit 40 back also answers 0). So every figure below
was taken **after** it, and two of the card's are now stale.
**Corpus measured before anything in it:** `@objectstack/spec`
**17.4.0**, 17/17 subpaths, **1635** schema roots; `zod` resolves to
`node_modules/.pnpm/zod@4.4.3/...` — ⭐ not the `zod@3.25.76` copy that
also ships a `v4/` directory. The subpath count is read out of the
spec's own `exports` map and asserted non-vacuous, so a probe aimed at
the wrong tree fails the corpus self-test rather than returning a
plausible number.
## The republished figures
All taken at **`0079b6d88d`** (this PR's head, clean tree), spec 17.4.0,
zod 4.4.3. Re-derived on that head after the second commit rather than
carried from the first — the figures are byte-for-byte the ones below,
which is a measurement and not the argument that a comment-only commit
cannot move them. Re-derive them live with:
```
pnpm --filter @object-ui/types exec vitest run --root=../.. --reporter=verbose \
packages/types/src/__tests__/imported-defaults-describe-9034.test.ts
```
| figure | superseded rule (what #9034's prose published) | corrected
rule | card predicted |
|---|---|---|---|
| misaligned pairs | **394** (all 394 stopped the walk) | **0** | 394 /
394 ✅ |
| nodes visited | 16,029 | **16,351** | — |
| reference-equal nodes | 9,605 | **10,011** | 9,665 → 10,079 1 parent 0e2ddd4 commit 4f0fbce
2 files changed
Lines changed: 473 additions & 73 deletions
File tree
- .changeset
- packages/types/src/__tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
0 commit comments