Skip to content

fix(metadata-protocol): a package-less doc row beside one holder hydrates as the environment's own item - #39338

Closed
objectstack-fleet[bot] wants to merge 2 commits into
mainfrom
claude/issue-38952-env-doc-one-holder
Closed

objectstack-fleet[bot] wants to merge 2 commits into
mainfrom
claude/issue-38952-env-doc-one-holder

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #38952

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:环境自己保存的文档与恰好一个已启用的包同名时,重启后直接打开该文档看到的是环境自己的内容,不再变成包里的那一份。
  • 为什么做:落实"环境自己的条目永远优先、与同名包的数量无关"这条已定规则,补上只有一个同名包时启动加载的缺口。
  • 出错会怎样:最坏情况是带包名的精确读取或两包同名的情形表现变化;两者都有对照测试钉住,改动只有一个判断条件,可直接撤回。
  • 要你做什么:无

What changes

The boot hydration (loadMetaFromDb) graded a package-less stored doc row as the environment's own item only when two or more packages ship the name. With exactly one enabled holder the row fell to the one-holder envelope lookup and was registered stamped _packageId: HOLDER, _provenance: package, so the bare GET /meta/doc/NAME served the package's doc instead of the environment's own (ruling 6942962369: the environment's own item answers first on every read naming no package, whatever the number of holders).

The environmentDoc predicate in protocol-registry-hydration.ts now holds for one or more shipping packages. The comment citing epic ruling 6817768147 ("it wears its one holder's") is narrowed: that ruling rules the five overlay types a holder's item is customized in (email_template, dashboard, report, view, translation) and sealed types; doc is neither, so it does not bind doc and does not conflict with 6942962369.

Read first (by risk):

  1. packages/metadata-protocol/src/protocol-registry-hydration.ts around the environmentDoc predicate (the only behavioural hunk).
  2. packages/runtime/src/domains/meta-bare-read-own-envelope-38659.test.ts, the new top-level [#38952] describe.

Two-minute check: pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/domains/meta-bare-read-own-envelope-38659.test.ts after building the runtime closure: 40 tests pass, including the 12 new [#38952] cells.

Tests

New top-level describe in the existing shared harness for this rig (artifact-door kernel, one doc shared_doc, package-less sys_metadata row, in-process protocol.loadMetaFromDb after the artifacts), four cells: one holder in both registration orders, and two holders in both orders as CONTROL. Each cell asserts: the registry bare slot holds the row unstamped (_packageId absent, _provenance: org); the bare read on the dispatcher, RestServer and in-process getMetaItem serves environment doc with no _packageId / _packageVersion / packageId, and _provenance / provenance org (the envelope assertion carried from comment 7327944668); CONTROL: each holder's ?package= read keeps its own doc under its own envelope.

Red on origin/main dc4a2cd (ablation: the predicate as it was)

Test file run against main's built metadata-protocol with only the pin added: Tests 4 failed | 36 passed (40). The four reds are the one-holder cells (both orders) of the registry-slot and bare-read assertions; received ["environment doc", "com.qa.alpha", "package"] for the slot, and the bare read served label: alpha doc, _packageId: com.qa.alpha, provenance: package. Two-holder cells and every exact-read CONTROL were green.

Green at d511f64
  • pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/domains/meta-bare-read-own-envelope-38659.test.ts src/domains/meta-disabled-holder-artifact-door.test.ts: Test Files 2 passed (2), Tests 89 passed | 6 skipped (95).
  • pnpm --filter @objectstack/metadata-protocol test: Test Files 384 passed | 9 skipped (393), Tests 23966 passed | 45 skipped (24011); typecheck exit 0; pnpm --filter @objectstack/runtime typecheck exit 0.

Acceptance notes

Verification

Derived gate families at d511f64

dispatch-gates --ran: 71 derived, 66 run with exit 0, 5 NOT MEASURED, 0 unrun. NOT MEASURED, left to CI: check-comment-mask-corpus (timeout on the shared box), check-plugin-teardown-shape --self-test (shallow clone cannot reach its pinned control commit), check:dual-build-cjs-loads (needs every package's dist), check:query-options-erasure and check:type-check-debt (timeouts on the shared box). check-nul-bytes exit 0.


Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01Utp6CY1DVmttnuNH77G3ht

…ates as the environment's own item

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CY1DVmttnuNH77G3ht
@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 Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 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 71 of 256 client-bound route-ledger rows — the other 185 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 185: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 60 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 125 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 ccc0838e804151f3923399b79fb58f93473aba23 → packageMentionDocs.

Which tree this was computed on

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

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

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-bill · os-bill · session_01Utp6CY1DVmttnuNH77G3ht

Hold · 2026-12-03T13:37Z — Test Core (6/12) (and its Test Core roll-up) is red at d511f648 for this PR's own reason: objectql src/protocol-custom-override-bare-slot-envelope.test.ts:498, the #29613 CONTROL for doc (a package-less environment row beside a sealed single holder), which the widened environmentDoc predicate now serves. Whether ruling 6942962369 or the #29613 / ADR-0131 D6 control governs that cell is a maintainer decision (options and dev recommendation: #38952 comment 7379992908). No push until the ruling is recorded on #38952; the #29613 pin is not edited before then.

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