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

Commit 4f0fbce

Browse files
claude[bot]os-samclaude
authored
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 ⚠️ stale | | described `ZodDefault` nodes | 2,024 | **2,028** | 2,024 → ≥2,028 ✅ | | rebuilt described containers | 1,368 | **1,373** | 1,389 → 1,394 ⚠️ stale | | `.optional().default()`-shaped arms | — | **394** (267 of them described) | 394 ✅ | | `.describe().default()` inner-described | — | **50** (32 disagreeing) | 50 / 32 ✅ | ⚠️ **Two of the card's rows are stale, and #9496 is the cause — measured, not inferred.** Reverting its single line (`: def.rest` back to `: undefined`) in a throwaway worktree and re-running this file, the mutation proved to land on disk (blob `42765e66a0` → `ab718d1714`, `git diff --numstat` = exactly `1 1`) and the restore proved by blob equality back to `42765e66a0` plus an empty `git diff HEAD`: | quantity, and the population it counts | #9496 reverted | at this head | #9496's effect | |---|---|---|---| | rebuilt described containers, corrected rule | 1394 | 1373 | **−21** | | rebuilt described containers, superseded rule | 1389 | 1368 | **−21** | | reference-equal nodes, corrected rule | 10071 | 10011 | **−60** | | reference-equal nodes, superseded rule | 9665 | 9605 | **−60** | | nodes visited, corrected rule | 16442 | 16351 | **−91** | | described `ZodDefault`, corrected / superseded | 2028 / 2024 | 2028 / 2024 | **0** | | misaligned / stops, superseded rule | 394 / 394 | 394 / 394 | **0** | ⇒ #9496 made reference-equal nodes **fewer, not more**: a tuple that comes back reference-equal short-circuits the pairing walk before it descends, which is also why `nodesVisited` falls by 91. The card's own integers reappear the moment that one line is reverted, and the figures it did **not** publish as moving — described defaults, and 394/394 — do not move at all. ⛔ **Correction to an earlier revision of this paragraph, which said "~400 more reference-equal nodes on both sides" and attributed it to #9496.** That was wrong in both sign and magnitude, and it named no population — it silently borrowed a number from a different quantity. The ~400 is the **corrected-minus-superseded rule gap**, which measures **406 with #9496 and 406 without it**: provably independent of #9496, so #9496 did not move it. Round-1 contract review caught this and failed the PR for it, correctly — publishing a figure without naming what it counts is this card's entire subject, and passing it here would reproduce the loop the card exists to break. ## The pin that fires ⭐ A new **alignment invariant**: the strip changes a node's kind in exactly one place, so at every other node the two sides must report the same `def.type`. `misaligned` is **0** under the live rule and **394** under the superseded one. **Ablation** — the census switched on disk to the superseded rule, run, restored, re-run. The mutation was proved to land (anchor `pairRoots(roots, 'inner-optin')` 1 → 0, blob `79b32ee8` → `f7477d37`) and the restore proved by blob equality back to `79b32ee8` plus an empty `git diff HEAD`, not by an exit code. ⭐ No build is involved on this path: vitest transforms the test source and its relative import directly, so there is no `dist/` that could serve stale bytes. ``` MUTATED_RUN_EXIT=1 Tests 2 failed | 26 passed (28) × ⭐ the pairing stayed ALIGNED across the whole surface (objectui#9103) × ⛔ the superseded pairing rule is measurably blind HERE — the control that FIRES ✓ ⭐ not one described `ZodDefault` loses its description ✓ ⭐ not one rebuilt container loses its description ✓ positive control — the described-default population is large and the branch is exercised RESTORED_RUN_EXIT=0 Tests 28 passed (28) ``` ⭐ That green column **is the card's thesis made literal**: under the blind pairing the two "nothing was lost" assertions stay green, because the walk could not have seen a loss beneath a subtree it never entered. Only the new invariant reddens. ## What changed in the one file - **The `default` arm** branches on the source's `optin` instead of the output's `def.type`. - **The pairing is extracted** so it can be run twice. The superseded rule is kept as `'output-type'` and is the control that fires — on a hand-built corpus whose five answers are counted off the literals, ⛔ never read off a run, **and** on the real spec surface. - **The instrument is self-tested before it is pointed at the spec.** The card's worked example is re-derived rather than quoted: the superseded rule sees **1 of 2** described defaults there, the live rule sees 2. - **The hard-coded populations in the docblock are deleted, not corrected.** They were lower bounds, not values. Nothing in the file now asserts an integer copied out of a print — every assertion is a floor, a total-equals-kept identity, or an emptiness, so an upstream spec release cannot look like a regression here. - **Two zod facts the census itself rests on are pinned** in section 1: `removeDefault()` returns `def.innerType`, and `optin` tells the two spellings apart while the output's `def.type` does not. - **The over-claiming test name.** `the spec's own graph still carries every default AND every description` read `hasDefault` on the first 200 carriers and never read a description. It now reads descriptions, across every carrier, with its own non-vacuity floor. - ⛔ **No assertion was weakened, skipped or quarantined.** 28 tests, up from 19 — both figures count every `it(` call in this file — ⛔ none of them sits at the top level: `^it(` is **0** at every tree, all 19 and all 28 being nested inside a `describe(`, measured at the head and at the derived merge-base `bbc9dc34e3`. ⛔ Not tests-plus-suites: an earlier revision of this line published **23**, which is 19 tests + the file’s 4 column-0 `describe(` suites (16 `describe(` tokens in all, so “column-0” is load-bearing there and is ⛔ not the same rule the `it(` figures use), and comparing it against 28 mixed two populations in one clause. Corrected by the PM seat on the round-2 review’s finding; the committed diff is unchanged. ## Verification Exit codes captured as `cmd > file 2>&1; EXIT=$?`, ⛔ never through a pipe. Heavy runs went through `scripts/pm/os-verify-lock.sh` on slot `issue-9103-types`. | command | exit | |---|---| | `pnpm --filter @object-ui/types run type-check` | **0** | | `pnpm --filter @object-ui/types run test` — 190 files, 4354 tests | **0** | | this file, `--reporter=verbose` — 28 tests | **0** | | `check:control-bytes` · `check:test-path-roots` · `check:new-line-citations` | **0 / 0 / 0** | | `check:changeset-claims` · `check:installed-pin-claims` | **0 / 0** | | `check:spec-symbols` · `check:comment-mask-corpus` | **0 / 0** | | `check-governed-queue-guard.mjs --test` on both paths | **0 — NOT GOVERNED** | ⚠️ **Dependency-closure build is empty here, not skipped:** `pnpm --filter '@object-ui/types^...' build` exits 1 with `ERR_PNPM_RECURSIVE_RUN_NO_SCRIPT` — no dependency of this package declares a `build` script. Nothing published moves in this diff, so the changeset carries empty frontmatter, the repo's declared spelling for that. Repository-wide `pnpm lint` is CI's run, not this branch's; `eslint` on the edited file exits 0. **Second commit `0079b6d88d` (comment only).** After round-1 review I re-ran the gates that read prose and the file itself: `check:control-bytes` 0, `check:new-line-citations` 0, `check:comment-mask-corpus` 0, `check:changeset-claims` 0, `eslint` 0, and this file 28/28. No assertion, name or expression changed — `git show --stat` is `1 file changed, 12 insertions(+), 1 deletion(-)`, all inside one comment. ## Labels and authorship ⛔ **This branch wrote no label**, `needs:contract-review` included — labels are the PM seat's alone (upstream contract defect objectstack#18181). The claim comment does **not** carry `Clause-②: yes`, the diff is test-only, and the governed-surface guard answers NOT GOVERNED, so no carrier is claimed here. For whoever renders a verdict, the fixed spelling of the authorship pair: this is a `mode:subagent` dev with no session of its own, so `Implemented-by:` is its **branch**, `claude/issue-9103-optional-default-census-blind-spot`. The `Reviewed-by:` value is the rendering seat's **own** session and is ⛔ not mine to write. ## Round-1 contract review **FAIL on one item, and it was a body sentence — the committed diff needed no change.** The reviewer re-derived all six dispatched claims on its own instrument and proved the causal story by the same #9496 ablation I have now repeated independently rather than adopting. Both corrections are above and in `0079b6d88d`: 1. The `~400` sentence, replaced by the measured table with each population named. 2. The `PROVING REMOVAL` note now says **three** assertions redden and names all three, measured with `: undefined` restored and nothing else: this one, `⭐ every export with nothing to strip comes back REFERENCE-EQUAL`, and `the ONLY clean exports that are rebuilt are behind a z.lazy`. ⚠️ One provenance correction, offered because accuracy about provenance is this card's subject and ⛔ not to deflect the finding: that note is **not new in this PR**. `git log -S` puts it in `8700d6d93700828eff4d6a8f145add8a0f1ac412` (#9496), and my first commit does not touch the line. It is repaired here because it sits inside this round's declared file surface and is the same defect class as the card — a prose claim about a measurement that the measurement does not support. ⭐ The reviewer also disclosed that both card items living in the fenced `imported-defaults.ts` were already removed upstream by `30443fb46d` (#9349). ⛔ I have not acted on it: no scope change, no retitle, and the `Part of #9103` framing above stands. The closeout is the PM seat's to re-rule. ## Acceptance notes Out of this round's file surface, ⛔ not filed, ⛔ not fixed here — every one lives in `packages/types/src/zod/imported-defaults.ts`, the source under measurement: - **The prose figures at the `lazy` arm's docblock and the `267` claim.** The card asks for both. Carrier: this same card, once a round is dispatched with that file in surface — the figures move together with this census, so they should be re-taken from the print this PR adds rather than re-derived independently. - **The `267` docblock precision.** The card measured 257 of 267. This census independently reports **267** `.optional().default()`-shaped arms carrying a description, which is the population that sentence is about — so the number to correct it with is now derivable rather than hand-counted. - **`z.prefault` has no arm in the walker.** `childrenOf` and the strip's switch both fall through to "nothing inside" for `def.type === 'prefault'`, which zod 4.4.3 does mint (`z.prefault` is a function). Observation only: **no reachable spec node uses it** on 17.4.0 — the census would have counted it — so there is nothing to reproduce today and no carrier. Noted, not filed. --- _Generated by [Claude Code](https://claude.ai/code/session_01L5xpA5q533BgTTNADibEFt)_ --- _Generated by [Claude Code](https://claude.ai/code)_ --------- Co-authored-by: os-sam <sam@objectstack.ai> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0e2ddd4 commit 4f0fbce

2 files changed

Lines changed: 473 additions & 73 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
---
3+
4+
Correct the objectui#9034 census pairing, which was blind at every
5+
`.optional().default()` node, and stop publishing its figures as hard-coded
6+
prose (objectui#9103). Test only; no package is released by this change.

0 commit comments

Comments
 (0)