Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

fix(scripts): derive the indirect registrations' namespace from the call, not from the hand-kept table - #9716

Merged
os-sales merged 1 commit into
mainfrom
claude/issue-9703-indirect-registrations-reconciliation
Sep 17, 2026
Merged

os-sales merged 1 commit into
mainfrom
claude/issue-9703-indirect-registrations-reconciliation

Conversation

@os-sales

Copy link
Copy Markdown
Collaborator

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_REGISTRATIONS table, compare the namespace the table asserts against the namespace the registration call passes. Escalation condition: any disagreement means an existing phantom key and priority: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.

collection table asserts call passes rows verdict
PROTOCOL_COMPONENTS (placeholders.tsx) protocol-placeholder protocol-placeholder 168 agree
fieldWidgetMap (fields/src/index.tsx) field field 77 agree
245 245 agree · 0 disagree

The 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 — the RETIRED_FIELD_TYPES tombstone loop in registerAllFields, 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 indirectRegistrations injection point:

leg mutation disagreements reported exit
baseline none 0 0
control A fieldWidgetMap entry → NOT-THE-CALL-NS 77 1
control B PROTOCOL_COMPONENTS entry → WRONG-NS 168 1

77 + 168 = 245, the whole population. The instrument lights.

A reading correction to the card's figure

counters.indirect is 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 namespace at each of these calls is a plain string literal, so nothing has to be approximated.

  • The namespace is now read from the registration call. entry.namespace is demoted from an input to a declaration, reconciled against the call and reported as indirect-namespace-drift when the two disagree. The universe follows the call.
  • An unreadable or ambiguous namespace is reported, never taken from the table — falling back to the table would restore exactly the unreconciled reading this card is about.
  • ⚠️ skipFallback is 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. skipFallbackSet therefore stays declared — but the other direction of the same defect is now closed: literalSet returned 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.mjs reports packages/cli/src/utils/known-schema-types.ts still matches. This changes what can go wrong silently, not what the tree derives today.

Gates — printed verdict lines, exit codes captured before any pipe

gate exit printed verdict
pnpm check:doc-types 0 ✅ Every documented component type is registered. (649 keys, 132 indirect, 2 open)
pnpm check:registry-bare-names 0 ✓ no new bare-name collision; every contested key is a declared, unresolved decision.
pnpm check:prompt-keys 0 OK Every key taught as available is answered by a real renderer…
node scripts/check-control-bytes.mjs 0 ✅ check-control-bytes: OK (scanned 7814 tracked text file(s); skipped 85 binary).
node scripts/check-changeset-presence.mjs 0 ✅ No source or published contract of a released package changed in this range, so no changeset is owed.
pnpm check:new-line-citations 0 VERDICT new-cross-file-line-citations: 0 new citation(s), enforcement report-only -> exit 0
vitest run scripts/ 0 `Test Files 170 passed
8 consumer suites of this script 0 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 empty git diff HEAD.

leg mutation byte delta result
namespace reconciliation namespace = observed[0] → namespace = declared (the pre-fix table-as-input reading) +54 `1 failed
skip-set guard if (entry.skipFallbackSet && skip.size === 0) → if (false) −35 `1 failed

⚠️ Recorded rather than quietly retried: the first attempt at leg 1 was a no-op — the injected text contained //, which broke the perl -0pi -e "s/…/…/" delimiter, and perl aborted 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:owner is 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 trigger priority:p1. Reported here for the PM to route rather than repaired in the same breath.

registerAllFields() registers every key of RETIRED_FIELD_TYPES (today: owner) with namespace: '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:

probe in derived universe in known-schema-types.ts
field:owner false false
owner false false
field:user (control) true true
protocol-placeholder:view:grid (control) true n/a

⛔ 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-registration finding, 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 teaching field:owner arguably 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 INDIRECT paragraph in this file's header and the INDIRECT_REGISTRATIONS docblock 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

`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
@github-actions github-actions Bot added the tests label Sep 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

changeset-claim-re-read

⚠️ 1 pending changeset(s) describe a file this change touches

Their bodies publish verbatim into the CHANGELOG at the next release, so this is a request to re-read them against your diff — addressed here because you are the one seat that can answer it without re-deriving anything.

⛔ Nothing here blocks, and nothing here is a verdict on your change. This gate exits 0, is not a required context, and judges name resolution, never meaning: it asked whether a pending body names a file you touched. "Is this sentence still true?" is the one question it will not answer, and the one you are being asked to answer.

.changeset/8499-node-slot-registered-arms.md

  • names scripts/check-doc-component-types.mjs → scripts/check-doc-component-types.mjs — edited by this change

    The defect, and the direction it ran. Nine type spellings sat at DECLARED node slots in this repository's own corpora and resolved in no arm of the component union. Eight were registered renderers with fixtures proving they draw; the ninth (my-component) is the reader's own plugin component and carries a written exemption in scripts/check-doc-component-types.mjs. A reader following content/docs/utilities/runner.mdx's own instruction — "copy one, wrap it in a page document … and save it as src/app-data/pages/index.json" — got a document that renders correctly in the browser and is refused by objectui check. That is the expensive direction: the likely reaction is to stop trusting the validator.

Read the paragraph, not the line: both false halves of the objectui#8617 claim sat in one paragraph, and correcting either alone would have left it asserting the same wrong thing.

If a claim did go false, correct the body. That is precedented and prose-only, frontmatter untouched; check-changeset-overwrite.mjs will report the correction as its own case 2 ("correcting a declaration on purpose … legitimate"), which is the intended shape — one gate asks for the read, the other records the write.

Not covered, stated so nobody reads this as more: a claim that was born false (a changeset this change adds is excluded by construction), a claim spelled as a symbol or a package rather than a backticked file name, and a file named ambiguously.

Compared the checked-out tree with 50e5cafe3 (merge-base with origin/main): 2 file(s) changed outside .changeset/, read against 1127 pending declaration(s) that publish a body (1637 pending in total). · run

Copy link
Copy Markdown
Collaborator Author

changeset-claim-re-read verdict — no correction owed

Seat: domain:spec#1 · Session: session_01UanLVj6xvbS6puBCewLr8L

The gate is report-only, exits 0, is not a required context, and asks one question it will not itself answer: is .changeset/8499-node-slot-registered-arms.md's claim still true against this diff.

Verdict: STILL TRUE. ⛔ Nothing to correct.

The quoted paragraph's load-bearing assertion is that my-component "carries a written exemption in scripts/check-doc-component-types.mjs" — the one file this diff edits. Measured:

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.

⚠️ Deliberate non-action worth naming: .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

@os-sales
os-sales marked this pull request as ready for review September 17, 2026 19:10
@os-sales
os-sales added this pull request to the merge queue Sep 17, 2026
Merged via the queue into main with commit 4cf57b6 Sep 17, 2026
35 checks passed
@os-sales
os-sales deleted the claude/issue-9703-indirect-registrations-reconciliation branch September 17, 2026 19:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

2 participants