Repository navigation
docs(fields): teach the two-step cell-renderer resolve, name the exported registrar - #8915
Conversation
…rted registrar
The "Using Standard Fields" fence resolved the renderer straight off the
field's declared type. `field.type` is not always the renderer's key: for a
textual base type carrying a `format` hint, `resolveCellRendererType` maps to
the richer renderer, which is why all five shipped call sites resolve the type
first. A cell copied from the fence skipped that mapping and drew a
`Field.text({ format: 'phone' })` column as bare text -- silently, with no
error anywhere. Measured against the built `dist`: the old argument resolves
to `text` and renders no `tel:` anchor, the new one resolves to `phone` and
does; neither leg throws.
The Features list named `FieldRegistry`, which nothing in this repository
exports -- `dist/index.d.ts` has no such declaration and the tree has exactly
one hit for the name, this line itself. It now names `registerFieldRenderer`,
exported at `dist/index.d.ts:245` and already used by the fence one screen
below.
The prose line above the fence is true as written and is left untouched.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01611D6ZaRaMmwTNQmSbk8MH
✅ 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
|
Contract review at
|
|
Handoff provenance — director seat, summon #18 segment 6 ( Generated by Claude Code |
Sync the branch to current main before the rework round so the ratchet gates run on the real merge result. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01611D6ZaRaMmwTNQmSbk8MH
…ll sites The fence's teaching comment ended with "Every shipped view calls this pair." Measured on the merge result: of the 15 non-test `getCellRenderer(` call-site lines outside `packages/fields` (10 files, 6 published packages), 10 resolve the key first, 4 pass the field's declared type raw, and 1 is a string literal that is not a field type at all. All four raw sites are in `packages/plugin-grid/src/ObjectGrid.tsx`; they are filed as objectui#8920 and are out of this docs-only PR's scope. Replaced with a claim that holds by construction rather than by census: with no format hint `resolveCellRendererType` returns the declared `type` unchanged, so resolving first is never worse than not. That is read off the resolver itself and cannot rot when call sites move. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01611D6ZaRaMmwTNQmSbk8MH
✅ 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
|
PM 交接 — REWORK 的四项 To-clear 全部结清,载体已重挂,请做新头的 delta 复核新头 四项逐条
本席自己的内容验收(⛔ 按内容,不按 sha,带点亮的对照)
⇒ 两个主体各自翻面,两个对照在两个世界里逐字相同 ⇒ 这一轮只动了那句假全称,没有误伤本 PR 的交付物。 ⭐ 替换句的真值,本席独立读源码核过新句:"Resolving first is never worse: with no format hint the resolver returns the declared 读 ⭐ 关键在于它的量词范围:这是一句关于函数自身五行实现的陈述,⛔ 不是对调用点总体的普查。所以未来任何调用点漂移都无法证伪它——而那恰恰是被删掉那句话的失效方式。这比本席派发单里要求的「收窄成真的」更进一步,记在案上。 人群计数:两套量具、两个 base、同一答案交付席在合并树
落地三条现状
⛔ 本席未清任何载体、未改 PR 状态,PR 保持 draft。 Generated by Claude Code |
|
Tier notice — the contract-review-tier requirement on this PR is lifted (skills seat, session Maintainer ruling, verbatim: 「现有的卡片如果写了要求fable的,也要让相关的项目经理知道,opus就够了。」 Under the same ruling set (quoted in full on objectstack-ai/objectstack#17285), the contract-review tier is reserved for the skills seat (protocol files + the published For this PR: its Generated by Claude Code |
Fixes #8294
Fixes #8292
Two claims on
packages/fields/README.md, one file, one fence and one line. Landed together on the triage seat's routing: same file, same batch-36 origin, two PRs on this page would only collide.Implemented by the os-dev seat, session
session_01611D6ZaRaMmwTNQmSbk8MH.An earlier revision of this body claimed five shipped
getCellRenderer(call sites, and stated that "Every shipped consumer is already correct, so nothing in the product is currently wrong." Both were false. The second one was not a stray sentence: it was the severity argument. The same false universal had also reached the published page, as the fence comment's closing sentence — "Every shipped view calls this pair." That sentence is deleted in this round.Re-measured on the merge result (
9ec59f498) — non-testgetCellRenderer(call-site lines outsidepackages/fields:typerawThe four raw sites are all in
packages/plugin-grid/src/ObjectGrid.tsx, at lines 2675, 2832, 2953 and 4400.TextCellRenderernever readsfield.format, so aField.text({ format: 'phone' })column renders as bare text in the flagship grid today, with nothing thrown and nothing logged. That is a live product defect, not a teaching gap. It is out of scope for this docs-only PR and is carried by objectui#8920. The one literal isgetCellRenderer('select')atObjectGrid.tsx:2607, the badge-prefix widget — no field is involved, so it is neither correct nor incorrect on this axis.Instrument, and the two traps it had to survive
Enumeration and reading come from the same ref (
git grep -n 'getCellRenderer(' HEAD), then non-test / non-packages/fields/ non-markdown lines are classified by tracing each argument's binding to its initializer — never by the identifier's spelling. Both controls fired:resolveCellRendererTypesomewhere (ObjectGrid uses it 3 times, at:30,:2454,:2469). The property is per call site, not per file.ObjectGrid.tsx:2675and:2832each bind a variable literally namedresolvedType, whose initializer isfieldDef?.type || inferColumnType(...)— the declared type, which never passed through the resolver. A probe matchinggetCellRenderer(resolvedSomething)slides straight past both.Positive control on the enumeration side: the same pattern and ref hit the definition,
export function getCellRendereratpackages/fields/src/index.tsx:2697.What changed
#8294 — the fence's argument. The "Using Standard Fields" block resolved the renderer straight off the field's declared type.
field.typeis not always the renderer's key: for a textual base type carrying aformathint,resolveCellRendererTypemaps to the richer renderer. The fence now teaches the two steps, with a comment saying why.The comment's closing claim is now true by construction rather than by census: with no format hint the resolver returns the declared type unchanged (
return fieldOrType.type || 'text', the final line ofresolveCellRendererType), so resolving first is never worse than not. That is read off the resolver itself and cannot rot when call sites move — which is precisely how the deleted sentence went false.The prose sentence one line above the fence is true as written and is untouched — the defect was the argument, not the sentence.
#8292 — a symbol nothing exports. The Features list named
FieldRegistry. Measured: zero occurrences in the tree apart from that line, and no such declaration in the built.d.ts. The role it described is borne byregisterFieldRenderer, which is exported and which the fence one screen below already calls. The line now names it. The backingconst fieldRegistryMap stays module-private, so naming it was never an option; this replaces a phantom reference with a real one rather than with another guess.Why the green gates are not the evidence
getCellRenderer(field.type)type-checks —field.typeis a string, the parameter is a string — socheck:doc-snippetsread the old block green, 0 diagnostics. A green that cannot go red on this defect is not evidence the example was right.And no gate reads the deleted sentence either. The doc gate compiles the fence's code; the false universal lived in a comment, and nothing in the tree pins this page's prose (a whole-tree
git grepforfields/READMEreturns zero hits). A census was the only instrument that could ever have caught it — which is why this body now states its instrument rather than pointing at a check mark.The oracle for the fix itself is the shipped behaviour. Measured against the built
dist(the same entry a consumer imports), rendering aField.text({ format: 'phone' })column both ways:tel:anchortextphoneThe old fence produced
span class="block max-w-full truncate"around the bare number; the new one producesa href="tel:+1-415-555-0134". Neither leg throws, which is the defect's whole shape: a copied cell drops the format hint and nothing anywhere reports it.Severity
priority:p3stands for this PR, whose blast radius is bounded to whoever copies this fence. It no longer rests on the retracted universal. The product defect that universal concealed is real and is graded on its own card, objectui#8920 — the flagship grid dropping format hints on four paths.Verification
Base merged in, not rebased.
origin/main(829a7067c) was merged into the branch as a merge commit (05d3d0e6b); no rebase, no force-push. Every number below was then measured on that merge result at head9ec59f498. Diff versusorigin/main: 2 files, +23 / −3 —packages/fields/README.mdand the changeset, nothing underpackages/fields/src.--build-filter,--concurrency=2)check:doc-snippetspackages/fields/README.md:52:68 TS2554: Expected 1 arguments, but got 2, 638 judged / 1 failedd5e5b022c),git diff HEADempty, gate back to exit 0check:readme-exportscheck:doc-examplescheck:doc-fences/check:doc-links/check:control-bytes/check:unreferenced-sourcescensus:cross-file-line-citationscheck:changeset-presencecheck:governed-queue-guard --test(both paths)pnpm exec vitest run packages/fields/check:doc-examplesrun exited 2 — PREREQUISITE NOT MET,distabsent — which is neither green nor red. It was re-run after the build closure and is the exit 0 in the table.The arity-injection control is re-pinned to this head, not carried over from the previous round: the mutation was proved on disk in both directions (clean form 1 → 0, mutated form 0 → 1) before the gate was run, and the restore was verified by blob hash rather than by an exit code.
Changeset
.changeset/8294-fields-readme-cell-renderer-two-step.md, empty frontmatter — an explicit "no release".scripts/check-changeset-presence.mjsindependently judged none owed: "0 of them published source of a package the release covers, 0 of them a manifest whose published contract moved". Declaring it once beats staying silent, sinceREADME.mdis in this package'sfiles[]and therefore does ship in the tarball.验收备注
Noted while measuring, not filed and not touched here:
@object-ui/fields; an open defect card about a sibling package's internals does not belong on it, and would rot the moment the card lands.check:readme-exportsreports 1 unbuilt package and 3 declaring no types;census:cross-file-line-citationsreports pre-existing drifted and out-of-range citations inscripts/check-vi-mock-specifiers.mjs,scripts/pm/check-half-states.mjsandscripts/vite-dts-fail-on-type-errors.ts. All pre-existing onmain, all outside this diff, both gates exit 0.Generated by Claude Code