Uh oh!
There was an error while loading. Please reload this page.
test(spec-parity): converge the non-optional enum-options casts onto the shared reader (#7025) - #7057
Merged
Merged
Conversation
…the shared reader (#7025) 9 spec-parity test files in 7 packages cast an enum node NON-optionally to an options-bearing shape and read `.options` straight off it -- the SIXTH spelling of the Zod-internals reader hazard objectui#5872 catalogues, and the one objectui#6924's instrument (`options?:`) structurally cannot see. They converge onto `@object-ui/test-support`'s `enumOptions(node)`, the walk PR #7024 exported for objectui#6924's family. The decisive difference from that family is the FAILURE MODE, and it decides the shape of every conversion here. #6924's sites guarded with `Array.isArray(raw) ? [...raw] : []`, so a failed cast went quietly empty. These sites spread the cast result directly, so a failed cast THROWS. `enumOptions` deliberately answers `[]` rather than raising, so a bare conversion would have downgraded a loud throw into a silent empty vocabulary -- turning this population into #6924's, backwards. Every site therefore keeps its own non-vacuity duty: - 7 module-scope reads gain a throwing wrapper, modelled on the two sites that already solved this in PR #7024 (`types/spec-derived-unions.test.ts` and `examples/schema-catalog/.../component-fixture-declared-keys.test.ts`); - 2 in-test reads (`plugin-grid/spec-symbol-batch7`, `types/spec-subschema-parity`) already carried an explicit non-vacuity assertion, which is the sanctioned alternative, so they keep theirs. The four `expandableFamily.identity-*` files are textually identical across four packages -- #5872 class (1)'s sharpest shape, where a reviewer diffing one copy cannot see that the other three did not move -- and were converted as one unit. Verdict preservation measured, not assumed: all 9 readings return the identical array in the identical order before and after (FieldType n=49, ColumnSummarySchema n=11) against the installed pin. The retired spelling is deliberately not quoted in the new comments: the card's enumeration instrument is a grep for it, and a comment carrying the literal text would make every future re-derivation read a false positive. Out of scope, measured and left alone: `types/spec-subschema-parity.test.ts:161` casts to an `unwrap().def.options` shape -- a further spelling, and a #5872 class (2)/(4) shape rather than this one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013hfmP9hoMd3dJwTh85J4yB
Contributor
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
os-sam
marked this pull request as ready for review
August 31, 2026 16:13
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes#7025
The SIXTH spelling of the Zod-internals reader hazard #5872 catalogues: 9 spec-parity test files in 7 packages cast an enum node NON-optionally to an options-bearing shape and read
.optionsstraight off it. They converge onto@object-ui/test-support'senumOptions(node)— the walk PR #7024 exported for #6924's family.The enumeration, re-derived (9, as the card predicted)
Instrument, run over
packages/,examples/,apps/at branch basee33b44796(post-#7024main):That is the card's own instrument and it finds 8. The 9th (
types/spec-subschema-parity.test.ts:178) spells the same cast withoutreadonly, so a second, wider instrument was run to catch it and to prove nothing else hides:Total: 9 files, 7 packages — matching the card's 9 and the triage comment's prediction that a post-#7024 tree measures 9, not 11. The two files the triage flagged as the 11-vs-9 difference (
fields/FieldEditWidget.test.ts,plugin-detail/inlineEditTypeCoverage.test.tsx) were confirmed already converted by PR #7024 and carry neither spelling now.packages/app-shell/src/utils/expandableFamily.identity-5874.test.tsFieldTypepackages/app-shell/src/views/richtextSurfaceParity.test.tsxFieldTypepackages/plugin-detail/src/__tests__/expandableFamily.identity-5874.test.tsxFieldTypepackages/plugin-detail/src/__tests__/autoLayout.wideSpelling.test.tsFieldTypepackages/plugin-form/src/__tests__/autoLayout.wideSpelling.test.tsFieldTypepackages/plugin-kanban/src/__tests__/expandableFamily.identity-5874.test.tsxFieldTypepackages/plugin-dashboard/src/__tests__/expandableFamily.identity-5692.test.tsFieldTypepackages/plugin-grid/src/__tests__/spec-symbol-batch7.test.tsColumnSummarySchemapackages/types/src/__tests__/spec-subschema-parity.test.ts(line 178)ColumnSummarySchemaBoth instruments return zero in-scope hits after this change.
The constraint: a bare conversion would have been a regression
enumOptionsdeliberately answers[]rather than raising. These sites spread the cast result directly, so a failed cast THROWS — the opposite of #6924's family, which guarded withArray.isArray(raw) ? [...raw] : []and went quietly empty. Converting without preserving the loud failure would have turned this population into #6924's, backwards.So every site keeps its own non-vacuity duty, in one of the two forms the card sanctions:
types/spec-derived-unions.test.tsandexamples/schema-catalog/test/component-fixture-declared-keys.test.ts, which both wrapenumOptionsand keep their ownthrow). The throw stays at the call site because the read is module-scope: it reproduces the import-time failure the retired spread had.plugin-grid/spec-symbol-batch7(reads a non-empty enum from the spec …) andtypes/spec-subschema-parity(spec ColumnSummarySchema should be a non-empty enum). That is the sanctioned alternative, and it is also the idiom PR test(test-support): one enum-options walk for the top-level reader family (#6924) #7024 landed for the same shape inplugin-grid/summary-spec-parity.test.ts. Adding a module-scope throw to these two would have made their own probe unreachable.Zero sites excluded: all 9 converted.
The four identity files were treated as one unit
expandableFamily.identity-5874inapp-shell,plugin-detail,plugin-kanbanandexpandableFamily.identity-5692inplugin-dashboardcarry a textually identical read across four packages — #5872 class (1)'s sharpest shape, where a reviewer diffing one copy cannot see that the other three did not move. They were converted in one mechanical pass with one anchor, and the enumeration instrument returning zero afterwards is the check that all four moved.Ablation: the loud failure is preserved, and the wrapper is what preserves it
This is the one thing a reviewer cannot take on trust, so it was measured in two legs.
@object-ui/test-supportresolves to source (itspackage.jsonexportsmap points at./src/index.ts, andvitest.config.mtsaliases the specifier topackages/test-support/src), so nodistrebuild is involved; the mutation reaches the run directly. Each leg proved the mutation on disk (injected marker counted, blob hash compared against the HEAD blob) before reading any result, and each restore was proved bygit diff HEADbeing empty and the file hash matching the HEAD blob exactly.Leg A — stub the shared reader to return
[], run all 9 suites. Every one of the 9 goes red:The 7 wrapper sites fail at import, by name, before a single test runs (96 tests collected normally, 20 under ablation). The 2 assertion sites fail on their own probes.
Leg B — the control: what a bare conversion would have done. Stub the reader AND drop the throw wrapper from
richtextSurfaceParity.test.tsx, then run that file:That file's whole reason to exist — the cross-surface parity control — passes vacuously without the wrapper. The wrapper is load-bearing, not decorative.
Verdict preservation
Measured, not assumed. A temporary probe compared the retired reading against
enumOptionsfor all 9 readings and asserted deep equality (order-sensitive): identical array, identical order, 9/9, against the installed pin —FieldTypen=49 (text, textarea, email, url, phone, password, …),ColumnSummaryScheman=11 (none, count, count_empty, count_filled, count_unique, percent_empty, …). The probe was deleted before the commit; it is not in this diff.Checks run (all at
eab993075, the commit this PR contains)pnpm exec vitest run [the 9 paths]from the repo rootTest Files 9 passed (9)/Tests 96 passed (96)pnpm --filter … run type-checktype-check: Done, exit 0tsc -p tsconfig.test.json --listFilesper packagepnpm exec eslint .(plain form)no-explicit-anyon untouched linescheck:control-bytespnpm run check:control-bytescheck:phantom-depspnpm run check:phantom-depsdevDependenciesedges)check:spec-symbolspnpm run check:spec-symbolscheck:vi-mock-specifiers,check:vi-mock-inheritpnpm run …check:action-forward-parity,check:designer-field-key-paritypnpm run …check:readme-exportspnpm run check:readme-exports✅ check-readme-exports: OKafter building the 7 packages whosedist/this worktree lacked — its first exit 1 was that build prerequisite, in packages outside this diff, not a findingplugin-formandplugin-kanbangained"@object-ui/test-support": "workspace:*"indevDependencies(the other five packages already had the edge), with the lockfile updated — same pattern PR #7024 used for the five packages it added it to.The retired spelling is deliberately not quoted in the new comments: the card's enumeration instrument is a grep for it, and a comment carrying the literal text would make every future re-derivation of this population read a false positive.
Out of scope, measured and left alone
packages/types/src/__tests__/spec-subschema-parity.test.ts:161— casts to anunwrap()/def.optionsshape. A further spelling and a [finding] The tombstone judge converged, but the Zod-internals READERS around it are still hand-copied in ~10 test files — four of them verbatim #5872 class (2)/(4) shape rather than this one; the card and the triage comment both fence it out. Untouched, even though it sits 17 lines above a site this PR does convert.unwrap()thendef.innerType, then.options) that duplicateenumOptions's own walk — ~18 of them across 7 packages, including two that read.optionsoff a bare.unwrap()with no cast at all (app-shell/.../LayeredDiff.overlayScope.test.tsx:31,data-objectstack/src/metadata-client.overlayScope.test.ts:69), which no cast-keyed instrument can see. No new card filed — this is already [finding] The tombstone judge converged, but the Zod-internals READERS around it are still hand-copied in ~10 test files — four of them verbatim #5872's classes (2)/(4), and that card asks for a re-derived census, so the measurement was recorded there as a comment rather than duplicated into a fresh issue.examples/schema-catalog/test/safe-validate-corpus-6318.test.ts:97— matched by the wide instrument and excluded on reading: it reads the authoredoptionsarray off a JSON fixture, not Zod internals. Not this population.Session: https://claude.ai/code/session_013hfmP9hoMd3dJwTh85J4yB