Repository navigation
fix(scripts): derive the indirect registrations' namespace from the call, not from the hand-kept table - #9716
Conversation
`INDIRECT_REGISTRATIONS` entries carried a hand-kept `namespace` that was an INPUT to `deriveRegistryKeys`, with nothing reconciling it against the registration call it described. A namespace edit at one of those call sites could not reach the generated key universe, and the derivation stayed green while disagreeing with the runtime. The namespace is now READ from the call — it is a plain string literal at every site this covers — and the table's value is demoted to a declaration that must match it, reported as `indirect-namespace-drift` when it does not. An unreadable or ambiguous namespace is reported rather than taken from the table, because taking it from the table is the defect. `skipFallback` is decided per key at these calls and genuinely cannot be derived, so `skipFallbackSet` stays declared — and a set name that stops resolving is now reported instead of read as an empty set, which silently padded the universe with bare fallbacks the runtime does not publish. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UanLVj6xvbS6puBCewLr8L
|
changeset-claim-re-read
|
|
| probe | origin/main |
this PR's head |
|---|---|---|
my-component in check-doc-component-types.mjs |
6 | 6 |
lit control — INDIRECT_REGISTRATIONS in the same file |
7 | 11 (this PR adds to it) ⇒ instrument sees the diff |
| absent control | 0 | 0 |
⇒ the exemption is untouched, and the lit control proves the probe can see changes in that file rather than reading a stale blob. The rest of the paragraph is about the defect's direction and its corpora, none of which this diff moves.
.changeset/8499-node-slot-registered-arms.md is the declared file surface of in-flight card objectui#9704 (PR objectui#9715), which is editing that very body right now. Even had a claim gone false, this PR ⛔ must not touch it — and the dev correctly did not. The serial fence held: this PR's file list is scripts/ only.
⭐ A correction to the card's own figure — the PM's error, confirmed at the source
The dev reports that this card's "132 of the 649 generated keys" is a category error, and it is right. Verified at the counter itself:
scripts/check-doc-component-types.mjs:1528
counters.indirect += names.length;
⇒ counters.indirect increments by the number of collection names, not by keys. The real shape, per the dev: those 132 names produce 245 key attributions / 210 distinct keys, of which 188 are reachable only through this route and 22 also have a direct call site.
"132 of 649 generated keys" counts names and reports keys. That sentence is mine — it went into the filing and the triage seat repeated it from there. ⭐ It is this board's own maxim turned on its author: a count answers the question the query asked, not the question you meant.
⇒ the defect the card describes is real and its mechanism is unchanged; only the cardinal was wrong, and it was wrong in the direction of understating the exclusive-route population (188, not 132).
The escalation condition did not fire
Triage set it: any disagreement between the table's asserted namespace and the call's namespace means an existing phantom key and priority:p1. The dev ran it first, as instructed — 245 rows, 0 disagreements, 0 unreadable, with controls that mutate each collection in turn and report 77 and 168 disagreements respectively, summing to the whole 245-row population. The instrument lights and is exhaustive. ⇒ no escalation; the gap is a blind spot with no live victim, which is what licenses the repair.
Read at 2026-09-17T18:50Z.
Generated by Claude Code
Fixes #9703
Clause-②: no
The measurement came first, and it is clean
The triage seat named a measurement as the first deliverable and said it had not run it: for each key whose namespace comes from the hand-kept
INDIRECT_REGISTRATIONStable, compare the namespace the table asserts against the namespace the registration call passes. Escalation condition: any disagreement means an existing phantom key andpriority:p1.Result: 0 disagreements, 0 unreadable. No escalation. The table is accurate today; the gap is a real blind spot with no live victim, which is what permits the repair below.
PROTOCOL_COMPONENTS(placeholders.tsx)protocol-placeholderprotocol-placeholderfieldWidgetMap(fields/src/index.tsx)fieldfieldThe call-site half was read by an independent reader that consults the table only for which file to open. The three collection-keyed registration calls it found, and their namespaces:
placeholders.tsx—registerPlaceholder,namespace: 'protocol-placeholder'fields/src/index.tsx—registerField,namespace: 'field'fields/src/index.tsx— theRETIRED_FIELD_TYPEStombstone loop inregisterAllFields,namespace: 'field'Controls (same instrument, same corpus). Two zeros on one instrument would be a broken instrument. Each entry's declared namespace was mutated in turn through the derivation's own
indirectRegistrationsinjection point:fieldWidgetMapentry →NOT-THE-CALL-NSPROTOCOL_COMPONENTSentry →WRONG-NS77 + 168 = 245, the whole population. The instrument lights.
A reading correction to the card's figure
counters.indirectis 132, but it counts collection NAMES, not generated keys. Those 132 names produce 245 key attributions / 210 distinct keys in the 649-key universe — 188 of them reachable only through this route, and 22 also produced by a direct call site (so their namespace has a second, derived source). "132 of 649 generated keys" is the name count, not a key count, in either direction.The repair
The card's preference order is (1) delete the construction that permits the error, then (2) make the correct form the only spelling, and only last (3) add a check. (1) is reachable here, and cheaply — unlike the general problem objectui#9641 spent four rounds on: the
namespaceat each of these calls is a plain string literal, so nothing has to be approximated.entry.namespaceis demoted from an input to a declaration, reconciled against the call and reported asindirect-namespace-driftwhen the two disagree. The universe follows the call.skipFallbackis deliberately not derived, and this is the honest end state the card predicted. These helpers decide it per key at the call (FIELD_TYPES_SKIP_FALLBACK.has(fieldType)), so the call carries no answer for any individual key.skipFallbackSettherefore stays declared — but the other direction of the same defect is now closed:literalSetreturned an empty Set for a name that no longer resolves, which silently gave every key of the collection a bare fallback the runtime does not publish. That is now reported.The derived universe is byte-identical before and after (649 keys, 0 findings), and
regenerate-known-schema-types.mjsreportspackages/cli/src/utils/known-schema-types.tsstill matches. This changes what can go wrong silently, not what the tree derives today.Gates — printed verdict lines, exit codes captured before any pipe
pnpm check:doc-types✅ Every documented component type is registered.(649 keys, 132 indirect, 2 open)pnpm check:registry-bare-names✓ no new bare-name collision; every contested key is a declared, unresolved decision.pnpm check:prompt-keysOK Every key taught as available is answered by a real renderer…node scripts/check-control-bytes.mjs✅ check-control-bytes: OK (scanned 7814 tracked text file(s); skipped 85 binary).node scripts/check-changeset-presence.mjs✅ No source or published contract of a released package changed in this range, so no changeset is owed.pnpm check:new-line-citationsVERDICT new-cross-file-line-citations: 0 new citation(s), enforcement report-only -> exit 0vitest run scripts/Test Files 8 passed (8)·Tests 186 passed (186)No changeset: the diff is
scripts/-only, which the presence gate confirms is not published source.Ablation — both new pins proved able to fail
Each leg mutated the fix, proved the mutation reached disk (anchor gone, injected text present, non-zero byte delta), ran the pins, restored with
git checkout HEAD -- ABSOLUTE_PATH, and proved restoration by blob equality and an emptygit diff HEAD.namespace = observed[0]→namespace = declared(the pre-fix table-as-input reading)if (entry.skipFallbackSet && skip.size === 0)→if (false)//, which broke theperl -0pi -e "s/…/…/"delimiter, andperlaborted while the surrounding step would have read as a run. The on-disk landing check caught it (anchor still 1, injected 0, byte delta 0) and the reading was voided rather than reported. The rerun above used a writer that asserts a single anchor match.Found and deliberately NOT done
field:owneris registered at runtime and absent from the derived universe — and it is not a namespace disagreement, so by the letter of the triage seat's escalation condition it does not triggerpriority:p1. Reported here for the PM to route rather than repaired in the same breath.registerAllFields()registers every key ofRETIRED_FIELD_TYPES(today:owner) withnamespace: 'field', skipFallback: true. The derivation never sees it: the indirect bypass in the call-site loop is keyed by FILE (indirectSites.has(rel)), while the table's coverage is keyed by COLLECTION — so any unresolvable registration in a file named in the table is skipped silently, including one whose collection the table does not name.Measured, with lit controls on the same instrument and corpus:
known-schema-types.tsfield:ownerownerfield:user(control)protocol-placeholder:view:grid(control)⛔ Not repaired here, and not because it is small: closing it needs a decision, not a mechanical edit. Surfacing that call would make it an
unresolved-registrationfinding, and whether retired tombstone spellings belong in a universe whose job is "does this string name a component that exists" is a judgement — a doc teachingfield:ownerarguably should be red, which is what happens today, correctly but by accident. That is a maintainer's call, not a taker's.Noted, not filed: the
INDIRECTparagraph in this file's header and theINDIRECT_REGISTRATIONSdocblock both described the namespace as declared in the table; both are updated in this PR, since the sentence would otherwise be false the moment the code changed.维护者速读(草稿)
改了什么 —
scripts/check-doc-component-types.mjs里那张手工维护的INDIRECT_REGISTRATIONS表,原本它的namespace字段就是推导用的值。现在改成从注册调用里读,表里那份降级为「声明」,两者不一致就报错。另外补了一个守卫:表里声明的 skip 集合名字如果失效,原先会被静默读成空集合。为什么改 — 手工名单一旦成为推导的输入,它过期就不再是「名单错了」而是「推导错了」,而推导是绿的。有人改了注册调用的命名空间,生成的键清单收不到,
objectui check继续拿旧的校验。风险与代价(含回滚) — 低。推导出的 649 个键改动前后完全一致,生成的
known-schema-types.ts未变。新增三种 finding,今天都不触发。回滚 = revert 本 PR,无数据迁移、无发布面变化,故无 changeset。唯一的设计约束:同一个文件里若出现两个不同命名空间的集合注册,会报unresolved-indirect-namespace要求先教会推导——这是刻意的,猜测正是本卡要删掉的那个构造。席位意见 — (留空,待席位定稿)
你要做的 — 一件事需要裁决:
field:owner这个运行时真实注册、却从未进入生成清单的键(见上面 "Found and deliberately NOT done")。退役拼写要不要进这个「这个字符串是不是一个真实存在的组件」的清单,是产品判断,我没有替你决定。🤖 Generated with Claude Code
https://claude.ai/code/session_01UanLVj6xvbS6puBCewLr8L
Generated by Claude Code