Skip to content

fix(metadata-protocol): the delete heal never registers a picked holder of a name two packages hold - #34092

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/area-E1b-33832
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/area-E1b-33832

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread
Fixes #33832
Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:两个包同名的仪表板、报表(以及同类"按包寻址、但元数据服务按名字只存一份"的类型)在删除一条记录后,注册表自动修复不再把"最后注册的那个包"的内容塞进裸槽位。
  • 为什么改:元数据服务对这些类型每个名字只留最后注册的一份,修复时拿它当基线等于在两个包之间"猜一个"(违反 ADR-0150 D3)。真实启动实测:删除后注册表的裸查找改答最后注册的包,列表里同一项出现两次;对外的读接口(裸读 409、按包读各自内容、列表接口)不受影响。
  • 风险与回滚:只在注册表里有两个及以上持有包时跳过基线读取,单持有包照旧恢复;回滚即 revert 本 PR。
  • 先看:packages/metadata-protocol/src/protocol-registry-hydration.ts 的 readHealBaseline 开头新增的判断,再看 packages/objectql/src/protocol-registry-heal-packageless-refusal.test.ts 末尾新增的 describe。
  • 两分钟验证:pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/protocol-registry-heal-packageless-refusal.test.ts(需先构建 metadata-protocol),预期 12 个用例全绿。
  • 需要你做的:无,席位落地。

What changes

Ruling: ADR-0150 D3 (a bare read never picks between holders) and epic ruling 6818436831, which says of this heal: "Nothing picks a holder and no baseline is registered. The next bare read is the 409 naming exactly the two holders." Seat ruling 6812637203 Q2 ruled the same footing: "the removed row's entry in the bare slot is retired and no baseline is registered."

readHealBaseline (the delete heal's tier 2) now returns a settled miss, before any service read, for a type that is addressed by (package, name) (isPackageScopedType) but is stored in the metadata service by name alone (outside PACKAGE_SLOTTED_STORE_TYPES), when the registry holds the name for two or more packages (packageScopedHoldersOf, disabled packages counted). For those types the service keeps only the item registered last and answers it to a read naming any package or none, so its answer there is a pick. Tier 3 then retires only the removed row's own bare-slot entry (its verb refuses a packaged artifact). A name one package holds is read as before.

The types this reaches: dashboard, report, page, app, book, analytics_cube, hook, job, sharing_rule, queue, assignment_rule. Pinned: dashboard and report, the card's two.

No change to protocol.ts, to applyRegistryWriteThrough, to restoreArtifactRegistryView's catch branch, to the objectql registry, or to any spec surface.

The premise, measured on a real boot (H2 first)

A kernel booted from a compiled artifact with three package bodies (alpha and beta each ship dashboard mix_dash and report mix_rep; a third, other, ships neither), the way createStandaloneStack composes it (MetadataPlugin's artifact door plus AppPlugin over the same bundle). Both registration orders, both kernel shapes (environmentId: env_local with DB hydration, and none), 8 boots, at 45dee177. A scratch rig, not committed.

  • The card's exact shape does not form on a real boot. Every boot registered both holders in composite slots (com.qa.alpha:mix_dash, com.qa.beta:mix_dash). The metadata service kept only the body registered last, and answered it both bare and for other.
  • The pick does form. PUT of dashboard mix_dash naming other was accepted (row stored, bound to other, kept out of the bare slot). Its delete answered success: true, logged nothing, and left the last-registered holder's body in the bare slot. After that registry.getItem(type, name) answered that holder (it answered the first-registered one before), and registry.listItems(type) listed that holder twice (3 entries for 2 holders). For report the save was refused (the rig's dataset did not exist), and the delete with no row still ran the heal and planted the same entry.
  • What did not move: the protocol reads. The bare read was the 409 naming both holders, each holder's read served its own item, the read naming other was refused, and the protocol list showed each holder once, before and after. The composite slots answer them.

So the card's symptom (a holder's read refused naming the other) is unreachable on a real boot, while its mechanism (tier 2 registers a picked holder) reproduces there. This PR takes the fix route for the mechanism.

FROM → TO

Reading after the delete of a non-holder's row, two holders, either order FROM (45dee177) TO
Registry bare slot of the name the last-registered holder's item empty
registry.listItems(type) entries of the name 3 (that holder twice) 2 (each holder once)
registry.getItem(type, name) the last-registered holder the registry's first-composite fallback, as before the delete (follows from the empty bare slot; not re-read on the rig)
Protocol reads: bare / each holder / non-holder / list 409 both / own / 409 / each once unchanged
Heal log line none none
One holder (CONTROL) that holder's baseline registered unchanged

Clause-②: no: no accepted or served answer of any door moves; only the registry's internal bare slot does.

Tests

packages/objectql/src/protocol-registry-heal-packageless-refusal.test.ts (the shared real-registry heal harness), one new top-level describe on a real SchemaRegistry and a real MetadataManager, in the real boot's shape: each holder in its composite slot, the service keeping the last-registered one, the non-holder's stored row hydrated by loadMetaFromDb and kept out of the bare slot.

  • dashboard and report, each in both registration orders: after deleteMetaItem naming the non-holder, the bare slot is empty, the registry lists each holder once, each holder's read serves its own item, the bare read is the 409 naming both holders in registration order, and the heal logs nothing.
  • CONTROL, dashboard with one holder: the same delete still registers that holder's baseline in the bare slot.

Ablation, once, with the fix committed first. objectql pins resolve @objectstack/metadata-protocol through dist/, so each leg was rebuilt and preflighted.

  • Mutation through scripts/ablation-replace.mjs: the guard's return line replaced by a marker assignment (anchor 1 → 0, blob 5b888bd3 → 8f51c415). pnpm --filter @objectstack/metadata-protocol build exit 0; ablation-dist-preflight exit 0 (marker in dist/index.js and dist/index.cjs).
  • Mutated run: 4 failed, 8 passed (12). All four two-holder cases failed at the bare-slot assertion: expected 'shipped:com.acme.beta' to be undefined (alpha first) and expected 'shipped:com.acme.alpha' to be undefined (beta first). The CONTROL and the 7 existing cases passed.
  • Restore: blob back to 5b888bd3 = HEAD, git diff HEAD empty, rebuilt (exit 0), ablation-dist-preflight --absent exit 0 (marker absent from all 24 built files, tree clean). Restored run: 12 passed (12).

Acceptance notes

  • The no-composite shape the card measured (holders only in the metadata service) does not form on a real boot: every real boot above registered both holders in composite slots. In that harness shape the service holds one item for the name (the other was overwritten), so the registry knows no second holder and this change does not move it. Recorded, not filed.
  • A delete naming a package that stores no row of the name answered success: true and ran the heal (the report rig above). With this change it registers nothing for a two-holder name. Recorded for the seat, not filed.

Verification

Readings at the heads named. HEAD 929fc53e43 is the final head (origin/main merged in twice; the second merge brought #33851's edits to the same file, in other functions).

Package suites and typechecks
  • At 9c4f75f36e (first merge of main), under the verify lock: @objectstack/metadata-protocol typecheck exit 0, test exit 0 (341 files passed, 9 skipped; 22894 tests passed, 43 skipped). @objectstack/objectql typecheck exit 0, test exit 0 (596 files, 13177 tests). Direct dependents: @objectstack/rest test exit 0 (412 files; 8442 passed, 332 skipped), @objectstack/runtime test exit 0 (605 files; 10958 passed, 19 skipped).
  • At 929fc53e43, after the second merge (closure rebuilt, exit 0): the heal harness protocol-registry-heal-packageless-refusal.test.ts 12/12; metadata-protocol protocol.registry-heal-package-read.test.ts plus protocol.revert-commit-honest-outcome.test.ts (metadata-protocol: registry write-through faults for non-object types are only logged, so revertCommit cannot report them #33851's pins on the same walk) 48/48; metadata-protocol and objectql typecheck exit 0. The full suites were not re-run at this head; CI's Test Core runs them.
Derived gates
  • dispatch-gates --commands --repo objectstack-ai/objectstack at 929fc53e43: 67 families derived; 65 run unlocked, each exit 0 (the PR-body gates read this body through GITHUB_EVENT_PATH); check:type-check-debt run under the verify lock, exit 0 (0 raw tsc errors above the ledger). check:dual-build-cjs-loads NOT MEASURED (needs a full-repo dist/), left to CI. --ran reconciliation: 67 derived, 66 run, 0 not measured, 1 unrun (that one).
  • ESLint (--no-inline-config) over the two touched source and test files: exit 0.
Declaration self-check

Clause-②: no and Metadata-protocol: none, as claimed: no door's accepted or served answer moves (the protocol reads were read before and after on the real boot), no export or spec surface changes, so no !, no BREAKING banner and no ADR-0087 marker. dispatch-gates --tier: no path-derived mandate, 117 changed lines. Compared with #33646 (yes (narrowing) with !: served → refused answers) and #33769 (yes (widening): new exports): neither shape applies here.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QsR2jUcj2x2Wr4UErwBi12

…ervice cannot name a holder

A type addressed by (package, name) that the metadata service stores by name
alone keeps the item registered last. With two or more registry holders of
the name, tier 2 registered that item in the bare slot: a pick between
holders (ADR-0150 D3). Return a settled miss there instead.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jUcj2x2Wr4UErwBi12
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

1 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json ea6de745cce19d0de551e938a6fc6bbe975dd35e → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 3e87d87c9ac151830df94d3ed3db1ee2fed4ed04 — the merge of head d2aa1132d3d45688ee1604ae421443028e013c3e into base ea6de745cce19d0de551e938a6fc6bbe975dd35e, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 3e87d87c9ac151830df94d3ed3db1ee2fed4ed04 && git checkout 3e87d87c9ac151830df94d3ed3db1ee2fed4ed04
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin ea6de745cce19d0de551e938a6fc6bbe975dd35e d2aa1132d3d45688ee1604ae421443028e013c3e && git checkout -B drift-repro ea6de745cce19d0de551e938a6fc6bbe975dd35e && git merge --no-ff d2aa1132d3d45688ee1604ae421443028e013c3e

node scripts/docs-audit/affected-docs.mjs --json ea6de745cce19d0de551e938a6fc6bbe975dd35e

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jUcj2x2Wr4UErwBi12

Test Core (3/8) red at head 929fc53e43 (run 43746511979, job 132912001675): not this diff.

  • Only one test fails: @objectstack/scenarios test/runner/run-date.test.ts, 3 cases ("run on 2028-02-28 / 02-29 / 03-31 ..."). Each fails with Test timed out in 5000ms at line 194. The cases took 5.1 to 6.3 s. The other 74 turbo tasks passed (Tasks: 74 successful, 75 total, Failed: @objectstack/scenarios#test).
  • The test cannot reach this diff. @objectstack/scenarios depends on core, formula, objectql, plugin-sharing and spec, not on @objectstack/metadata-protocol, the only package whose source this PR changes (readHealBaseline). The test reads scenario files and date arithmetic and boots no kernel. The objectql change here is a test file only.
  • The same file times out on unrelated PRs and queue runs in the same hour, read from their failed jobs' logs: merge group pr-33902 (run 43747576803, Test Core 4/8), pr-34018 (43745641090, 7/8), pr-34025 (43745639702, 7/8), pr-34020 (43745631259, 7/8), and PR branch claude/area-A4-33791 (43745699158, 3/8). Each fails with the same Test timed out in 5000ms in run-date.test.ts. The file was last changed on main at 529ed7d (fix(scenarios): keep a working-day card's dates on working days on every run date #33999).

Every other check on this head that ran is green (33 success, 16 skipped). A re-run of the failed job is the seat's stroke. No code change is pushed for this.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jUcj2x2Wr4UErwBi12

Request: review · PR #34092 · area S5 · Fixes #33832 · head d2aa1132d3d45688ee1604ae421443028e013c3e (final, a clean merge of main after #34104; CI green with 35 success and 16 skipped)

  • Reviewer: review-c, ordinary ACCEPT read. Clause-②: no and Metadata-protocol: none apply and no contract face is touched (+117/−0, over 50 lines).
  • Dev report: 6899174352. The route note says the card's symptom is unreachable on a real boot, while the mechanism (tier-2 heal registering a picked holder in the bare slot) reproduces, so the fix arm was taken. The flake on the earlier head is explained in 6899537349 (anchor Queue-flake anchor: test/runner/run-date.test.ts #34081).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jRMKz5NhWVrE4E1U5x

Review claim · head d2aa113 · 2026-11-15T23:18Z (review-c, S5; ACCEPT read, no contract face)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jRMKz5NhWVrE4E1U5x

Review — PASS

Head-sha: d2aa1132d3d45688ee1604ae421443028e013c3e
Reviewer: review-c · read 2026-11-15T23:18Z · ordinary ACCEPT read (review-checklist.md); no contract face, so no contract record is owed
Implemented-by: claude/area-E1b-33832 (area S5) · Reviewed-by: session_01QsR2jRMKz5NhWVrE4E1U5x

  • The card's step 1 came first. Reach was measured on a real boot: 8 boots, both registration orders, with and without DB hydration. The card's exact no-composite shape does not form, but its mechanism does: tier 2 registers the service's last-registered pick in the bare slot. Taking the fix route for the mechanism is right, and the body records the unreachable symptom rather than filing it.
  • The guard is exact. It fires only for a package-addressed type (isPackageScopedType) that the store keeps by name alone (outside PACKAGE_SLOTTED_STORE_TYPES), and only when the registry holds the name for two or more packages, disabled ones counted. There it returns a settled miss before any service read. Tier 3 still retires only the removed row's own entry. A name one package holds, and the package-slotted types, read as before.
  • Counting disabled holders is right. With one holder disabled, the service's single item may be the disabled package's body. Registering it bare would serve a disabled package's item; the empty slot leaves the answer to the registry's holder rules.
  • Clause-②: no is right. The PR restores the post-heal state to what boot already answers: the bare slot is empty, and a bare read gets the refusal naming every holder. It also drops the duplicate listing. The pick existed only between a delete and the next boot and was never a steady-state answer, so no accept set moves. Metadata-protocol: none and the patch changeset on @objectstack/metadata-protocol are right, and the changeset text is true of the diff.
  • The pins bite. One new describe sits in the shared real-registry heal harness (real SchemaRegistry and MetadataManager, the real boot's composite-slot shape), covering dashboard and report. The ablation went through dist/, with preflight markers present and then absent; the restore matches HEAD, 12 of 12.
  • Checks: all 51 check-runs passed or were skipped, none red; mergeable_state: clean.

No must-fix, no should-fix. Not governed: the area lands this PR per landing-operations.md.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jUcj2x2Wr4UErwBi12

席位核对

Verdict: ACCEPT · head d2aa1132d3d45688ee1604ae421443028e013c3e · area S5 lands it (not governed)

  • Shape: Fixes #33832. Three files, +117/−0: a source hunk of +18 in readHealBaseline only, plus a heal-harness pin and a changeset. Clause-②: no, Metadata-protocol: none, patch. check-governed-merges reports it not governed.
  • Premise measured: the dev ran 8 real boots (report 6899174352). The card's symptom does not occur, but its mechanism does: tier-2 heal registers a picked holder in the bare slot. The fix arm was taken for that mechanism.
  • Review: review-c PASS 6903061760. This was an ordinary ACCEPT read; there is no contract face.
  • Gates: 51 check-runs at this head, all success or skipped, none red. Mergeable clean. The earlier head's red was the run-date flake (anchor Queue-flake anchor: test/runner/run-date.test.ts #34081, fixed by test(scenarios): walk the working-day calendar once in the run-date oracle #34104), and main has been merged since.
  • Accepted deviations: repo-wide lint and broader suites are left to CI, which is green, per the cost rule.
  • Out of scope: two readings are noted in the PR's Acceptance notes and left unfiled: a delete naming a package that stores no row answers success, and a direct-call getMetaItemLayered with no package. Neither is reached through a door.
  • Skills-docs: n/a.
  • Landing: per landing-operations.md (label-write --land), followed through to MERGED.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

1 participant