Skip to content

metadata: the boot priming pass primes one holder per name for unbundled slotted types, so a bare read of a two-holder name answers the last row saved instead of 409 (epic red line 2) #32521

Closed
3 of 3 issues completed

Description

@objectstack-fleet

domain:server#5 · os-bill · session_01Utp6CX9R5BLZwgJDeivmA7

Breaks epic #31527 red line 2 ("ambiguity reported, never guessed"): after a boot on a host with a DatabaseLoader, a bare read of a name two packages hold answers one package's body instead of 409 ambiguous-in-environment.

Found by the #32458 card thread (claude/project-thread-p4h8mg, session session_01Utp6Cam3nsiJUk5z9eT3PA) as out-of-scope finding F1, class a. Filed as a child of #31527 on the epic seat epic:#31527#1's instruction (session session_01Utp6CYGYEUhpi29FpjLmxT, seat thread, 2026-11-12): "File it as soon as you have the report: a sub-issue of #31527 with the red-line breach in the first line, priority p1 proposed (knock triage to confirm the level), and the reach measured on main."

Blocked-by: #32458

维护者速读

  • 改什么:接了数据库加载器的宿主,启动预载对 api/agent/skill/action/permission 这几类每个名字只载一个持有者。
  • 为什么:两个包同名时,不带包名的读取答了最后存的那个包的正文,而不是 409 报歧义;只按列绑定的行,列表里还会丢掉另一个包。
  • 风险:第一方没有接数据库加载器的宿主(0 处);库里的行不丢不改。修法会改 loadMany/loadManyKeyed 的答案,要单独声明 FROM → TO。
  • 先看:DatabaseLoader.unscopedTypeRows(非打包类型每名只留最高版本行)和 MetadataManager.loadMany 按 body.name 跨加载器去重。
  • 验证:两包同名行,跑真实启动预载后,裸读答 409 点名两个包;列表两个都在。
  • 需要你做的:无,p1 待分诊确认级别,归 server 座位 5。

What happens

MetadataPlugin._loadFromFileSystem primes the registry from MetadataManager.loadMany(type). For an unbundled slotted type, DatabaseLoader.loadMany / loadManyKeyed keep one row per name (unscopedTypeRows: the highest version), and MetadataManager.loadMany also dedupes by body.name across loaders. So when two packages hold a name, only the row saved last is registered. The registry then holds one holder, and readStoreEntry answers it. loadSlottedDiagnosed, which reads every loader's slots and refuses 409 ambiguous-in-environment naming both, is never reached.

Reading on origin/main @ 463b8ea5d (2026-11-12 02:4xZ)

One DatabaseLoader (mock driver) holding ALPHA (version 1) and BETA (version 2) rows of name helper, both bound by package_id. The same for all five types:

Body Bare get(type, 'helper'), no priming Registry after the real boot pass Bare get after the boot list(type) after the boot
bound by the column only (protocol writes) 409 ambiguous-in-environment ["helper"] (package-less slot) BETA's body, unstamped [BETA] — ALPHA missing
stamped _packageId in the body 409 ambiguous-in-environment ["com.beta.app|helper"] BETA's body [BETA, ALPHA]

At 27abd458a8 (#32214 final head) the readings are the same. With #32458 applied, the column-only row also lands in BETA's slot (row 2 shape), and the bare read still answers BETA. So F1 is independent of #32458 and is not fixed by it.

Repro steps

  1. packages/metadata/src/loaders/database-loader.test.ts, with its createMockDriver().
  2. Seed two sys_metadata rows: type: 'agent', name: 'helper', state: 'active', package_id ALPHA at version: 1 and BETA at version: 2, metadata: '{"name":"helper","label":"…"}'.
  3. new MetadataManager({ formats: ['json'], loaders: [] }), registerLoader(new DatabaseLoader({ driver })), get('agent', 'helper') → throws 409 (correct).
  4. new MetadataPlugin({ watch: false, config: { bootstrap: 'eager' } }), clear its manager's loaders, register the same DatabaseLoader, call _loadFromFileSystem(ctx). Then manager.get('agent', 'helper') → BETA's body (should be 409 naming both).

Likely fix surface

Prime one item per (package, slot identity) for every slotted type: DatabaseLoader.unscopedTypeRows (or a keyed read the pass alone uses) and MetadataManager.loadMany's cross-loader dedupe (bundleEntryKey is bundled-only). That moves loadMany / loadManyKeyed answers (declared in #32214 and #32246 as one per name for unbundled types), so it needs its own FROM → TO. Same files as #32458 and #32488 (serial).

Do

  1. Re-measure on main after 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 lands (the readings above were taken on main @ 463b8ea5d and on 27abd458a8).
  2. Prime one item per (package, slot identity) for every slotted type, so the registry holds every holder and a bare read reaches the refusal (409 ambiguous-in-environment, naming both).
  3. Declare every moved loadMany / loadManyKeyed answer FROM → TO with its Clause-② arm, and pin: two holders → bare read 409 naming both, list holds both; one holder → served; CONTROL email_template unchanged. Ablate once.

Serial: after #32458 (same loadMany / DatabaseLoader path), and after #32488.
Clause-②: the claimer declares it after measuring.
Business reason: a boot silently turns an ambiguous name into one package's answer, which ADR-0150 forbids.

Dedupe (priming one holder per name, unscopedTypeRows highest version, bare read two holders after boot 409): none found; related #32458 (the column-bound save on the same pass, does not cover this), #32517 (bundled member dimension).
Suggested-grade: p1 · epic red line 2 breach on the boot path, first-party reach 0.

Sub-issues

Sub-issues

3 of 3 Issues completed
Loading 3 sub-issues

Activity

  1. added
    pm:blocking
    on Nov 12, 2026
  2. objectstack-fleet commented on Nov 12, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#7 · os-sales · session_01L6bhgVSjQBHNkZd6Eqx2XX

    Takeover · #32521 · 2026-11-12T12:37Z (four pieces in one comment, execution-duties.md 〈认领〉)

    ① Release (cross-account): the claim 6812850864 held by os-bill (seat domain:server#5) is released. Whose order: the maintainer. Verbatim: 「开 1 个专题座位负责串行主链和红线复读,再开 2 个 server 座位接卡」 (2026-11-12T12:24:11Z, the os-sales account's project chat), executing the previous holder's handover on #31527 (comments 6823237839, 6823302333), which names a new server seat on another account as the taker.

    ② Assignee: os-bill → os-sales in the same stroke as this comment; pm:dispatched stays.

    ③ Claim:

    Claim: takeover · #32521
    Session: session_01L6bhgVSjQBHNkZd6Eqx2XX (seat; a card thread's session and branch follow in a claim amendment on dispatch)
    Account: os-sales
    Branch: PR #32676 · branch claude/project-thread-skucll @ 2126b08cc
    Worktree: a card thread's checkout of that branch
    Domain: domain:server
    Seat: domain:server#7
    File surface: carried from claim 6812850864 and its amendments, unchanged
    Container & model: M, mode:thread, model: default (dispatch-gates --tier: no path-derived mandate), effort: xhigh (opened while graded p1; triage 6812831416 regraded p2, the thread keeps xhigh)
    Clause-②: no (narrowing) — expected: a guessed bare read becomes 409 ambiguous-in-environment; the dev measures every moved loadMany / loadManyKeyed answer and declares it FROM → TO
    Metadata-protocol: none (expected; the dev confirms)
    Responsibility: carried from claim 6812850864
    Thread-read: 6820277215
    Premise: holds (carried; re-read at the next dispatch step)
    Serial constraints cleared: as stated in ④

    ④ Next: waits on PR #32687 merging; then merge main, adopt pluralEntryKeys, re-measure and re-declare flow, delta review, red-line read, landing. Every landing first gets the epic seat's red-line re-read.

  3. objectstack-fleet commented on Nov 12, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#7 · os-sales · session_01L6bhgT7PFLjd2CJuCsgC4T
    os-dev-report

    {
      "issue": 32521,
      "status": "done",
      "branch": "claude/project-thread-skucll",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/32676",
      "session": "session_01L6bhgT7PFLjd2CJuCsgC4T",
      "premise_still_valid": true,
      "summary": "Card-thread round on the takeover (claim 6823813460): origin/main 34890e0e merged at 1ed281f6 (merge, no rebase), then the changeset/doc commit 131bbc55. Four conflicts in packages/metadata: package-slotted-store.ts takes main whole, so this PR's pluralEntryKey and namesSeveralPackagesHold are deleted and #32517's pluralEntryKeys is the one key; metadata-manager.ts takes main's loadMany / loadManyKeyed (already per (package, name) across loaders) and keeps only this PR's withLoaderEntryPackages content pairing; DatabaseLoader.unscopedTypeRows and the boot pass's contestedNames now read pluralEntryKeys; the match-endpoint plural pin asserts both halves. One deliberate change vs 2126b08c: an action one package binds to two objects is one row per (package, name), as #32517 declares. flow: PACKAGE_SLOTTED_STORE_TYPES on main has nine unbundled types (flow, picklist, mapping, dataset added); every pin takes the live set, so all nine are pinned; changeset, PR body and the doc page now say nine. flow re-measured separately: objectql's start-up sync now registers both holders' flow of a name (FROM the row saved last) and the cold-boot seal warns once naming both ('warn' mode, no refused boot); declared as row 11.",
      "tests": "At 131bbc55 unless noted. metadata whole package (after the merge, 1ed281f6, same code): 75/75 files, 2029/2029 tests. runtime actions-addressed-route.test.ts 47/47. database-loader.test.ts -t '#32521' 103 passed. Red before the fix: this head's tests over main's database-loader.ts, metadata-manager.ts and plugin.ts: 111 failed / 710 passed (821), every moved-answer pin red for all nine types incl. flow, every CONTROL green. Ablation 1, DatabaseLoader key by name alone, built into dist (preflight marker present; after restore rebuild --absent clean): database-loader.test.ts 93 failed, runtime door 1 failed (two-holder refusal), objectql flow probe back to beta alone; restored blob == HEAD. Ablation 2, contestedNames never contested: 27 failed (9 types x 3 orders); restored blob == HEAD. objectql flow probe (temporary, not committed): two holders main [beta] / registry [beta] / seal none; head [alpha, beta] / registry [alpha, beta] / seal one conflict; one holder and one holder + package-less row unchanged.",
      "gates": "dispatch-gates --commands (script-derived, 9 paths vs merge base 34890e0e): 108 commands, cmd :: exit N captured before any pipe, 108 exit 0; check:skill-examples, check:dual-build-cjs-loads, check:type-check-debt first answered exit 3 (prerequisites: client-react dist, nine dists, lock held by this card's dogfood) and were re-run on the same head after the builds, exit 0. --ran: 108 derived, 108 run, 0 NOT-MEASURED (derived zero). pnpm lint exit 0; metadata and runtime typecheck exit 0. CI on 131bbc55: 53 check-runs, 38 success, 15 skipped, 0 failed (Lint & Repo Gates, TypeScript Type Check, Test Core 8/8, Build Core, Governed Surface Queue Guard, Test UI, Live E2E UI, Dogfood Regression Gate, Check Changeset success).",
      "dogfood_battery": "131bbc55 · os-verify-lock: VERDICT command-exit 0 (closure build then pnpm --filter @objectstack/dogfood test, no shard, no path) · Test Files 454 passed / 3 skipped (457) · Tests 3812 passed / 42 skipped (3854) · no failures",
      "line_budget": "+601 / -31 vs main over 9 files (632 changed lines, under 3000); no governed surface",
      "deviations": [
        "PR body rewritten whole through the relay issue_patch on the seat's dispatch order (brief step 7), read back identical (19851 bytes); first two lines attribution, last line the signed trailer.",
        "DatabaseLoader now keys one row per (package, name) for a contested action name, FROM one per binding at 2126b08c; aligned with #32517's declared rule, pins green.",
        "Contract review D1 (af25f64c) not re-reviewed yet; its code is unchanged by the merge."
      ],
      "mcp_calls": "3 — mcp__github__pull_request_read (get, get_check_runs) on #32676, mcp__github__issue_read (get_comments) on #32521; no write tool",
      "api_writes": "2 — fleet-write relay issue_patch on #32676 (run 43256991150, read back identical) and this comment through post-stamped.mjs; plus 2 git push (not REST)",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "class: b · reach: a host wiring a DatabaseLoader, first-party 0 · evidence: two packages' flow rows of one name now both reach ObjectQL registerItem and the cold-boot seal warns once (warn mode); declared as PR row 11, not a defect · noted, not filed"
      ]
    }

    Report taken 2026-11-12T16:18Z.

  4. objectstack-fleet commented on Nov 12, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#7 · os-sales · session_01L6bhgVSjQBHNkZd6Eqx2XX

    Landed · #32521 · 2026-11-12T21:11Z — PR #32676 (ACCEPT 6835409617) merged as 2ca09de55d106b6ddd18c0e704ce40c96b26bccc (on origin/main). pm:dispatched removed in this stroke. Follow-up #32806 (sub-issue, parked under ruling 6824949405 on #31527). The C3 action cell this PR holds loosely tightens in PR #32802 (card #32791).

  5. removed
    pm:dispatched
    on Nov 12, 2026
  6. added 2 commits that reference this issue on Nov 12, 2026
  7. added a commit that references this issue on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:devpathbugdomain:serverpm:blockingpriority:p2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions