Repository navigation
docs(fields): compile the README's snippets against the shipped surface (objectui#5174 batch 36) - #8295
Conversation
Both tsx fences on packages/fields/README.md now compile in the gate's
covered tier, so the page's UNGATED_DOCS row is deleted rather than
rewritten (0 diagnostics after the repairs).
- Registration fence: the relative `./MyCustomColorPicker` import (TS2307)
becomes `declare const MyCustomColorPicker: FC<CellRendererProps>`, and
the comment is corrected — `color` is a SHIPPED type
(`ColorSwatchCellRenderer`, index.tsx:2385; `ColorField` widget at :2801),
and `getCellRenderer` reads the registry before the standard map, so the
call OVERRIDES the built-in renderer instead of adding a new type.
- Grid-cell fence: `({ field, value })` (TS7031 x2) is annotated
`CellRendererProps`, the props bag `getCellRenderer`'s result actually
takes.
The ledger row's "2 undefined-name diagnostic(s)" wording was stale: the
live codes were TS2307 x1 and TS7031 x2, measured with the gate's own
scanFences/compileSnippets exports.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
…-snippets-batch36-fields
✅ 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
|
|
ACCEPT (batch 36, Verified from the diff and the tree, not the report:
Batch 37 forecast on this head: root Next: CI convergence → flip → post-flip guard → auto-merge SQUASH → queue confirmation → landing probe ( Generated by Claude Code |
|
Flip deferred: CI converged all green on Generated by Claude Code |
|
Armed: PR #8295 flipped ready at 2026-09-07T09:32:42Z on head Generated by Claude Code |
|
LANDED: merged at 2026-09-07T09:50:20Z as Generated by Claude Code |
Part of #5174 (batch 36:
packages/fields/README.md). No closing keyword — the card stays open for the rootREADME.md(batch 37).Both
tsxfences on this page now compile incheck:doc-snippets's COVERED tier, so the page'sUNGATED_DOCSrow is DELETED rather than rewritten (batch-30 precedent: delete at zero). Ledger 2 rows -> 1 (README.mdremains). Gate reports 228 covered / 1 ungated, up from 227 / 2.Base
fc32921aa;origin/mainmoved to3c6394cb2mid-task and was MERGED in (never rebased) ata511f23ec. Every reading below is re-measured on the merged heada511f23ecand matched its pre-merge value.Census reading 1 (base
fc32921aa, the gate's ownscanFences+compileSnippets)tsx)Cannot find module './MyCustomColorPicker' or its corresponding type declarations.tsx)Binding element 'field' implicitly has an 'any' type./... 'value' ...2 fences collected, 0 parse failures, 0 root-bound refusals, 2 of 2 judged, 2 failed, 3 semantic diagnostics, ZERO passing fences.
Harness controls in the same run: sentinel 1 (TS2305), positive 0, undeclared 1, root-declared 1, src leaks 0, resolution ->
packages/types/dist/index.d.ts.The ledger row's wording was stale — it said "2 undefined-name diagnostic(s) ... 1 unresolved-module diagnostic(s)". The unresolved-module half is accurate (TS2307 x1); the "undefined-name" half is not: the live codes are TS7031 (implicit any on a destructured binding), not TS2304/TS2552, and nothing on this page "continues an earlier block". Carry-forward from batch 35 confirmed a sixth time: a ledger row's wording is not evidence.
Blind spot reported, not relabelled: the
bashfence at line 13 is outside this gate'sts/tsxpopulation.Negative control — the base page had NO passing fence, so the usual subject did not exist
The brief's negative control asks whether the PASSING fences were bound or unbound. Reading 1 has zero passing fences, so that question has no subject here. Instead the same length-preserving decimal technique was pointed at the FAILING blocks, to measure how much of each was checked at all. Run on the tracked file with the trap/restore discipline below (HEAD already carried the repairs, so a restore point existed).
c0748e9aafield.type->field.typo'color'->1234567(7 chars for 7, 52-byte line for 52)TS2345 Argument of type 'number' is not assignable to parameter of type 'string'Reading: the base page was HALF bound. The TS7031 block was fully unbound —
fieldwas implicitany, so every member name written on it (field.type) was checked by nothing; the page could have documented any spelling at all. The TS2307 block kept its ARGUMENT positions checked despite the failed import, soregisterFieldRenderer'sstringparameter was live even while the block was red. Leg B is the one that makes the repair worth its diff:field.typewas decoration, and is now a checked member access (positive-control leg M5).The repairs
Fence 25 (registration). The relative import of a file that does not exist becomes a typed stand-in:
declare const MyCustomColorPickerannotated with React'sFCgeneric instantiated atCellRendererProps(batch 35's fence-161 precedent), withCellRendererPropsimported from@object-ui/fieldsandFCtype-imported fromreact.registerFieldRenderer('color', MyCustomColorPicker)is unchanged.Teaching point, corrected. The old comment read
// Register a new 'color' field type.coloris SHIPPED twice over —standardMap.color = ColorSwatchCellRenderer(packages/fields/src/index.tsx:2385), theColorFieldwidget infieldWidgetMap(:2801), andColorFieldMetadatain@object-ui/types— andgetCellRendererconsults the registry BEFORE the standard map (:2322then:2384). So the call OVERRIDES a shipped renderer; it does not add a type. The comment now says exactly that, and points at the way to ADD one (register a name nothing ships).Fence 37 -> 42 (grid cell).
({ field, value })is annotatedCellRendererProps— the real props bag, not a narrowed stand-in.field.typethen type-checks against the 37-memberFieldMetadataunion (packages/types/src/field-types.ts:824), whose every member declarestype;getCellRenderertakesstring, so the union of literals is assignable. No widening was needed and none was added.Census reading 2 (after repairs, merged head
a511f23ec)2 fences (lines 25 and 42), 0 parse failures, 0 bound refusals, 2 of 2 judged, 0 failed, 0 diagnostics. Same harness controls as reading 1. Page reads zero -> the
UNGATED_DOCSrow is deleted, not rewritten.Per-key table — every key/prop these two fences author
registerFieldRendererarg 1 ('color')packages/fields/src/index.tsx:2137, paramtype: stringfieldRegistry.set(type, ...):2138, read back bygetCellRenderer:2322registerFieldRendererarg 2 (the renderer):2137, param typed as React'sFCoverCellRendererPropsCellRendererProps.field:317NumberCellRenderer/SelectCellRenderer/LookupCellRendererCellRendererProps.value:316any, so its VALUES are unchecked (leg M2)field.typeFieldMetadatamembers,packages/types/src/field-types.ts:824getCellRenderer(fieldType):2320isEditing?/onChange?:318/:319Phantom keys authored by the fences: none. Control leg M3 proves the bound is real:
CellRendererPropscarries no index signature, so an invented prop is refused.Prose claims verified against the sources (step 6):
:2322, standard map second).getCellRendererto resolve the correct component for a field type" — TRUE, verified at five shipped sites:plugin-kanban/src/ObjectKanban.tsx:601,plugin-detail/src/RelatedList.tsx:936,DetailSection.tsx:296,HeaderHighlight.tsx:134,RecordMetaFooter.tsx:105.FieldRegistrynames a symbol nothing exports (finding(docs,fields): packages/fields/README.md namesFieldRegistry, a symbol nothing in the repo exports — one prose hit, no gate reads it #8292), and the fence's rawgetCellRenderer(field.type)skips theresolveCellRendererTypestep every shipped consumer performs (finding(docs,fields): the fields README teaches getCellRenderer(field.type), but every shipped consumer calls resolveCellRendererType() first — a copied cell drops format hints #8294).Positive controls — committed tree, trap/restore, on-disk proof before any reading
Discipline: absolute paths from
git rev-parse --show-toplevel;trap RESTORE_FN EXIT INT TERM; restore isgit checkout HEAD -- ABSOLUTE_PATH(never a bare checkout); mutation proven ON DISK by blob inequality against the HEAD blob before the gate runs; restore proven by blob equality ANDgit diff HEADmeasuring 0 bytes — never by an exit code. HEAD blob of the page:ddce7719484adbf71778da3777c97467d6828ef4.field={42}on the renderer elementpackages/fields/README.md:47:20 TS2322: Type 'number' is not assignable to type 'FieldMetadata'.value={42}on the renderer elementCellRendererProps.valueisany; this is THE BOUND, measured, not assumedinventedProp={1}:47:48 TS2322: ... Property 'inventedProp' does not exist on type 'IntrinsicAttributes & CellRendererProps'.(TS2322, not TS2353: JSX attributes are excess-checked through the attributes type)'color'->1234567, length-preserving:35:23 TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.field.type->field.typo:46:42 TS2339: Property 'typo' does not exist on type 'FieldMetadata'.(the diagnostic leg B says was IMPOSSIBLE on the base page)FCgeneric instantiated at an object type requiringnope: string:35:32 TS2345,Property 'nope' is missing in type 'CellRendererProps' but required— thedeclare constis a typed stand-in, not a holeEvery leg restored to blob
ddce7719...withgit diff HEADat 0 bytes. All seven legs were run twice: once onf8f04112dand again, unchanged, on the merged heada511f23ec.Strictness region of
scripts/check-doc-snippet-types.mjssha256sumofawk '/── Fence scanning/{f=1} f'over the file:fc32921aa2749d53ae3a8df033a53b8d7a354fa7e22ee2d1a17f6ad0c3d61122e904e084ba511f23ec2749d53ae3a8df033a53b8d7a354fa7e22ee2d1a17f6ad0c3d61122e904e084bByte-identical. The only change to that file is the 2-line
UNGATED_DOCSentry for this page, deleted; no strictness was touched.Gates (pinned to
a511f23ec; redirect-then-capture, exit codes never read through a pipe)pnpm check:doc-snippetspnpm exec vitest run scripts/__tests__/check-doc-snippet-types.test.ts scripts/__tests__/check-doc-fence-languages.test.tspnpm exec vitest run scripts/__tests__/pnpm exec vitest run packages/fields/pnpm check:doc-typespnpm check:readme-exportspnpm check:doc-fencespnpm type-check:scriptspnpm lint:rootno-explicit-anywarnings, none in either changed filepnpm check:control-bytespnpm check:entry-guardscripts/filespnpm check:comment-mask-corpusnode scripts/check-changeset-presence.mjsnode scripts/check-governed-queue-guard.mjs --teston both pathspnpm exec turbo run build $(node scripts/check-doc-snippet-types.mjs --build-filter) --concurrency=2— 35/35 successful, re-run after the mergeSelf-scan beyond
check:control-bytes:grep -naP '[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]'over both changed paths exits 1 (no match).CI is not awaited — the report is delivered at draft-PR time per the dispatch contract.
Four-axis reasoning on the two real choices
1. Reword the comment vs. register a genuinely unused type name.
coloris shipped at three sites, and the section's own heading promises BOTH paths ("override standard fields or add new ones"). The page had no example of the override path; renaming the type would have left the override path undocumented and the shipped precedence rule unstated.registrybeforestandardMap) is the durable fact a reader needs; naming an arbitrary unused type teaches nothing about it and rots the day someone ships that name.2.
CellRendererPropsvs. aPickof it overfieldandvalue.CellRendererProps; aPickwould describe a shape nothing in the codebase constructs.Pickwould teach that a cell may dropisEditing/onChange— both are optional today, so aPickis indistinguishable at the type level while being false about the contract. Naming the real interface keeps the doc honest if either becomes required.Reported deviation from the brief: the brief's suggested control leg (swapping
fieldandvalue) cannot go red —valueisany, so the swap type-checks. Legs M1/M2 measure that boundary directly instead, and M5/M6 were added to cover the two things the repair actually buys.Files changed
packages/fields/README.md(+10 / -5)scripts/check-doc-snippet-types.mjs(-2 — exactly this page'sUNGATED_DOCSrow)Batch 37 forecast, MEASURED on
a511f23ecRoot
README.md: 5ts/tsxfences, 0 parse failures, 6 semantic diagnostics across 3 blocks — fence 99:TS2552(myAPI) +TS2304(MySidebar); fence 382:TS2304 x2(SchemaRenderer,schema); fence 398:TS2420+TS2355(the elidedDataSourceimplementation). The row is accurate in count AND classification — the only ledger row that has been. Fences 137 and 214 already read zero, so batch 37 has two genuine subjects for its negative control (this batch had none).Generated by Claude Code