…alled spec (#4535)
The comment above `ListViewExportOptions` explained the local restatement by
the pin: `@objectstack/spec@17.0.0-rc.6`, whose `ListView.exportOptions` was
the legacy bare format array. objectui now installs 17.2.0, which carries the
object form — the array lifts to `{ formats: [...] }` at parse and 'pdf' has
left the enum — so the NOTE went stale and the prose went false again with
nobody editing it.
Correct the reason, and stop it being load-bearing: a new spec-parity test reads
the object branch out of the INSTALLED spec at test time and asserts the key
set, the format enum, upstream strictness, the 'pdf' refusal's prescription and
the parse-time array lift against it. The local key set is projected from
`keyof ListViewExportOptions` through an exhaustive Record, so drift fails to
compile instead of passing a comparison against a hand copy.
The mirror stays a mirror for a measured reason the test pins:
`ListViewExportOptionsSchema` is internal to the spec bundle and not a public
export, so there is nothing to import.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PBjwYLS6BciTQW3c9xQiD2
Fixes #4535
The premise moved before I got here — measured first
The card lists four items against
origin/main@878140b. Re-verified onb03ba3a, three of them were already landed by the change that shipped changeset1f9b905:exportOptionstype, make the comment trueListViewExportOptions(the five spec keys); comment partly false again — see below'pdf'ListViewExportFormat = 'csv' | 'xlsx' | 'json', warn-drop path folded into the format-agnostic filterstreaming, delete theas anyObjectGrid.tsx—:2563and:2605read it uncastThe card's constraint (no sixth undeclared-but-read key) was also already honoured as two guards:
objectql.exportOptions.test.ts(type side) andObjectGrid.exportOptionsKeys.test.ts(source scan).So this PR is not a re-implementation. It closes the part of item 1 that came undone, answers item 4, and files the leg that sits outside this card's file surface.
What this PR changes
The alignment comment went false a second time — by nobody touching it
ListViewExportOptions(packages/types/src/objectql.ts) carried:That is no longer true. Measured from the lockfile and the installed package: objectui installs
@objectstack/spec@17.2.0, and itsListViewSchema.exportOptionsis the object form — a two-branch union where a bare format array lifts to{ formats: [...] }at parse, the object branch is astrictObjectwith exactly the five keys, and the enum is["csv","xlsx","json"].This is the same failure mode the card was filed for, one release later: a prose claim about another package's shape, with nothing that fails when that shape changes. A comment that has gone false twice is not the instrument to trust a third time.
So the claim is made falsifiable
New
packages/types/src/__tests__/export-options-spec-parity.test.tsreads the object branch out of the spec package that is actually installed, at test time, and asserts against it:'pdf'is absent from both sides;'pdf'refusal carries its migration prescription, not a bare "Invalid input";undefined.The local key set is projected through
Record< keyof ListViewExportOptions, true >, exhaustive in both directions, so a local key added or dropped fails to compile rather than passing a comparison against a hand-copied list. Nothing in the file restates the contract — a restatement is a third copy, and the copy is what drifts.The comment now records the real reason the mirror exists, and the test pins that too:
ListViewExportOptionsSchemais internal to the spec bundle and not a public export (measured: 222 exports on@objectstack/spec/ui, none matching/Export/i; onlyListViewSchemais exported, and itsexportOptionsinfers to a union, not this interface). When upstream exports the symbol, the test fails and says so, and the mirror can go.Item 4, answered: raw un-parsed metadata reaches the renderer — keep the tolerance
Three measurements, all on current main:
normalizeListViewSchema(packages/core/src/utils/normalize-list-view.ts) does not touchexportOptions— zero occurrences in the file..parse()/.safeParse()on a view schema; the only such calls in the repo are in tests. That is exactly whyListViewInferredisz.inputand notz.infer, as its own doc comment already records.packages/app-shell/src/views/ObjectView.tsx:2116forwards the stored value verbatim:exportOptions: viewDef.allowExport === false ? undefined : (viewDef.exportOptions ?? listSchema.exportOptions).The spec's parse-time array lift therefore never runs before the renderer. A stored bare-array declaration still arrives as an array, so the renderer's own tolerance is load-bearing and stays. It lives in
plugin-list/src/ListView.tsx:1299-1308(resolvedExportOptions), on the componentObjectViewactually renders.ObjectGridcarries none — a bare array reaching it degrades to the['csv','json']default, silently ignoring the author's declared formats. Left as-is here and recorded on the follow-up rather than changed on the way past.Out of this card's file surface — filed as #6956
The ListView leg of the same reconciliation never landed, and it is a live defect. It is outside this card's declared surface (
objectql.ts+ObjectGrid.tsx), so it was measured and reported, not fixed here. #6956 remains open and carries the detail:packages/types/src/zod/objectql.zod.ts:511-518still declares the pre-test(scripts): check-shell-escape-residue reds on an agent-tree document no scan root reaches (#7413) #8010 shape —'pdf'accepted in both spellings,streamingdeclared nowhere, object branch not strict. This is not cosmetic:ListViewSchema(the TS type the ListView renderer is written against) derives from this zod, so it disagrees with its siblingObjectGridSchemaabout the same spec key.packages/plugin-list/src/ListView.tsx:1324and:2705still readstreamingthroughas any— item 3's exact defect in the other renderer, load-bearing precisely because of the zod gap.The new test states this scope limit in its own docblock rather than implying it, so nobody reads it as covering the zod mirror.
Verification
All gates below run on
cac5aed, the final commit of this branch.pnpm --filter @object-ui/types type-checktsc --noEmit && tsc -p tsconfig.examples.json && tsc -p tsconfig.test.jsonpnpm exec vitest run packages/types/Test Files 76 passed (76)·Tests 868 passed (868)pnpm exec vitest run packages/plugin-grid/src/__tests__/ObjectGrid.exportOptionsKeys.test.tsTest Files 1 passed (1)·Tests 5 passed (5)pnpm --filter @object-ui/types lint✖ 259 problems (0 errors, 259 warnings), all pre-existingnode scripts/check-spec-symbol-derivation.mjs✅ spec symbol derivation: 1325 files scanned against 4959 spec export names; 16 declared dialects, 0 untriaged collisions in 0 packages.·✅ spec alignment claims: 2 declared deliberate copies, 18 unbacked claims in 5 packages.— unchanged count, so no new unbacked claimnode scripts/check-control-bytes.mjs✅ check-control-bytes: OK (scanned 5786 tracked text file(s); skipped 85 binary).node scripts/check-changeset-fixed.mjs✅ All workspace packages are in the changeset fixed group.node scripts/check-changeset-no-major.mjs✅ No changeset declares amajorbump.Type-check coverage is measured, not assumed.
tsc -p tsconfig.test.json --listFilesnamespackages/types/src/__tests__/export-options-spec-parity.test.ts(1 hit), so "type-check is clean" is a statement about the new file rather than about a program that excluded it.Ablation — the guard reds on local drift. Committed first, then mutated
ListViewExportFormatback to include'pdf'(card item 2's defect), with anEXIT INT TERMtrap restoring by absolute path.1, removed-form0; blob46090c7→88ccf25.tsc -p tsconfig.test.jsonexit 2, naming this PR's guard first (angle brackets spaced out below — GitHub's body sanitizer silently eats short tag-shaped fragments, which is what happened to this quote on the first publish):git hash-objectback to46090c7, equal togit rev-parse HEAD:packages/types/src/objectql.ts;git diff HEADempty;git statusclean.Stated honestly, because the template direction and the measured one differ: the runtime leg of the new test fires when the spec drifts, and the compile leg fires when the local declaration drifts. The ablation exercises the second. The first was not ablated — the only way to mutate the spec side is to edit
node_modules, which is a pnpm store hardlink shared across worktrees on this box. The floor test (finds the spec shape it is about to compare against) is what stands in for it.Scope narrowing, declared: the repo-wide
pnpm lintand the fullcheck:*farm were not run locally — CI runs them once regardless. The narrowing is bounded by measurement, not by assumption: the whole@object-ui/typespackage lint ran (not just changed files), andeslint.config.jsenables no type-aware linting (noprojectService, noparserOptions.project), so this diff cannot move the verdict on any file it does not touch.Changeset
@object-ui/typespatch. No export added or removed, no key or union altered — the diff to shipped source is a doc comment. Precedent named: the earlier1f9b905graded this package minor, on the reasoningListViewExportFormatandListViewExportOptionsare new exports,streamingis a new optional key, andformatsno longer admits'pdf'. That was the shape change; this is not one. No@object-ui/plugin-gridchangeset — nothing in that package changed.Review notes
needs:contract-review. Not for enqueue by me.packages/plugin-grid/src/ObjectGrid.tsxis untouched — regions owned by landed work (LinkCell fix(plugin-grid): the link column renders a real anchor when the host publishes record URLs (#4490) #4531, date cells fix(fields): the date formatter's last three en-US channels thread the display locale (#4272) #4544/fix(plugin-grid): the record-detail date fallback threads the display locale (#4541) #4552, kebab menu) were never opened. Its guard test runs here only because it scanspackages/types/src/objectql.ts, which this PR edits.ListViewExportOptionsis entry 1 in the@object-ui/typeslist ofCLAIM_DEBTinscripts/check-spec-symbol-derivation.mjs:665, the shrink-only ledger of unbacked spec-alignment claims. Its claim is now backed by a real parity test and the mirror's reason is measured, which makes it a clean move toCLAIM_ALLOWunder the ledger's own route 2 — butscripts/**is outside this card's surface, and editing a gate script pulls in that script's own test suite. Recorded on finding(types/plugin-list): the ListView leg of theexportOptionsreconciliation never landed — zod mirror still takes'pdf'and declares nostreaming, and bothas anyreads survive #6956.session_01PBjwYLS6BciTQW3c9xQiD2(https://claude.ai/code/session_01PBjwYLS6BciTQW3c9xQiD2) — recorded in prose because a body edit rewrites the generated footer below to its bare form.