Skip to content

fix(metadata)!: MetadataManager.loadMany takes a by-package name's bodies and packages off the loader's keyed entries; loadManyKeyed entries carry their package - #33299

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/area-E2-32680
Nov 14, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/area-E2-32680

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread
Fixes #32680

Clause-②: yes (narrowing)
Metadata-protocol: none
Skills-docs: none — no skill teaches how MetadataManager's plural reads stamp a loader's bodies or what loadManyKeyed entries carry; the moved answers live in the metadata service's internal read path.

维护者速读

What changes

MetadataManager.loadMany, for an unbundled type stored per (package, name) (PACKAGE_SLOTTED_STORE_TYPES) on a loader that holds items per package (loadManySlots: DatabaseLoader, the artifact door's MemoryLoader), now hands on each keyed entry's own body, stamped (_packageId) with the package the loader holds that entry for when the body carries the entry's key as its name (keyedEntryBodies). It no longer pairs loader.loadMany's bodies to the keyed entries by their JSON.stringify (the former withLoaderEntryPackages). Bodies the keyed read cannot name (a row whose name column is empty) are still handed on after them, unstamped: they are loadMany's bodies less one per keyed entry whose body is the same value (key order aside), so the comparison decides only what is kept, never a package, and it runs only when loadMany answers more bodies than the keyed read.

MetadataManager.loadManyKeyed entries carry packageId where the loader's entry carries one (keyedEntryOf), for the slotted path and the bundled one (email_template).

Every moved answer, FROM to TO (the changeset carries the same list):

Shape (host wiring a DatabaseLoader) Read FROM TO
Name two packages hold, beside another row whose body says the name (F2) MetadataManager.loadMany one body, unstamped both holders stamped with their own row's package, the other row's body unstamped
same boot pass registry the one body in the bare slot each package's slot, the other row's body in the bare slot
same bare read after the pass that body 409 RESOURCE_CONFLICT naming both packages (for action also platform, see notes); the same as without the pass
Name one package holds, beside another row whose body says the name loadMany / boot pass unstamped, filed in the bare slot stamped, filed in the holder's slot
same read naming a package that holds no row, after the pass the holder's body nothing, as without the pass
Loader whose two reads serialise a body differently (F3) loadMany both holders unstamped both stamped
Any type stored per (package, name) MetadataManager.loadManyKeyed { name, data } { name, data, packageId } where the loader holds it for a package

Not changed: a name one package holds with no other row's body saying it (CONTROL pins), a name no package holds, and a loader without loadManySlots. The number of entries both plural reads hand on is unchanged for every shape but F2, where the other row's body is now kept beside both holders.

Tests

New top-level describe [#32680] in packages/metadata/src/loaders/database-loader.test.ts (53 cases): F2 per boot-pass type with the other row stored first and last (bare read 409 naming both after the pass; reads naming ALPHA, BETA, GAMMA equal the cold read); F3 with a key-reordering loader, plus a row whose name column is empty kept once; F4 per slotted type and email_template; one holder beside another row's body (every read equals the cold read); CONTROL one holder per type. The #32458 pin "two holders of a name and another row's body that says the same name" moves FROM [[null, ALPHA]] TO [[ALPHA, ALPHA], [BETA, BETA], [null, ALPHA]], its title rewritten to say so.

BEFORE, on main d4fbb4db with the same fixtures: 43 of the 53 new cases red, the 10 CONTROLs green. The F2 bare read after the pass answered com.alpha.app with registry keys ['helper'] for every type.

Downstream readers (MetadataManager.loadMany / loadManyKeyed callers), consumer direction: objectql action-governance, metadata-sync-flow-two-holders, plugin-governance-scoped-metadata, webhook-stored-row-boot-hydration (59 passed); runtime action-activation-unpackaged, actions-addressed-route, mcp-package-object-discovery, action-governance-scope-divergence (218 passed).

Ablations (each through scripts/ablation-replace.mjs, mutation landed on disk and restored to the HEAD blob with git diff HEAD empty; the suite reads src/ by relative import, so no build leg):

  1. the keyed read swapped back for loader.loadMany (no stamp at all): 42 red (the CONTROLs among them, since this drops every stamp), the 12 F4 cases green;
  2. keyedEntryOf without packageId: the 12 F4 cases red, nothing else;
  3. the remainder compared by JSON.stringify instead of by value: the F3 case red (the empty-name row handed on twice);
  4. the remainder dropped: F3 and the two metadata: the boot priming pass hands a column-bound slotted row to register unstamped, so with two holders of a name the DatabaseLoader save inserts a package-less row (unbundled slotted types) #32458 pins that keep an empty-name row red.

Acceptance notes

Verification

metadata suite and typecheck on fad580c
pnpm --filter @objectstack/metadata test && pnpm --filter @objectstack/metadata typecheck
 Test Files  77 passed (77)
      Tests  2367 passed (2367)
os-verify-lock: VERDICT command-exit 0
Targeted gates run locally
EXIT=0 node scripts/check-adr-0087-registration.mjs --base origin/main
EXIT=0 node scripts/check-changeset-no-major.mjs --base origin/main
EXIT=0 node scripts/check-empty-changeset.mjs --base origin/main
EXIT=0 pnpm check:nul-bytes
EXIT=0 pnpm check:durability-log-level
EXIT=0 pnpm check:doc-authoring
EXIT=0 pnpm check:issue-citations
EXIT=0 pnpm check:slot-lookup
EXIT=0 pnpm check:test-source-alias
EXIT=0 pnpm check:cross-package-test-inputs
EXIT=0 node scripts/check-closing-keyword-parity.mjs

Generated by Claude Code

@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 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/metadata, touching 9 documentable anchor(s).

5 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/concepts/metadata-lifecycle.mdx (via MetadataManager (symbol, a top-level class))
  • content/docs/kernel/cluster.mdx (via MetadataManager (symbol, a top-level class))
  • content/docs/kernel/contracts/metadata-service.mdx (via loadMany (symbol, a method of class MetadataManager))
  • content/docs/plugins/adding-a-metadata-type.mdx (via MetadataManager (symbol, a top-level class))
  • content/docs/protocol/kernel/metadata-service.mdx (via MetadataManager (symbol, a top-level class), loadMany (symbol, a method of class MetadataManager))

⛔ 2 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/implementation-status.mdx (via MetadataManager (symbol, a top-level class))
  • content/docs/releases/v17/17-0.mdx (via MetadataManager (symbol, a top-level class))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

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 — 16 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 9f736f2e2469d159422fb2ce1456bd932278ffff → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 773feb5016c00c417386d02a3a2c912b87465cd2 — the merge of head fad580c029a6fa7cdc88b22ad12f883a60ba29bd into base 9f736f2e2469d159422fb2ce1456bd932278ffff, 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 773feb5016c00c417386d02a3a2c912b87465cd2 && git checkout 773feb5016c00c417386d02a3a2c912b87465cd2
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 9f736f2e2469d159422fb2ce1456bd932278ffff fad580c029a6fa7cdc88b22ad12f883a60ba29bd && git checkout -B drift-repro 9f736f2e2469d159422fb2ce1456bd932278ffff && git merge --no-ff fad580c029a6fa7cdc88b22ad12f883a60ba29bd

node scripts/docs-audit/affected-docs.mjs --json 9f736f2e2469d159422fb2ce1456bd932278ffff

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

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 9f736f2e2469d159422fb2ce1456bd932278ffff → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cyrFFk86Jqf7Mp5Rzw
Request: review · area E2 · head fad580c

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract-review-claim: session_016WV4d1PGptBW3QRQNmy5e6 · head fad580c · 2026-11-14T16:11:23Z

review#3 (area-lease pilot #33059, area E2).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: fad580c029a6fa7cdc88b22ad12f883a60ba29bd
Local-runs: none
Scope: packages/metadata/src/metadata-manager.ts, packages/metadata/src/loaders/loader-interface.ts, packages/metadata/src/loaders/database-loader.test.ts + none

① Derived judgments

  • keyedEntryBodies replaces content pairing (withLoaderEntryPackages, JSON.stringify matching) with each keyed entry's own body. A body is stamped with its entry's package only when the body carries the entry's key as name, else handed on unstamped (metadata: readListUncached() drops every loader-held item whose stored body has no top-level name — an aggregated view container is invisible to list() after a restart #14205: key and body name are two identities). The leftover comparison (sameBody, key-order-insensitive) runs only when loadMany answers more bodies than the keyed read. It decides only which unkeyed bodies are kept, never a package. Matches the stated rule; no package is ever inferred from content.
  • The path applies only to loaders with both loadManyKeyed and loadManySlots. Others keep loadMany as before (and the old helper returned items unchanged for them too).
  • F2's narrowing (bare read after the boot pass: one body → 409 naming both packages) is the red-line answer: ambiguity reported, never guessed. Declared and pinned with the other row stored first and last.
  • loadManyKeyed entries now carry packageId (keyedEntryOf), for the slotted and bundled paths, as an optional member already declared on MetadataKeyedItem. Additive for callers.
  • nit N1: the order handed on changed from loadMany's row order to keyed entries first, then unkeyed bodies. If a consumer registers package-less bodies into one bare slot with last-wins semantics, an unkeyed body (a row with an empty name column) whose body names X now always lands after the environment's own row X. Before, row order decided. Legacy-only shape; say so in the changeset or keep loadMany order for the unkeyed tail relative to package-less entries. Not blocking.

② Semver level

@objectstack/metadata patch with ! and Clause-②: yes (narrowing) (F2's bare read becomes a 409). packageId on keyed entries is additive on an already-declared optional member. Metadata-protocol: none, Skills-docs: none — REASON hold.

③ Boundary flags

④ Design judgment

Stamping by content equality was a guess that failed silently in two measured shapes (F2, F3). Reading each keyed entry's own body and package removes the guess, and the one moved user-visible answer is the refusal the epic's red line asks for. Holds against the cited code and the card.

Implemented-by: claude/area-E2-32680
Reviewed-by: session_016WV4d1PGptBW3QRQNmy5e6

VERDICT: PASS

N1 optional.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cyrFFk86Jqf7Mp5Rzw
ACCEPT · area E2 (area-lease pilot #33059) · Fixes #32680 · head fad580c

  • Review: review#3 PASS at fad580c (record 6880439033). N1 is optional text and is not pushed here, so CI and the PASS head stay as they are; it is carried as a follow-up.
  • Governed: check-governed-merges --pr 33299 NOT governed (0 paths hit the register); +261/-81 changed lines (≤ 3000).
  • Checks: required checks still running at ACCEPT; auto-merge and the merge queue (dogfood regression gate included) land it only once they pass. The dogfood battery was not run locally; the queue's dogfood gate carries it.
  • Main: no conflict; not merged per pilot rule.
  • Landing: maintainer's instruction in the area thread (15:21Z) — PRs in this area that passed review go ready + auto-merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 14, 2026 16:16
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit dd966fc Nov 14, 2026
52 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/area-E2-32680 branch November 14, 2026 17:05
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…object, name) on the stored side, so a package-less save never lands in another object's holder (objectstack-ai#33318)

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DDZYUbJbnXUTqZoZ56k4czR)_
Part of objectstack-ai#32681

Clause-②: yes (narrowing)
Metadata-protocol: none

## 维护者速读

- 改了什么:`DatabaseLoader` 存一条不属于任何包、绑在某对象上的 `action` 行时,按 `(对象, 名字)`
数持有者(和内存注册表一致),不再按名字数所有包;它按槽读行时,把"名字被两个包持有、只有一个包绑了同一对象"的包外行当作那个包的定制,排在该包自己的行前面交出。
- 为什么改:席位裁决 A(2026-11-14T16:12Z):包外行按 `(对象, 名字)` 归属。之前 ALPHA 绑
`account`、BETA 绑 `contact` 时,包外的 `account` 存档写成包外行(而注册表把它当 ALPHA 的定制);只有
BETA 绑 `contact` 时,包外的 `account` 存档被写成 BETA 的 `account` 绑定(BETA
从没声明过);启动预载前后点名 ALPHA 的读答案不同。
- 风险与回滚:只影响接了 `DatabaseLoader` 的宿主(工作区内 0
处);库里已有的行不改不迁移,只改新写入落在哪一行、以及冷读怎么归属;回滚 = revert 本 PR。
- 先看:`packages/metadata/src/loaders/database-loader.ts` 的
`slottedSaveTarget`(风险 hunk:按 `storeRowSlotKey` 分槽、按包桶命名未命名行)与
`loadManySlots`;`packages/metadata/src/package-slotted-store.ts` 的
`storeRowWriteKey` 与 `pluralEntryCustomizedHolders`。
- 两分钟验证:`pnpm --filter @objectstack/metadata exec vitest run
src/loaders/database-loader.test.ts -t 32681`,预期新增用例全绿。
- 需要你做的:无,席位落地。镜像形状(ALPHA 绑 `account`、包外行绑 `contact`)的启动预载修复依赖 objectstack-ai#33299
先合入,见 Acceptance notes。

## What changes

Seat ruling A on objectstack-ai#32681: a package-less action row bound to an object is
keyed per `(object, name)` everywhere, as ADR-0150 D4 keys an action by
`(package, objectName, name)`.

- **Save** (`DatabaseLoader.save` through `slottedSaveTarget`): rows are
keyed as the in-memory store keys items (`storeRowSlotKey`), and
`storeRowWriteKey` counts the holders of the written body's identity
(`slotIdentityOf`: an object-bound action's object and name), as
`storeWriteKey` already does in memory. A package binding the name to
another object is a different key, never a holder of this one. The
unique-key bucket a pending object-naming acts on is still the package's
(every row of the package the write's slots belong to).
- **Slot read** (`DatabaseLoader.loadManySlots`, and `loadSlots`, which
filters it): a package-less action row bound to an object that exactly
one package binds the name to, under a name two or more packages hold,
is handed on held for that package, just before that package's own row
of the object (`pluralEntryCustomizedHolders`). That is where the boot
priming pass files it: the unscoped plural read keeps it apart from both
holders, and the pass registers it after them, so the store's `(object,
name)` write rule puts it in that package's slot. Readers that keep a
slot's first item (`slotStoreOf`, `list`) now answer it without the pass
too. The row is not rebound: no write, its `package_id` stays empty.

Every moved answer, FROM to TO (host wiring a `DatabaseLoader`; ALPHA
and BETA are two packages, `approve` the action name):

| Shape | Answer | FROM | TO |
|:--|:--|:--|:--|
| ALPHA `approve` on `account`, BETA's on `contact`; a package-less save
of `approve` on `account` | the row written | a new package-less row
bound to `account` | ALPHA's `account` row (its customization, D4) |
| BETA's `approve` on `contact` alone; a package-less save of `approve`
on `account` | the row written | a new row with `package_id` BETA bound
to `account` (a binding BETA never declared) | a new package-less row
bound to `account` |
| ALPHA's `approve` on `account` alone; a package-less save of an
object-less `approve` | the row written | a new row with `package_id`
ALPHA, object-less | a new package-less object-less row |
| BETA's `approve` on `contact` and a package-less row on `account`;
ALPHA's first save of `approve` on `account` | the row written | a new
ALPHA row beside the package-less one | the package-less row, updated
and bound to ALPHA (a package's first item takes over the bare slot, as
in memory) |
| ALPHA's row on `account`, BETA's on `contact`, a stored package-less
row on `account` (any version order) | read naming ALPHA without the
boot pass (`MetadataManager.get`) | ALPHA's own row | the package-less
row, as after the pass |
| same | `list('action')` without the pass | ALPHA's row and the
package-less row | the package-less row (ALPHA's slot), as after the
pass |
| same | bare read, read naming BETA, every read after the pass | `409`
naming ALPHA and BETA; BETA's row; as listed | unchanged |
| a package-less row on `o1`, then a package's save on `o2` | the row
written | the package's save takes the `o1` row over | the package's own
new row; the `o1` row keeps its column (moved objectstack-ai#32540 pin) |
| ALPHA on `account`, BETA on `contact`, package-less save (A-B-save /
B-save-A) | `/actions/account/approve` declaration | ALPHA's own body
while ALPHA's slot holds the customization / refused
`ambiguous-in-environment` (and `contact`: no declaration) | the item
ALPHA's slot holds, ALPHA's handler run, in both orders |

The second row is the narrowing: an address naming BETA no longer
reaches an `account` binding a package-less save wrote into BETA's
bucket.

Not changed: types other than `action` (their identity is the name, and
the slot read's new rule never fires for them); a name one package
holds; stored rows (no migration: a stored package-less row is read as
its holder's customization, never rebound; rows earlier saves wrote are
listed by the ADR-0150 D10 report as before).

## Tests

- `packages/metadata/src/loaders/database-loader.test.ts` describe
`[objectstack-ai#32681]` (11 cases); the moved objectstack-ai#32540 pin in
`metadata-manager-match-endpoint.test.ts`;
`packages/runtime/src/action-package-addressing.test.ts` describe
`[objectstack-ai#32681]` (3 cases: real ObjectQL registry, protocol over a
MetadataManager from the real MetadataPlugin boot pass, DatabaseLoader
over a writable `sys_metadata` double routed through the engine dispatch
asserts).
- BEFORE (observed with the fix reverted): A-B-save judged ALPHA's own
body while ALPHA's slot read the customization; B-save-A refused the
`account` route `ambiguous-in-environment` and found no `contact`
declaration; the single-holder save stored a `[BETA, account]` row.

## Acceptance notes

- The mirror shape (ALPHA's `approve` on `account`, a package-less row
on `contact`) is not in this PR. `DatabaseLoader`'s unscoped plural read
folds the package-less `contact` row into ALPHA by name, so after the
boot pass a read naming ALPHA answers the `contact` row where the read
without the pass answers ALPHA's `account` row. Counting per `(object,
name)` there hands both rows on, but `main`'s `MetadataManager.loadMany`
then pairs bodies by content and stamps neither, the pass files ALPHA's
body in the bare slot, and a read naming BETA would answer ALPHA's item.
That half needs objectstack-ai#33299's keyed-entry stamping first; it is not stacked
here (AGENTS.md: a stacked series is not a supported form).
- Single-holder cell after boot (same fold as the mirror shape, follows
objectstack-ai#32680): with BETA's `approve` on `contact` alone and a package-less row
on `account`, a read naming BETA after the boot pass still answers the
`account` row and `/actions/contact/approve` finds no declaration — as
on `main`. Carried by the follow-up on this card.
- The ADR-0150 D10/R15 report's `packageLessRowOwners` (area E1) still
counts holders per name, so a package-less row this PR reads as ALPHA's
customization is still listed as ambiguous there. Noted for E1.
- No change in `packages/metadata-protocol/src/**` or
`packages/metadata/src/metadata-manager.ts`; in `database-loader.ts`
only `slottedSaveTarget`, `loadManySlots`, the imports and one doc
paragraph move (open PR objectstack-ai#33193 edits the history functions).

## Verification

<details><summary>Local runs</summary>

At c7e35e3: `@objectstack/metadata` test 77/77 files, 2325 tests;
`@objectstack/objectql` 595/595 files, 12942 tests;
`@objectstack/runtime` 599/599 files, 10678 passed, 19 skipped; metadata
+ runtime typecheck exit 0; dogfood battery 464 passed / 3 skipped
files, 3927 passed / 42 skipped tests, no failures. Derived gates: 70
families, 69 exit 0, 1 NOT MEASURED (`check:dual-build-cjs-loads`, no
dist in the worktree; CI Build Core covers it). Ablation (stored-side
files reverted to the merge base, landing proven by grep): metadata
`[objectstack-ai#32681]` 10 failed / 1 CONTROL green, the moved o1 pin red; runtime
(metadata dist rebuilt, preflight `--absent` exit 0) 3 of 3 red.
Restored to the HEAD blobs, tree clean.

After merging `origin/main` (with objectstack-ai#33299) at 123588d, clean merge:
`@objectstack/metadata` test 78/78 files, 2412 tests; typecheck exit 0.
</details>

---
_Generated by [Claude
Code](https://claude.ai/code/session_016WV4cyrFFk86Jqf7Mp5Rzw)_

<!-- signed: domain:server#5 · os-elon-musk ·
session_016WV4cyrFFk86Jqf7Mp5Rzw -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…e by the _packageId stamp alone; detector for 17.0.0–18.3.0 stamped environment rows (objectstack-ai#32985) (objectstack-ai#33416)

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DDZYUbJbnXUTqZoZ56k4czR)_
Refs objectstack-ai#32985

The card stays open (seat ruling 2026-11-14T19:48Z): the follow-up PR
keeps column-bound rows an 18.4.0 boot bound unless history shows them
stamped since create (kept on undetermined or with no history table),
and notes that a future uninstall UI must use
`unregisterPackageWithReport` and surface `kept`
(`IMetadataService.unregisterPackage` has no force or result).

Clause-②: yes (narrowing) — narrowed: `unregisterPackage(P)` keeps,
until `{ force: true }`, items it used to remove (every item stored in a
row with an empty `package_id` whose body names P by `_packageId` alone,
including every `DatabaseLoader`-stored `object`/`view`/`app`/`page` of
P); the boot bind and `migrateDatabaseLoaderRowPackages` leave such rows
unbound. Widened: additive in-process surface
(`unregisterPackageWithReport`, `{ force }`,
`MetadataLoader.stampOnlyRows`, `detectStampOnlyRows`, the
`'stamp-only'` left reason).
Metadata-protocol: none

**BREAKING** (review#3 M1, 6883260484): a caller of
`MetadataManager.unregisterPackage` over a `DatabaseLoader` now keeps
and reports items whose stored rows name the package by the `_packageId`
stamp alone, every `object`/`view`/`app`/`page` item of the package
among them. Run `detectStampOnlyRows`, then pass `{ force: true }` (or
use `unregisterPackageWithReport`) to remove the package's own items as
before. The changeset carries the adr-0087 not-required
(no-migration-prescription) marker. The any-source guard (wider than the
ruling's `source='database'`) was accepted by review because it only
errs toward keeping.

## 维护者速读

- **改了什么**:`unregisterPackage` 遇到「`package_id` 列为空、正文只靠 `_packageId`
印记指向该包」的存储行时,默认保留该条目并报告(`{ force: true }` 才删);启动时的列绑定与运维迁移不再凭这种印记绑定
`package_id`;新增只读检测器 `detectStampOnlyRows`,按每行自己的历史判定印记来源;changeset
附升级说明。
- **为什么改**:17.0.0–18.3.0 在「声明 packageId 的 MetadataPlugin + eager 无
artifactSource + DatabaseLoader」组合下,把宿主印记写进了环境自有的行;main
上卸载宿主包会把这些环境数据连行删掉(18.3.0 实建库 37 行删 34 行),属静默数据丢失红线。
- **风险与回滚**:代价是误保留——非按包存储的类型(object/view/app…)的包自有行同样只有印记,卸载时会被保留并
warn,需 `force`;无数据迁移、无新写入,回滚即 revert 本 PR。
- **先看**:`packages/metadata/src/metadata-manager.ts` 的
`unregisterPackageWithReport`(先全量检查、后删除);`packages/metadata/src/loaders/database-loader.ts`
的 `bindReadRowPackage` 新跳过与
`stampOnlyRows`;`packages/metadata/src/migrations/detect-stamp-only-rows.ts`
的历史链判定。
- **两分钟验证**:`pnpm --filter @objectstack/metadata exec vitest run
src/loaders/database-loader.test.ts -t 32985`,预期所有 objectstack-ai#32985 用例通过(18.3.0
形态的行全部保留、`force` 后删除)。
- **需要你做的**:无,席位落地。

## What changes

The binding ruling is the maintainer decision of 2026-11-14 on objectstack-ai#32985
(guard + detector + upgrade note; no ownership-changing migration now),
as the seat recorded it on the card. Every `@objectstack/metadata` from
17.0.0 through 18.3.0, on a host whose `MetadataPlugin` declares its
`packageId`, primed eagerly with no `artifactSource`, with a
`DatabaseLoader`, saved each package-less row its boot pass read back
stamped with the host (`_packageId`, `_provenance`). From the row alone
such an environment row cannot be told from a row of the host's own
item; the objectstack-ai#32986 mark does not reach it, because its stored body already
names the host.

**1. The guard (red line).** `unregisterPackage(P)` (and the new
`unregisterPackageWithReport(P)`) keeps an item, registry entry and
rows, when any loader holds a row of it whose `package_id` column is
empty and whose stored body names P by `_packageId` alone, neither
`packageId` nor the legacy `package` naming any package
(`stampOnlyPackageOf`, new `src/stamp-only-row.ts`;
`DatabaseLoader.stampOnlyRows`, new optional
`MetadataLoader.stampOnlyRows`). Every row is checked before the first
removal, so a failed read throws and removes nothing. Each kept item is
reported in the result (`kept`, `reason: 'stamp-only-row'`, each row's
loader, id and `source`) and in one `warn` naming the detector and `{
force: true }`; `force` removes them as before. The check reads storage
at removal time rather than marking registry objects, so no copy a later
writer registers can drop it (the hole objectstack-ai#33003 had to close for the
objectstack-ai#32986 mark).

- **Deliberately wider than the ruling's `source = 'database'`:** the
check takes every writer's row. Measured on the 18.3.0-built fixture,
the boot also stamped another writer's package-less row
(`agent/api_agent`, `source = 'api'`), and `main` deleted it on
`unregisterPackage(host)`. Under 64ce235's reading a body stamp in such
a row binds nothing (it is the environment's for every column reader),
so keeping it only ever keeps an environment row.
- **`unregisterPackageWithReport` is a method of its own** because the
spec's `IMetadataService.unregisterPackage` answers void and a class
method cannot answer more under that signature; the published contract
is not widened here.

**2. `bindReadRowPackage` (the boot's column-only bind): it can skip
stamp-only rows, and does.** FROM binding the empty `package_id` column
of a legacy row whose body names its package by `_packageId` alone TO
leaving it. Pinned both ways: such a row (the host's stamp, or another
package's) is not bound and nothing is written; a legacy row naming its
package by its own `packageId` is still bound; and the cost to a genuine
pre-objectstack-ai#32246 legacy row is pinned by a CONTROL — a row the host's file
item seeded is bound on the same boot by that item's own save (the save
path's column-only binding, unchanged). What is left unbound is a legacy
row no shipped code rewrites; reads of it are unchanged (the loader
reads its package off the body).

**3. `migrateDatabaseLoaderRowPackages`** leaves the same rows, new
reason `'stamp-only'`.

**4. Read-only detector:** `detectStampOnlyRows(store, { packageId? })`
in `@objectstack/metadata/migrations`, next to the migration it pairs
with and in the shape of the read-only `scrubHistoryDrainedKeys` count —
chosen over an `os migrate meta --stored`-style CLI because it is the
smallest thing an operator can run against a driver today, touches no
package outside `@objectstack/metadata`, and a CLI can wrap it later. It
takes `find` only and reports every row whose body names a package by
`_packageId` alone with its column empty or naming that package (an
18.4.0 boot bound by-package rows to the host), each with a verdict from
its own history, walked back from the row's `checksum` through
`previous_checksum` (so another holder's history of the name is never
read as its own): `stamp-added` (a version naming no package, then one
adding the stamp; `onlyStampAdded` marks the boot's signature),
`stamped-since-create`, or `undetermined`.

**5. Upgrade note** in the changeset: affected releases 17.0.0–18.3.0,
the composition, the symptoms (rows read as host-owned, phantom 409
holders, deletion on uninstall before this change, the 18.4.0 column
bind), the detector, and the manual recipe for a `stamp-added` row. It
makes no claim about first-party reach (the cloud product's
`MetadataPlugin` configuration is owed a separate check).

**6. Fold-in (review nit N1 of merged PR objectstack-ai#33299):** `keyedEntryBodies`'s
doc comment now says the order handed on is the keyed entries first,
then the unkeyed bodies, FROM `loadMany`'s row order. Text only.

| Door | FROM | TO |
|:---|:---|:---|
| `unregisterPackage(P)` over an item a loader stores in a row with an
empty `package_id` whose body names P by `_packageId` alone, any
`source` | item and rows removed | kept and reported (result `kept`, one
`warn`); nothing removed if a check fails |
| `unregisterPackage(P, { force: true })` | — | removes them too, as
before |
| `unregisterPackage(P)` over an item whose body names P by its own
`packageId` / `package`, or whose column is bound | removed | removed
(unchanged) |
| boot column-only bind of a legacy row named by `_packageId` alone |
bound to that package | left empty; a row whose package's code still
ships is bound by that item's own save |
| `migrateDatabaseLoaderRowPackages` over such a row | bound | left
`'stamp-only'` |

## Tests

- New top-level `describe('[objectstack-ai#32985] …')` in `database-loader.test.ts`
(rows seeded as 18.3.0 left them, by-package and other types): the boot
binds no column and writes nothing; `unregisterPackageWithReport(host)`
keeps every item and row and reports each, one `warn`; another writer's
stamped row kept the same; the contract door answers nothing and keeps
them, `force` removes them; CONTROL rows naming the host by their own
`packageId` removed without `force`; CONTROL another package's removal
moves nothing; a failing check throws before any removal.
- R7-A pins: the stamp-only legacy agent row (host's stamp, another
package's stamp) is not bound; the bind mechanics re-pinned on a row
naming its package by its own `packageId`; the file-seeded legacy row
CONTROL above.
- `detect-stamp-only-rows.test.ts` (new, 8 cases): each verdict, the
18.4.0-bound column, `onlyStampAdded` false, an unprovisioned history
table (`unavailable`) vs any other read failure (thrown), the per-row
checksum chain beside another holder's history, the rows never reported,
`packageId` narrowing, and `find`-only access.
- Fixture triage of pins this moves, each re-judged rather than
re-spelled in bulk:
- **Re-spelled** (they pin binding mechanics, not the stamp):
`bind-database-loader-row-packages.test.ts` fixtures `_packageId: A` to
`packageId: A` (26 lines), and the two C3 `bindReadRowPackage` cases in
`metadata-manager-match-endpoint.test.ts`; the migration's first case
now also pins `stamp-only` for a flat and a wrapped stamp-only body and
binding for a stamp beside the item's own `packageId`.
- **Flipped** (they pinned exactly the removed behaviour): the objectstack-ai#32986
CONTROL "the host's own rows (stamp alone) are still removed" is now
kept-and-reported, then removed with `force`; the objectstack-ai#32198 CONTROL for a
type outside the set (a `_packageId`-only item's row, which
`DatabaseLoader` never column-binds) is now kept-and-reported, then
removed with `force`.
- **Forced** (they pin what the objectstack-ai#32986/objectstack-ai#33003 mark alone keeps, which
`force` does not lift): the objectstack-ai#33003 CONTROLs whose host rows carry the
stamp alone (database-loader.test.ts, six writers plus three single
cases) and the objectql late-bridge CONTROL
(`plugin-late-bridge-environment-row.test.ts`); the objectstack-ai#32353 door-removal
CONTROL.

## Acceptance notes

- **Rows an 18.4.0 boot already bound are outside the guard.** 18.4.0
(published 2026-11-13) bound the `package_id` column of each stamped
by-package row to the host at first boot. Such a row now names the host
by its column, so the ruling's criterion (no package column) does not
hold and `unregisterPackage(host)` still removes it. The detector
reports it (`column` set, verdict from history). Whether the deletion
door should also consult history for column-bound rows is a decision,
raised in the report, not taken here.
- **The guard is deletion-only.** On the replayed fixture the symptoms
the upgrade note names still read the same: a stamped row is listed as
the host's, and a bare read of `action/helper` is still refused `409
ambiguous-in-environment` naming the host as a holder, until the row is
repaired by hand (recipe in the changeset).
- **False positives are wide for one class:** `DatabaseLoader` writes no
column for a type not stored per `(package, name)`, so every row it
stores for a package's item of such a type names the package by the
stamp alone and is now kept until `force`. `unregisterPackage` has no
first-party production caller (its CHANGELOG records 0).
- The detector does not report a row whose column names another package
while its body stamp names the host (`flow/pkg_flow` in the fixture):
the column owns it.
- `MetadataManager.register` of a by-package item read from a stamp-only
row still binds that row's column through the save path's column-only
binding when it writes the row (unchanged; the boot no longer does).

## Verification

Final head `7617d86917` unless a line says otherwise. Base `fca5f89cce`.

<details><summary>metadata: typecheck + full suite (head 0ca9978;
later commits touch tests only, re-run below)</summary>

```
pnpm --filter @objectstack/metadata typecheck && pnpm --filter @objectstack/metadata test
 Test Files  79 passed (79)
      Tests  2418 passed (2418)
VERDICT command-exit 0
```
`tsc --noEmit --listFiles` includes all four edited test files. Detector
file re-run at the final head: `Tests 8 passed (8)`.
</details>

<details><summary>dependents that use the moved doors (head
c90052e)</summary>

`pnpm --filter @objectstack/objectql --filter @objectstack/runtime
--filter @objectstack/metadata-protocol --filter @objectstack/mcp
--filter @objectstack/service-datasource test`, after building their
closures:

```
objectql             Test Files  595 passed (595)   Tests  12953 passed (12953)
runtime              Test Files  599 passed (599)   Tests  10678 passed | 19 skipped (10697)
metadata-protocol    Test Files  339 passed | 9 skipped (348)   Tests  22848 passed | 43 skipped (22891)
mcp                  Test Files  64 passed (64)     Tests  1174 passed (1174)
service-datasource   Test Files  75 passed (75)     Tests  1317 passed (1317)
VERDICT command-exit 0
```
Chosen by `git grep` for every package outside `metadata` that calls
`unregisterPackage`, `bindReadRowPackage`,
`migrateDatabaseLoaderRowPackages` or `DatabaseLoaderRowLeftReason`, or
whose tests build a `DatabaseLoader`. The rest of the 87-package
affected set (`select-shard-packages.sh`, pull_request mode) is `Test
Core`'s, in CI.
</details>

<details><summary>replay over a real 18.3.0-built SQLite database (the
card's measurement fixture, 37 rows)</summary>

Same probe script as the measurement, pointed at this branch's build:

```
                 boot bound to host   unregisterPackage(host) deleted
main  stamped    12                   34
this  stamped    0                    0
main  control    0                    0
this  control    0                    0
```
Reads identical to `main` on every probed name; the one write-door
difference is the column the boot no longer binds (`action/helper`'s
stamped row stays column-empty). Detector over the same file,
`packageId: com.host.app`: 37 scanned, 34 reported — 32 `stamp-added`
(all `onlyStampAdded`, history `1 then 2`), 2 `undetermined` (rows the
fixture inserted raw, without a create in history); the database file's
hash is unchanged. Over the never-stamped control: 37 scanned, 0
reported.
</details>

<details><summary>ablations (head c90052e, restored; git diff HEAD
empty afterwards)</summary>

Through `scripts/ablation-replace.mjs` (anchor hit x1 then x0,
replacement landed), each followed by the three pinning files:

```
A1 unregisterPackage check replaced by an empty row list   Tests  6 failed | 1114 passed
A2 bindReadRowPackage stamp-only skip removed              Tests  5 failed | 1115 passed
A3 migration stamp-only branch disabled                    Tests 12 failed | 1108 passed
```
</details>

<details><summary>gates</summary>

The 66 families `node scripts/pm/dispatch-gates.mjs --commands` derives
for this diff were each run at head `7617d86917`, with each exit code
captured before any pipe: **66 of 66 exited 0**. They include
`check:where-matcher`, `check:engine-double-contract`, `check:nul-bytes`
and `check:dual-build-cjs-loads`. On a first run, before the dependents'
dists were built, `check:dual-build-cjs-loads` exited 3 (PREREQUISITE
NOT MET); on the run cited here it exited 0.

```
node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran ran-exit.txt
Run reconciliation — 66 derived, 66 run, 0 NOT-MEASURED, 0 UNRUN.
✓ dispatch-gates --ran: 66 derived famil(ies) accounted for — 66 run, 0 NOT-MEASURED (a DERIVED zero — all 66 recorded an exit code and none of them is 3).
```
`eslint --no-inline-config` over the 13 changed TypeScript files: exit
0. CI runs the rest: repo-wide `pnpm lint`, the artifact-roster and
wide-population families, and the full `Test Core` matrix.
</details>

---
_Generated by [Claude
Code](https://claude.ai/code/session_016WV4cyrFFk86Jqf7Mp5Rzw)_

<!-- signed: domain:server#5 · os-elon-musk ·
session_016WV4cyrFFk86Jqf7Mp5Rzw -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…ers per (object, name), so the boot pass keeps a package-less row on another object beside the holder's (objectstack-ai#33422)

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DDZYUbJbnXUTqZoZ56k4czR)_
Fixes objectstack-ai#32681

Clause-②: yes (narrowing)
Metadata-protocol: none

## 维护者速读

- 改了什么:动作(`action`)的无包行在非限定的复数读取(`pluralEntryKeys`,`loadMany` /
`loadManyKeyed` / `DatabaseLoader` 的非限定读取共用)里,按 `(对象, 名字)`
数持有者:只有当名字唯一的持有包也把该名字绑在同一个对象上时,无包行才并入它(它的定制);绑在没人绑的对象上的无包行是环境自己的条目,单独保留。
- 为什么改:席位裁决 A(2026-11-14T16:12Z)的后一半。之前 ALPHA 把 `approve` 绑在
`account`、一条无包行绑在 `contact` 时,复数读取按名字把两行并成一条、只留最后保存的那行,启动预载后注册表只剩一个;点名
ALPHA 的读取在预载后答出 `contact` 行(ALPHA 从没声明过的绑定),而冷读答 ALPHA 自己的 `account`
行。只有 BETA 绑 `contact`、无包行在 `account` 时同理。
- 风险与回滚:只影响接了 `DatabaseLoader` 的宿主(工作区内 0
处);库里的行不改不迁移,只改复数读取保留哪些行、预载注册哪些;同一对象上的单持有者、两个包持有同名的情形不变;回滚 = revert 本
PR。
- 先看:`packages/metadata/src/package-slotted-store.ts` 的
`pluralEntryKeys`(风险 hunk:`customizes` 判定)与新 helper `entryIdentitiesOf`。
- 两分钟验证:`pnpm --filter @objectstack/metadata exec vitest run
src/loaders/database-loader.test.ts -t "counts an action name"`,预期 11
个用例全绿。
- 需要你做的:无,席位落地。

## What changes

Second half of seat ruling A on objectstack-ai#32681 (ADR-0150 D4: an action is keyed
by `(package, objectName, name)`). The first half (objectstack-ai#33318) keyed
`DatabaseLoader`'s saves and slot reads per `(object, name)`; this one
does the same for the unscoped plural read, now that objectstack-ai#33299's
keyed-entry stamping is on `main`.

`pluralEntryKeys` (`packages/metadata/src/package-slotted-store.ts`) is
the key `MetadataManager.loadMany`, `MetadataManager.loadManyKeyed` and
`DatabaseLoader`'s unscoped reads keep one entry per. For `action`, an
entry that carries no package is now folded into the name's one holder
only when that holder binds the name to the entry's own object (or both
are object-less): the holders of the entry's `(object, name)`, counted
from the row's `bundle_member` column first, else its body's object,
through a new helper `entryIdentitiesOf` that
`pluralEntryCustomizedHolders` now shares. Bound to an object no package
binds the name to, the row is the environment's own entry and keeps a
key of its own, so the boot priming pass registers it beside the
holder's item and the store's `(object, name)` write rule files it in
the bare slot.

Every moved answer, FROM to TO (host wiring a `DatabaseLoader`; stored
rows; `approve` the action name):

| Shape | Answer | FROM | TO |
|:--|:--|:--|:--|
| ALPHA on `account`, a package-less row on `contact` | plural read
(`loadMany`) | one entry, the row saved last | both |
| same | registry after the boot pass | `contact` key alone
(package-less saved last) / ALPHA's `account` key alone (saved first) |
ALPHA's `account` key and the `contact` key |
| same, package-less row saved last | read naming ALPHA after the pass |
the `contact` row | ALPHA's `account` item, as without the pass |
| BETA on `contact` alone, a package-less row on `account` | plural
read; registry after the pass | one entry; one key | both; BETA's
`contact` key and the `account` key |
| same, package-less row saved last | read naming BETA after the pass |
the `account` row | BETA's `contact` item, as without the pass |
| ALPHA on `account` + a package-less object-less row; ALPHA object-less
+ a package-less row on `account` | plural read; registry; reads after
the pass | one entry, one key | both, both keys, reads equal to the
reads without the pass |

The narrowing: after the boot pass, a read naming a package no longer
reaches a package-less row bound to an object that package never bound
the name to.

Re-measured with objectstack-ai#33299 merged: the fold no longer loosens a read naming
BETA into ALPHA's item. In the mirror shape, a read naming BETA (which
holds nothing) answers the environment's `contact` row before and after
the pass, in both version orders, and never ALPHA's.

Not changed: a name one package holds on one object beside a
package-less row on that object (one entry, the row saved last); a name
two packages hold (the package-less row keeps its own entry and
`pluralEntryCustomizedHolders` names the holder it customizes, as in
objectstack-ai#33318); the `/actions/OBJECT/NAME` route's declaration read (see
Acceptance notes); types other than `action`; stored rows (no
migration).

## Tests

- `packages/metadata/src/loaders/database-loader.test.ts`, describe
`[objectstack-ai#32681] the plural read counts an action name's holders per (object,
name)…` (11 cases): four moved shapes in both version orders (plural
read entries, cold reads, registry keys after the real `MetadataPlugin`
boot pass, reads after the pass equal to the cold reads, no row
updated); CONTROL one package on one object (both orders: one entry, the
one saved last, its key); CONTROL two packages on one object (three
entries, bare read refused naming both and the environment, before and
after the pass).
- Moved pin: `[objectstack-ai#32791]` "a package's row bound to an object and an
object-less package-less row saved last" — the registry now holds
ALPHA's `account` key beside the bare slot (FROM the bare slot alone);
the bare reads are unchanged.
- `packages/runtime/src/action-package-addressing.test.ts`, describe
`[objectstack-ai#32681] /actions/account/approve…` (4 new cases): mirror shape and
single-holder cell, both save orders, over the writable `sys_metadata`
double, the real `MetadataPlugin` boot pass and the protocol: registry
holds both keys, a read naming the holder answers its own item, and the
package-less row's route judges that item and runs the environment's
handler.

## Acceptance notes

- The holder's own route (`/actions/account/approve` in the mirror
shape, `/actions/contact/approve` in the single-holder cell) still
judges no declaration, before and after this change alike (measured both
ways, the metadata fix ablated and rebuilt): its declaration read is the
protocol's execution face (`getMetaItemForExecution`), which beside one
package holder answers the environment's item on the other object
(`judgeBareActionRead` keeps main's answer on that face); the route then
sees another object's action. That face is in
`packages/metadata-protocol` (area E1), where objectstack-ai#32551 records it as
followed up by its owner seat; filed as objectstack-ai#33456 (lease:E1). The route of
the package-less row's object judges and runs that one item (pinned).
- On the same route the environment's item is served with the holder's
`_packageId` and `_provenance: 'package'` (the protocol's artifact
envelope lookup goes by name, not `(object, name)`); the route's own
`packageId` is unset and the environment's handler runs. Measured in the
runtime harness, also area E1, carried by objectstack-ai#33456.
- With one package holding the name on one object and a package-less row
on that same object, the read naming the package without the pass
answers the package's own row, while after the pass it answers the
package-less row when that row was saved last (saved first, the pass
registers the package's row alone). That fold (one entry per `(package,
name)`, the row saved last) is unchanged here and pinned as a CONTROL.
- No change in `packages/metadata-protocol/src/**`,
`packages/metadata/src/metadata-manager.ts` or
`packages/metadata/src/loaders/database-loader.ts`.

## Verification

<details><summary>Local runs</summary>

At 8efae7e (after merging `origin/main` with objectstack-ai#33193):
`@objectstack/metadata` test 78/78 files, 2423 tests;
`@objectstack/objectql` 595/595 files, 12978 tests;
`@objectstack/runtime` 599/599 files, 10707 passed, 19 skipped; metadata
and runtime typecheck exit 0; eslint on the three changed source/test
files exit 0; dogfood battery 466 passed / 3 skipped files, 3944 passed
/ 42 skipped tests. Derived gates: 59 families, 58 exit 0, 1 NOT
MEASURED (`check:dual-build-cjs-loads`, no full dist in the worktree; CI
Build Core covers it); `dispatch-gates --ran` reconciles 59/59.

Ablation (the `customizes` line mutated back to the by-name fold through
`ablation-replace.mjs`, metadata rebuilt, `ablation-dist-preflight
--absent` exit 0): metadata 8 moved cases red, every CONTROL and the
first half's 11 cases green; runtime 4 of 4 new cases red (registry held
one key). Route answers in that state equal the fixed state's (holder's
route: no declaration; package-less row's route: that item,
environment's handler). Restored to the HEAD blob (`git diff HEAD`
empty), metadata rebuilt, fix marker back in `dist/`.
</details>

---
_Generated by [Claude
Code](https://claude.ai/code/session_016WV4cyrFFk86Jqf7Mp5Rzw)_
<!-- signed: domain:server#5 · os-elon-musk ·
session_016WV4cyrFFk86Jqf7Mp5Rzw -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
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

2 participants