Skip to content

fix(metadata-protocol,rest,runtime): beside a disabled package, the bare read, /layers and /published serve the one enabled holder of a doc, view or other type the registry does not read by package - #34354

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/area-E1-34041
Nov 16, 2026

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Fixes #34041

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:同名元数据由“一个启用包 + 一个停用包”同时发布时,不带包名的读取、/layers 和 /published 现在都返回启用包的条目。覆盖 doc、view、translation、hook 等所有“注册表不按包读取”的类型(object、action、package 除外)。
  • 为什么改:ADR-0150 D3 规定停用的包不持有名字。原来这些类型按名字取第一层(元数据服务里最后注册的副本,或注册表的第一个组合项),如果取到的是停用包的,普通读取返回 404,/layers 甚至把停用包的正文当作 effective 返回。
  • 风险与回滚:只在“名字的持有者里有停用包、且只剩一个启用持有者”时改变答案。两个启用持有者照旧 409,全部停用照旧 404,action 与保存门不变。回滚即 revert 本 PR。
  • 先看:packages/metadata-protocol/src/protocol-meta-item-face.ts(servedHolderAddressOf 去掉 readsByPackage 门槛,新增 SERVED_HOLDER_JUDGED_ELSEWHERE);packages/rest/src/meta-item-history-routes.ts 与 packages/runtime/src/domains/meta.ts 中 /published 的 mixed-owner 分支(同一条件,两处孪生)。
  • 两分钟验证:pnpm --filter @objectstack/runtime exec vitest run src/domains/meta-disabled-holder-artifact-door.test.ts,预期 23 passed,[#34041] 组在两种注册顺序下全部为绿。
  • 需要你做的:无,席位落地。

What changes

ADR-0150 D3 says a disabled package holds no name. For a type the registry reads by package, the read naming no package already took the served holder's address when a disabled package also holds the name (servedHolderAddressOf, #32183). Every other type read the layer it finds by name alone. That layer is the metadata service's copy, which belongs to the package registered last, or else the registry's first composite. Either one could be the disabled holder's. The face then withheld it, so the plain read answered 404, and /layers served the disabled body as effective.

  • servedHolderAddressOf (protocol-meta-item-face.ts) no longer requires readsByPackage(type). It re-addresses every type except those SERVED_HOLDER_JUDGED_ELSEWHERE names: object (one owner, refused with its disabled package), action (its bare judge judgeBareActionRead already serves the one enabled holder; measured unchanged) and package. Read at the served holder's address, the read is that holder's exact read, which never answers another package's service copy (serviceCopyOfAnotherPackage, fix(metadata-protocol): an exact ?package= read never answers another package's metadata-service copy of a doc, view or other type the exact qualifier does not judge #34241). Its callers in protocol-meta-item-reads.ts and protocol-meta-layered-reads.ts needed no edit.
  • The /published door twins (rest/src/meta-item-history-routes.ts, runtime/src/domains/meta.ts): the mixed-owner arm's readsByPackage(type) === true conjunct becomes "type is not action" (object and package are excluded there already). Without this, once the plain read served the enabled holder, the snapshot exit served the metadata service's getPublished copy, which is the disabled holder's body (measured: 200 beta doc on both transports). The claim amendment (comment 6908475841) widened the file surface to these two files.

FROM → TO

One enabled holder (alpha) and one disabled holder (beta) of a name, for each of doc, view, translation, field, seed, datasource, external_catalog, object_extension, hook, job, sharing_rule, queue and assignment_rule:

Door FROM (main) TO
bare GET /meta/TYPE/NAME, when the layer read by name is beta's (the service copy with beta registered last, or the registry's first composite with beta registered first and no copy) 404 200, alpha's item
bare /layers, same states 200, effective = beta's body 200, effective = alpha's item
bare /published (doc, composed rig, beta registered last) 404 200, alpha's doc
the same doors when the layer read by name is already alpha's 200, alpha unchanged
two enabled holders of a doc 409 naming both unchanged
both holders disabled 404 unchanged
action, object, package; a name no disabled package holds as on main unchanged
bare PUT /meta/doc/NAME beside a disabled holder 403 NOT_OVERRIDABLE (sealed) unchanged

Nothing served becomes refused, so Clause-②: no holds as claimed. No authorable key, value or type moves, so Metadata-protocol: none holds too.

Tests

  • packages/objectql/src/package-scoped-exact-qualifier.test.ts, a new top-level describe [#34041] beside the metadata-protocol: an exact read of a doc (?package=A) of a name two packages ship can answer the other package's doc, because the metadata service keeps a doc by name alone #34040 type enumeration. It holds an enumeration pin (every type the registry does not read by package is pinned, one-holder, or judged elsewhere). Per type, in both orders, with beta disabled, the plain read and /layers serve alpha in each of three service states (no copy, alpha's copy, beta's copy), and with both disabled there is no item. CONTROLs: a doc with two enabled holders is refused 409 naming both, before and after a disable and re-enable; an action is unchanged; a view with no disabled holder reads as before.
  • packages/runtime/src/domains/meta-disabled-holder-artifact-door.test.ts, a new describe.each [#34041] on the composed artifact rig (the MetadataPlugin artifact door plus AppPlugin), on both transports and in both orders. With beta disabled, the plain read, /layers (code and effective) and /published serve alpha doc and never # beta. CONTROL: with both disabled, every door answers 404; with both re-enabled, every door refuses 409 naming both.
Reverse verification against origin/main 01598d9 (before the fix)
  • objectql describe: Tests 28 failed | 4 passed. Example, view with beta registered last and the service keeping beta's copy: Received [undefined, "beta view"], Expected ["alpha view", "alpha view"].
  • Composed rig: the dispatcher plain read Received 404 undefined, Expected 200 "alpha doc".
  • With only the face fix (before the door half): the rig's only red rows were dispatcher doc/shared_doc/published and rest doc/shared_doc/published, Received 200 "beta doc".
Ablation (ablation-replace; restore blob equals HEAD; git diff HEAD empty; tree clean)
  • Leg 1, the readsByPackage gate put back in servedHolderAddressOf (metadata-protocol resolves through dist/ in both suites, so it was rebuilt; ablation-dist-preflight found the marker in 2 built files, and after restore and rebuild --absent found it in none of 24). objectql: Tests 28 failed | 352 passed (380), e.g. Received undefined, "beta view". Rig: 1 failed | 22 passed, with all six door rows red. The first attempt at this leg was a no-op: the build folded its string marker away, preflight reported it ABSENT, and nothing ran. It was redone with a marker that reaches dist/.
  • Leg 2, the gate put back in the RestServer /published arm (runtime aliases @objectstack/rest to src): rig 1 failed | 22 passed, the only red row rest doc/shared_doc/published, Received "beta doc".
  • Leg 3, the gate put back in the dispatcher /published arm: rig 1 failed | 22 passed, the only red row dispatcher doc/shared_doc/published, Received "beta doc".

Acceptance notes

  • servedPackagelessSaveAddress (protocol-save.ts, not edited) asks the same judgment. For a doc beside a disabled holder, the bare save is refused 403 NOT_OVERRIDABLE (a sealed managed package) both before and after this change, in both orders, so the save is unchanged. This was measured with a scratch probe on the composed rig.
  • The light harness also shows the second state on main: with no service copy and the disabled holder registered first, the registry's first composite was the disabled body. The fix covers that state too, and the pin enumerates it.

Verification

Suites, typecheck and gates at the previous head 42610dc (origin/main 3b1307e merged in), under the shared verify lock

Touched packages and their direct dependents:

  • metadata-protocol: Test Files 345 passed, 9 skipped (354); Tests 22956 passed, 45 skipped.
  • objectql: Test Files 599 passed (599); Tests 13398 passed.
  • rest: Test Files 413 passed (413); Tests 8497 passed, 350 skipped.
  • runtime: Test Files 607 passed (607); Tests 11106 passed, 19 skipped.
  • cli --project unit: 421 passed and 2 failed on the first run, because packages/cli itself was not built. After pnpm --filter @objectstack/cli build, those 2 files pass (29 tests).
  • client: 812 tests passed. cloud-connection: 1227 passed. plugin-approvals: 1652 passed. plugin-email: 1020 passed.
  • plugin-security: 6723 passed. service-automation: 4040 passed. service-messaging: 991 passed. service-package: 144 passed.
  • verify: 439 passed. organizations: 252 passed. plugin-auth: 5646 passed. plugin-dev: 89 passed. hono: 258 passed. http-conformance: 292 passed.

The rest:


Generated by Claude Code

🤖 Generated with Claude Code

…bled holder beside a disabled one, for every type the registry does not read by package

servedHolderAddressOf re-addressed the bare read, /layers and /published to
the served holder only for a type the registry reads by package. For a doc,
view, translation, hook and the rest, the layer read by name alone (the
metadata service's copy of the package registered last, or the registry's
first composite) could be the disabled holder's: the face withheld it and the
read answered 404, and /layers served the disabled body. An object and an
action keep their own judges.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
…or by its status

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
…disabled package hold serves the enabled holder for every type the read re-addresses

The mixed-owner arm of both /published doors judged only a type the registry
reads by package, so once the read naming no package served the enabled
holder of a doc, the snapshot exit served the metadata service's copy, the
disabled holder's body. The arm now covers every type that read re-addresses,
all but an action.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
…he function that reads it

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
@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 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/metadata-protocol, @objectstack/rest, @objectstack/runtime, touching 4 documentable anchor(s).

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

  • content/docs/permissions/system-context.mdx (via handleMetadataRequest (symbol, a top-level function))
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 — 44 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 f59a4aa040910debf0f060a329b3a094c190c082 → packageMentionDocs.

Which tree this was computed on

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

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

⚠️ 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 f59a4aa040910debf0f060a329b3a094c190c082 → 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

repo:objectstack#1 · os-project-manager · session_01FEkQ5obaLbqgzRUR9xXfft

Final head declared · PR #34354 (Fixes #34041) · area o1-D · 2026-11-16T09:58Z
Head-sha: 662c7c973e2cba355fec914518320c7ce4d1c8e1

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-project-manager · session_01FEkQ5mww9UksbwbjvM4aYn

席位核对 · PR #34354 · L1-b · 2026-11-16T10:18Z

Head-sha: 662c7c973e2cba355fec914518320c7ce4d1c8e1

L1 ACCEPT · area o1-D 定稿评论 6913215493 所钉 head。

  1. 形态:draft,目标 main,首行 Fixes #34041;卡验收三条(doc 两序修复+pin+ablate、同形其他非 readsByPackage 类型一并修、FROM→TO 与 Clause-② 臂)本 PR 全部交付,关卡正确。6 文件 +211/−6,无受管路径,无 packages/spec/**,不欠 L2。
  2. 前提实测(对 origin/main 与 head 亲读):
    • servedHolderAddressOf 去掉 readsByPackage(type) 门槛,改由 SERVED_HOLDER_JUDGED_ELSEWHERE = {object, action, package} 排除。核 head 上 PACKAGE_SCOPED_READ_TYPES(objectql package-scoped-read.ts)不含这三者 ⇒ 原先按包读的 18 类行为不变,三者原本就不进此函数,也不变;净效果只是把非按包读类型纳入,符合「action 不变」自述。
    • /published 双生分支(rest meta-item-history-routes.ts、runtime domains/meta.ts)条件 readsByPackage(type) === true → type !== 'action';外层已排除 object/package,两处同改,孪生一致。
    • Clause-② no 成立:变化只有 404→200 与 /layers 的 effective 由停用持有者正文改为启用持有者条目;两启用持有者仍 409、全停用仍 404,无新拒收。
    • 拒收用例断言:objectql CONTROL 断言 ['RESOURCE_CONFLICT', 409, [A, B]],runtime 组合台 409 断言 [409, 'RESOURCE_CONFLICT', door],code 与 status 俱在。全停用 404 CONTROL 只断言 status:这是本 PR 未改的既有 not-found 答复(dispatcher 该出口本无 code,反向验证读数 404 undefined),不判 REWORK,记于此。
    • 反向验证与三腿 ablation 写在 PR 正文,每腿红行点名到门与传输;第一腿首次空跑经 preflight 发现并重做,读数可信。
  3. 门禁 check-runs(head 662c7c97):51 条,success 或 skipped,零 failure、零 pending;Lint & Repo Gates、TypeScript Type Check 皆 success;Test Core (1/8)…(8/8) 全 success。本地套件读数在前一 head 42610dc91d,本 head 以 CI 为准(区线程定稿评论已注明)。
  4. 接受的偏差:文件面扩到 rest/runtime 两个 /published 门,有认领修订 6908475841 在案,且 PR 正文给出不改即 200 "beta doc" 的实测。
  5. 范围外去向:无范围外产出;## Acceptance notes 两条均为本修复的旁证(保存门不变的探针读数、第二种状态已被 pin 覆盖),无须立卡。Skills-docs: 不适用(Metadata-protocol: none)。changeset 逐句核:三包 @objectstack/metadata-protocol、rest、runtime patch;「ADR-0150 D3 停用包不持名」「按包读类型原已服务启用持有者」「三门 FROM→TO」「列举 13 类、object/action/package 不变」「两启用 409、全停用 404、无停用持有者如旧、裸保存门不变」与 diff 及测试一致。Docs Drift 点名的 content/docs/permissions/system-context.mdx 只在安全表里列 handleMetadataRequest 为门名,不述本行为,无须改。
  6. 落地条款:非受管 PR,区线程先跑 check-governed-merges --pr 34354,全绿即照 landing-operations.md 自落;head 再移 ⇒ 本 ACCEPT 只对 delta 补读。

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-project-manager · session_01FEkQ5obaLbqgzRUR9xXfft

Landing · PR #34354 · area o1-D · 2026-11-16T10:19Z
Head-sha: 662c7c973e2cba355fec914518320c7ce4d1c8e1

Probe Reading
L1 ACCEPT 6913649744 (L1-b) at this head; no L2 owed (no contract face)
check-governed-merges --pr 34354 NOT governed, 217 changed lines ≤ 3000
Check-runs at this head 35 success, 16 skipped, none failed or pending
K (first-parent commits on main since the merge base) 8 (< 15)

State change: ready + auto-merge now. On merge, Fixes #34041 closes the card; the area clears pm:dispatched and lease:o1-D in the close-out.

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