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

fix(scripts): pin the retired-field-key tombstone registry as the designer parity gate's single source - #7290

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-6699-registry-single-source
Sep 2, 2026
Merged

yinlianghui merged 1 commit into
mainfrom
claude/issue-6699-registry-single-source

Conversation

@yinlianghui

Copy link
Copy Markdown
Contributor

Fixes #6699

Makes the objectui#6527 tombstone registry the parity gate's single source for retirement. A registry with no gate pinning it is a convention, and conventions drift — this repo's own history is the proof the card cites.

File surface, as dispatched: scripts/check-designer-field-key-parity.mjs and scripts/__tests__/check-designer-field-key-parity.test.ts only. The registry, its test, the three strip sites and permission-slice.ts are untouched.

Measured premise (re-measured on this base, eb33a8d4c)

The gate carried no retired-key set of its own — the card's "derive what it checks from the registry" had no existing copy to delete:

  • KNOWN_UNPARSEABLE_KEYS is {} at run time (node -e "... Object.keys(m.KNOWN_UNPARSEABLE_KEYS)" prints []). It is a different ledger anyway: card-anchored keys whose resolution is still OPEN, with the formula / sortOrder rows already resolved and removed.
  • git grep -n "RETIRED\|retired\|tombstone" over the gate returned only prose — the header's RETIRED_FIELD_KEYS = ['indexed'] sentence is history (lines 51-58), plus one comment.

So the deliverable had to be a concrete, non-vacuous derivation, proven by ablation. It is; the ablation table below is the proof.

The derivation shipped

A retirement is not waivable at a site that strips the key. Where a wire shape IS one of the registry's strip sites (stripSite) and the tombstone marks that site true, a KNOWN_UNPARSEABLE_KEYS row can no longer quiet the key. The ledger is for keys whose resolution is still open; a tombstoned key's resolution already happened, on the card the tombstone names, so a fresh row would re-open a settled retirement in silence — the ledger becoming the hiding place the header's ratchet note says it must never be. The violation cites the registry entry instead of the "file a card and record it in KNOWN_UNPARSEABLE_KEYS" invitation, and the row itself is reported as stale with the registry's reason.

Two ExtractionError link checks come with it, in both directions:

  • a shape naming a stripSite the registry does not declare (a renamed site must not leave a shape enforcing nothing);
  • a registry site this gate accounts for nowhere — named by no shape and not recorded shapeless. This is what makes the registry the single SOURCE rather than a single copy: it cannot grow a strip site while the gate goes on judging only the old three.

The registry is read from the tracked source packages/types/src/internal/retired-field-keys.ts through the TypeScript AST — the same walk PAYLOAD_SHAPES already use — not through the built @object-ui/types/internal/retired-field-keys subpath, so the gate gains no build precondition and still runs on a cold cache. Extraction failure is an ExtractionError, never a pass and never a silent skip: missing file, missing constant, empty tombstone array, a tombstone with no key or no retiredBy, a non-boolean column, or a sites record naming a site outside RETIRED_FIELD_KEY_SITES. The header's two standing constraints are kept as they were: extraction failure is an ERROR, and the accept set is still read from the installed schema and never listed in the file.

Rejected, with the measurement

  • Registry/oracle agreement in the gate (route (ii) — "every tombstone key must be refused by the installed FieldSchema"). Rejected as a duplicate. packages/types/src/__tests__/retired-field-key-tombstones.test.ts already pins exactly this, per key, with unrecognized_keys asserted and a positive control: "every registry key is refused BY NAME by the installed FieldSchema" (lines 104-113). A second copy of an assertion is a second thing to keep honest. The gate leans on route (i) instead, and its header says so.
  • A flat "retired everywhere" key set. Rejected on the card's own terms, and the rejection is measured rather than asserted: ablation A3 flattens inForce to Object.values(sites).some(Boolean) and two pins go red. A flat set decides sortOrder at MetadataFieldsPage and formula at the read door in the direction the registry refused.
  • Widening the charter to make a tombstoned key on a UI-only shape a violation. Rejected as a policy change with no ruling behind it: isSystem and referenceTo are tombstoned keys the in-memory model still declares, the converters strip them, and uiOnly is the correct verdict. They are now annotated with their retiring card in the run log instead — visible, not red.

Per-site columns: consumed vs deliberately not

Column Consumed? Why
key yes the identity the rule is keyed on
retiredBy yes the citation the gate prints in place of inviting a ledger row
sites yes, per site inForce is sites[thisShape.stripSite] === true; the whole record is reproduced verbatim in the citation, on both the stripped and NOT-stripped sides
specEquivalent no — not even extracted documentation, never an instruction to rename. objectui#6043 refused exactly that rename for formula (FieldSchema validates the key, not the language, so a blind rename launders non-CEL text into a formula that parses green and evaluates to null). A gate that read it would sooner or later suggest it.
defensive no — not even extracted it records how strong the EVIDENCE for a strip is (objectui#6045's recorded verdict). That is the registry's verdict to keep; it is no input to a key-NAME parity comparison, and consuming it would let the gate silently treat a defensive strip as weaker than the registry says.

The asymmetry survives as data, and is measured:

  • formula at the read door. The gate asserts nothing at metadataAdminFieldsReadDoor and cannot: the read door declares no payload shape at all (coverage note 3 — readFields carries raw Record defs), so it is recorded in SITES_WITH_NO_DECLARED_SHAPE with that reason and no shape can name it. Where formula IS cited, the read door appears only on the NOT stripped at side — the registry's own word for it, never inverted. This keeps objectui#6526 option B structurally out of the gate's reach: "the READ door must NOT strip it (false) — RULED, objectui#6526 option B … Flipping this false is overturning a maintainer ruling, not tidying an inconsistency."
  • sortOrder's single site. Treated exactly as the registry states it — true at metadataServiceCarryOver, false at metadataFieldsPageCarryOver. One key, one ledger row, two sites, two different verdicts: at the stripping site the row is refused; at the other the ordinary ledger path applies and the row is honoured, because there the registry makes no claim to enforce. That pair is a test (⭐ the SAME key at a site whose column is false …) and it is what a flattened set cannot produce.
  • The FIELD registry never reaches the OBJECT oracle. sortOrder is refused at both levels by two different schemas and is two different cards (objectui#6045 field-level, objectui#6223 object-level). The citation is scoped to FieldSchema, so the object-level card's own ledger row still works — pinned, and visible in the run log where ObjectDefinition's sortOrder is the one uiOnly entry carrying no citation.

Ablation table

Every leg: mutate, prove the mutation ON DISK by text count and by git hash-object differing from the HEAD blob, measure, restore, prove the restore by blob hash equal to HEAD and an empty git diff HEAD — never by an exit code. The harness carries trap ... EXIT INT TERM with absolute paths, so a mid-run kill cannot leave the tree mutated. A1-A5 mutate the gate (mine to mutate, in my worktree); A6 mutates a copy of a real wire-shape file, because the strip sites are fenced.

# Mutation Disk proof Result
A1 remove the waiver ban (waivable && !(retired && retired.inForce) to !(false && …)) anchor-gone=0 injected=1, blob 3b2062f3 vs HEAD 93a13cf5 RED — 2 failed / 60 passed: expected [] to deeply equal [ 'formula:true' ], [ 'sortOrder:true' ]
A2 extraction returns no tombstones (tombstones: []) — the silently-empty read anchor-gone=0 injected=1, blob ed705770 RED — 6 failed / 56 passed, starting with the non-vacuity floor: expected [] to deeply equal ArrayContaining
A3 flatten the registry: inForce ignores the per-site column anchor-gone=0 injected=1, blob 5fdf7abc RED — 2 failed: the false-column case starts refusing the waiver (expected [ {…} ] to deeply equal []) and inForce flips (expected true to be false)
A4 drop the read door from SITES_WITH_NO_DECLARED_SHAPE anchor-gone=0 injected=1, blob bb3c5cc7 RED — gate exit 1: EXTRACTION FAILED … declares strip site(s) 'metadataAdminFieldsReadDoor' this gate accounts for nowhere; 30 test failures
A5 cross the site map (swap the two stripSite values) order on disk swapped to [metadataFieldsPageCarryOver, metadataServiceCarryOver], blob deb1e32f RED — 2 failed: FieldMetadataPayload is mapped to the wrong site
A6 re-declare formula on a copy of MetadataService.ts + a matching ledger row injected=1 delta=1, copy blob 57277b29 vs original HEAD blob e41a23fa; original blob after the run e41a23fa (untouched), git diff HEAD empty RED, naming the tombstone: waiverRefused: true, retiredBy: objectui#6043, inForce: true, strippedAt: [metadataServiceCarryOver, metadataFieldsPageCarryOver], notStrippedAt: [metadataAdminFieldsReadDoor]; stale row: "the registry retires it (objectui#6043) and metadataServiceCarryOver strips it — a retirement cannot be waived by a ledger row"

Every restore leg printed blob == HEAD and git diff HEAD: ''; the harness's final line confirms a clean tree.

Gate verdict lines, before and after

Before (eb33a8d4c, exit 0) and after (2c9a1ec26, exit 0) both end in designer-field-key-parity: OK. The run gained the registry block, so a silently empty extraction cannot read as "nothing is retired" in a green log:

  Retired-key registry: packages/types/src/internal/retired-field-keys.ts — 5 tombstones over 3 sites
    metadataAdminFieldsReadDoor  -- no statically declared payload shape (coverage note 3) — nothing is judged at this site
    metadataServiceCarryOver     -> FieldMetadataPayload (packages/app-shell/src/services/MetadataService.ts)
    metadataFieldsPageCarryOver  -> ServerFieldSchema (packages/plugin-designer/src/MetadataFieldsPage.tsx)

and the two retired spellings still on the UI model are now annotated rather than reading as ordinary UI keys:

    isSystem         (DesignerFieldDefinition, vs FieldSchema)  [retired objectui#6044]
    referenceTo      (DesignerFieldDefinition, vs FieldSchema)  [retired objectui#6041]
    sortOrder        (ObjectDefinition, vs ObjectSchema)

(the object-level sortOrder deliberately carries none — different oracle, different card.)

Gates run, with their own verdict lines — all at 2c9a1ec26, the final commit

Exit codes captured by redirect-then-$?, never through a pipe.

Command Exit Verdict line
pnpm exec vitest run scripts/__tests__/check-designer-field-key-parity.test.ts scripts/__tests__/zod-wrapper-keys.shared.test.ts --maxWorkers=2 0 Test Files 2 passed (2) / Tests 69 passed (69) — the parity file went 45 to 62 cases
pnpm check:designer-field-key-parity 0 designer-field-key-parity: OK
pnpm type-check:scripts 0 (clean tsc -p tsconfig.scripts.json)
pnpm check:control-bytes 0 check-control-bytes: OK (scanned 6008 tracked text file(s); skipped 85 binary).
pnpm check:entry-guard 0 check:entry-guard: 58 scripts/ file(s) — no entry guard outside the baseline; … 52 export bindings, 52 of them inert on import
pnpm check:esm-specifiers 0 no un-ledgered package emits an extensionless relative specifier
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. (2 files changed, 0 published source)

Declared narrowing — lint. Repo-wide pnpm lint was NOT run; it is a repo scan CI owns, and it is not in this card's gate list. eslint --no-inline-config was run on the two changed files: 0 errors, 0 warnings, and the narrowing is measured rather than assumed — (1) the universe read from ESLint's OWN config via its API (isPathIgnored + calculateConfigForFile over every tracked file): 4024 of 6093 tracked files carry rules, 1964 are ignored by eslint's own config, 105 match no rule-carrying entry; (2) files actually linted, from --format json: 2; (3) eslint.config.js declares no parserOptions.project and no projectService, so type-aware linting is off and no rule's verdict on an untouched file can move with this diff — the only cross-file rule configured is no-restricted-imports, which is per-file, and the only file importing the gate is its own test, which was linted.

No console build was needed and no heavy verify was run, so the shared verify lock was not taken.


🤖 Generated with Claude Code

https://claude.ai/code/session_01BGMDbrVa8JjZcCQ7DWYH1b


Generated by Claude Code

…esigner key-parity gate

`check-designer-field-key-parity.mjs` now reads
`packages/types/src/internal/retired-field-keys.ts` (the objectui#6527 registry)
off the tracked source via the TypeScript AST — the same walk it already uses
for `PAYLOAD_SHAPES`, so the gate gains no build precondition — and derives one
rule from it: a retirement is NOT waivable at a site that strips the key. Where
a wire shape IS one of the registry's strip sites and the tombstone marks that
site `true`, a `KNOWN_UNPARSEABLE_KEYS` row can no longer quiet the key; the
violation cites the registry entry instead of inviting a new ledger row, and the
row itself is reported as stale.

The per-site asymmetry survives as DATA: the rule is evaluated per (key, site),
the citation reproduces the tombstone's columns verbatim on both the stripped
and NOT-stripped sides, and the read door — which declares no payload shape
(coverage note 3) — is recorded shapeless so nothing is ever asserted there.
That keeps objectui#6526 option B (`formula` must NOT be stripped at the read
door) structurally out of the gate's reach. A registry site the gate accounts
for nowhere, a shape naming a site the registry does not declare, and every
unreadable registry are `ExtractionError`s, never a pass.

Columns consumed: `key`, `retiredBy`, `sites`. `specEquivalent` and `defensive`
are deliberately not read. The registry's own contract stays pinned by
`packages/types/src/__tests__/retired-field-key-tombstones.test.ts` and is not
duplicated here.

Fixes #6699

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BGMDbrVa8JjZcCQ7DWYH1b
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

2 participants