Skip to content

fix(metadata-protocol)!: the restore doors refuse the platform's own record, and the history selector refuses a package that neither holds nor ships the name - #37423

Merged
os-zhuang merged 7 commits into
mainfrom
claude/project-thread-fyj895
Nov 26, 2026
Merged

os-zhuang merged 7 commits into
mainfrom
claude/project-thread-fyj895

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread

Fixes #37130

Clause-②: yes (narrowing)
Metadata-protocol: none
Skills-docs: none — no skills/ page teaches the protocol's restore doors, the history ?package= selector or listPackageBindings

维护者速读

  • 用户能看到什么变化:环境管理员在历史版本里恢复或整批撤销时,平台自带的技能等记录不再被改写成旧版本,而是直接收到冲突提示和处理办法;按应用查看历史时,既没存过也没提供该名称的应用会被拒绝,不再串到环境自己的记录上。
  • 为什么做:这是「平台技能与应用技能分开存放」(云端技能注册)的收尾,补上协议层的两个恢复入口,并顺带修掉同一读取链上的三处小问题。
  • 出错会怎样:受影响的只是在环境里恢复平台自带记录旧版本、或按无关应用查历史的管理员,会收到冲突提示;改动可以直接撤回。
  • 要你做什么:无

What changes

  1. Card item 1 (R21). The metadata protocol's rollbackMetaItem and the restore limb of revertCommit refuse a restore whose row is the platform's own record, with the metadata service's rollback refusal: 409 RESOURCE_CONFLICT, its prescription, nothing written. One rule for the three doors: the refusal that lived privately in database-loader.ts is now refusePlatformRecordRestore(type, name, row), exported by @objectstack/metadata, asked by DatabaseLoader.registerRollback and by SysMetadataRepository.restoreVersion when a door passes refusePlatformRecord: true (both protocol restore doors do; the two undo writes do not). It is judged on the active row restoreVersion itself reads and writes. revertCommit puts the refused item in failed[] and reverts the commit's other items (ADR-0067 D3 as amended). The prescription now also names the environment's route (R23).
  2. Card item 2. historySlotOf (the history, diff and rollback doors' ?package= selector) refuses a package that neither holds a row of the name nor ships it with 409 not-held-by-qualifier, also when the name's package-less row is stored. Before, a read naming such a package fell back to the package-less row and the selector addressed that row. The package-less row is a package's slot only when the package ships the name (ADR-0150 D4).
  3. Card item 3 (R22, R23 nits in code). PLATFORM_PROVENANCE's doc names all three refused restore doors, words the snapshot rule exactly (the platform's own record's publish snapshot, served as the answer, keeps the mark at its top; a snapshot nested inside the answer never carries it) and names the two undo writes by what they undo. The stranded storedRowBodyOf doc comment in database-loader.ts sits on its function again.
  4. Folded (a). list() listed a stored row twice after the boot priming pass when its body's _packageId stamp differed from its package column. Measured: the loader keys the row by its column, and register(…, { skipSourceLoader: true }) filed the primed copy under the body's stamp. The fix is in neither list() nor the loader: the priming registration files such a stamped body under the column's slot (MetadataManager.primedRowSlot), so a primed process answers as an unprimed one does (one listing; a read naming the column's package answers it; the stamp's answers nothing).
  5. Folded (b) N2. Decision: fail closed. listPackageBindings is degraded, naming the loader, over a datasource: loader that offers no loadRowBindings. Reason: such a loader's items answer registration, which is not their rows' binding, and the spec contract already tells a gating consumer to treat a degraded answer as unknown, so this needs no contract change. No such loader ships in the tree.
  6. Folded (c) N7. Cheap fix, no cross-node coordination: bindReadRowPackage already re-reads the row; it now records the column as that re-read finds it, so the node whose boot pass lost the race answers the bound package instead of null until restart.
  7. R16 re-verified, no code. getPublished applies carriesPlatformStamp(item) to the top level only and strips every nested snapshot. Its four pins exist in database-loader.test.ts ("getPublished serves the mark on the top level only when the stored item carries it there").

ADR-0010 note, for the weekly ADR revisions card (out of this PR's file surface): the note should say "a restore whose row is the platform's own record is refused (409 RESOURCE_CONFLICT) at the metadata service's rollback and at the metadata protocol's rollbackMetaItem and the restore limb of revertCommit", in place of "a rollback whose row is the platform's own record is refused (409)".

Deliberate correction

check-empty-changeset is red by design on this PR: it rewrites one pending release note it did not add, because this PR made that note false.

  • Note: .changeset/37013-platform-skill-own-slot.md (pending, from fix(metadata): a skill the platform registers keeps its own slot beside an app's same-named skill #37021). Corrected at 43a6758f, three sentences; the rest of the bullet is byte-identical:
    1. Before: "…and so do the metadata protocol's save door and its restore doors (rollbackMetaItem and the restore limb of revertCommit);" After: "…and so do the metadata protocol's save door and its restore doors (rollbackMetaItem and the restore limb of revertCommit) on every restore whose row is not the platform's own record;"
    2. Before: "rollback whose row is the platform's own record is refused (409 RESOURCE_CONFLICT, naming the fix), with nothing written." After: "A restore whose row is the platform's own record is refused (409 RESOURCE_CONFLICT, naming the fix), with nothing written, at all three restore doors: rollback, and the metadata protocol's rollbackMetaItem and the restore limb of revertCommit."
    3. Before: "getPublished serves it on the answer's top level only when the stored item carries it there, and never inside a publish snapshot;" After: "getPublished serves it on the answer's top level only when the stored item carries it there (the platform's own record's publish snapshot, served as the answer, keeps the mark it carries at its top), and never on a snapshot nested inside the answer;"
  • Confirmation: the same-head contract review record at CONTRACT_REVIEW_TIER judges each rewritten sentence (pm-dispatch references/landing-operations.md); the seat's ACCEPT points to it.

Tests

Read first (by risk):

  1. packages/metadata-protocol/src/protocol-history-slots.ts — the holdsSlot line: the narrowing every ?package= history, diff and rollback request passes through.
  2. packages/metadata/src/metadata-manager.ts — primedRowSlot, the key a primed stored row is filed under.
  3. packages/metadata-protocol/src/sys-metadata-repository.ts — the refusePlatformRecord check inside restoreVersion.

New and changed pins:

  • protocol.platform-mark-rollback.test.ts, new describe: rollbackMetaItem refused 409 with the row byte-identical; revertCommit puts the item in failed[] (code RESOURCE_CONFLICT) and reverts the other item; RESTART: a process primed from the rows answers a read naming the one package holder with that holder's item and getPlatformItem with the platform's v2. Each was red on 5bf72422 before the door lines (expected { success: true, …(4) }, expected [] to have a length of 1, expected 'platform v1' to be 'package rules').
  • protocol-history-slots.test.ts: the case that pinned "P does not ship the name … the environment slot" is replaced by its refusal (the branch the ruling removes), plus a two-holder refusal and a .custom pair CONTROL.
  • protocol-diff-history-slots.33308.test.ts and the dogfood file history-diff-two-holders-33308.dogfood.test.ts: the case that addressed the environment's slot through a package shipping nothing now addresses it through a shipper (unit) or expects the 409 at the history and diff doors (dogfood).
  • database-loader.test.ts: (a) a new list() pin, and the 元数据读取:存储的元数据要能按行上记录的包读出绑定,不从正文推断 #37039 bindings case now expects differs once (it recorded the double listing); N2 and N7 pins.
Ablation (each fix line removed, then restored with git checkout)
Ablated line Red
refusePlatformRecord: true at rollbackMetaItem 1: the rollbackMetaItem pin
refusePlatformRecord: true at revertCommit 2: the revertCommit pin and the RESTART pin
the check in restoreVersion 3: all three door pins
holdsSlot = slot !== null && … back to slots.includes(slot) 3: two selector pins and the 33308 diff case
primedRowSlot not passed to writeRegistryEntry 2: the new list() pin and the #37039 bindings case
N2 degraded = true 1: the N2 pin
N7 column record after the re-read 1: the N7 pin
refusePlatformRecordRestore answering nothing 2: the service rollback pins of #37013
Package runs
  • pnpm --filter @objectstack/metadata test at abc706ce: Test Files 83 passed (83), Tests 2808 passed (2808).
  • pnpm --filter @objectstack/metadata --filter @objectstack/metadata-protocol typecheck at abc706ce: both Done, exit 0.
  • pnpm --filter @objectstack/metadata-protocol test at 955a3452 (the last commit touching either package before the changeset and the merge of main, which touched neither): Test Files 370 passed, 9 skipped (379); Tests 23440 passed, 45 skipped (23485). Re-run at abc706ce under the verify lock: same counts, command exit 0. pnpm --filter @objectstack/dogfood test at abc706ce under the lock: Test Files 487 passed, 3 skipped (490); Tests 4128 passed, 68 skipped (4196); exit 0.

Acceptance notes

  • Declaration: the claim reads Clause-②: no (narrowing…). The diff also widens the public surface (the refusePlatformRecordRestore export and the refusePlatformRecord option of restoreVersion), so it declares yes (narrowing).
  • The unreleased .changeset/37013-platform-skill-own-slot.md still carries two of round 4's texts (R22 c and d: "of a failed batch row write", and the protocol doors reading the mark's one definition) and "never inside a publish snapshot". That file is outside this claim's file surface; carrier: the seat, as a deliberate correction with the next text edit.
  • Round 4's R21 paragraph also named one more reading (a version the platform registered is attributed to the environment in history, so after the platform withdraws its record under a one-holder name a rollback naming the package can write it into the package's row). Not in this claim's scope and not changed here; carrier: the seat.
  • feat(metadata): listPackageBindings reads an item's package from its stored row's package column #37187's N3 and N6 were not folded into this card and are untouched.
  • Reading, not measured end to end: the GET /meta/:type/:name/published overlay branch serves a stored row's own body, as round 4 read it; a snapshot nested in that body is served as stored.

Verification

Two-minute check: pnpm --filter @objectstack/metadata-protocol exec vitest run src/protocol.platform-mark-rollback.test.ts src/protocol-history-slots.test.ts after building @objectstack/metadata; expect 6 and 17 passed, including the three [#37130] door pins and the two [#37130] selector refusals.

Local gates at abc706c

node scripts/pm/dispatch-gates.mjs --commands derived 72 commands; all 72 run, 70 exit 0 at abc706ce. Two exit 3 (prerequisite not met, NOT MEASURED; CI runs both): node scripts/check-plugin-teardown-shape.mjs --self-test (shallow clone), pnpm check:dual-build-cjs-loads (unbuilt packages outside this diff). pnpm check:type-check-debt re-run: exit 0. dispatch-gates --ran: "72 derived famil(ies) accounted for — 70 run, 2 NOT-MEASURED". overlap-check --pr=37387: merges cleanly with origin/main and #37387.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JQwxba3jmfHtmkWfFXfVTc

… whose row is the platform's own record

rollbackMetaItem and the restore limb of revertCommit ask the metadata
service's rollback refusal (refusePlatformRecordRestore, now exported by
@objectstack/metadata) on the row SysMetadataRepository.restoreVersion
writes: 409 RESOURCE_CONFLICT, nothing written; revertCommit reports the
item in failed[] and reverts the others. Pins per door plus a restart pin.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxba3jmfHtmkWfFXfVTc
…her holds nor ships the name never addresses the package-less row

historySlotOf counted the package-less row a read naming the package falls
back to as that package's slot whether or not it ships the name. It is now
the package's only when the package ships the name (ADR-0150 D4); any other
package is refused 409 not-held-by-qualifier, as the selector's description
states. The 33308 unit and dogfood fixtures that addressed the environment's
slot through a non-shipping package are retargeted.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxba3jmfHtmkWfFXfVTc
…column is listed once, under its column

The boot priming pass filed a stored row's body under its body's _packageId
stamp while the row loader keys the row by its package column, so list()
listed the row twice. register() with skipSourceLoader now files such a
body under the column's slot, so a primed process answers as an unprimed
one does.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxba3jmfHtmkWfFXfVTc
… reads no column, and a node that finds a legacy row bound answers the bound column

N2: a datasource: loader without loadRowBindings makes the answer degraded,
naming the loader, instead of an undegraded registration binding.
N7: bindReadRowPackage records the column as its re-read finds it, so the
node whose boot pass lost the race to bind a legacy row answers the bound
package rather than null until restart.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxba3jmfHtmkWfFXfVTc
…or refuse what they answered before

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

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/metadata-protocol, @objectstack/metadata, touching 12 documentable anchor(s). ⚠️ 2 changed file(s) yielded no anchor (packages/metadata/src/index.ts, packages/metadata/src/package-slotted-store.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

6 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/deployment/cli.mdx (via /packages/:id/commits/:commitId/revert (route, the route ledger binds it to client method packages.revertCommit))
  • content/docs/kernel/cluster.mdx (via MetadataManager (symbol, a top-level class))
  • content/docs/kernel/contracts/metadata-service.mdx (via listPackageBindings (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))

⛔ 4 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/v18/18-1.mdx (via revertCommit (symbol, a method of class ProtocolPackageCommitsFacet))
  • content/docs/releases/v18/18-5.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
  • 2 changed file(s) yielded no anchor (packages/metadata/src/index.ts, packages/metadata/src/package-slotted-store.ts) — pages documenting those are invisible to this run
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 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; 124 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 — 17 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 ee11fce924ee0be609807738a3e0770cf6c396a3 → packageMentionDocs.

Which tree this was computed on

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

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

⚠️ 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 ee11fce924ee0be609807738a3e0770cf6c396a3 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…ee with the code, and restoreVersion's option sits under its package

The unreleased #37013 note named only `rollback` as refusing the platform's
own record and said the protocol's restore doors store every body without
the mark; all three restore doors refuse it and the protocol's doors strip
it from every other restore. Its snapshot sentence now uses the wording of
PLATFORM_PROVENANCE's doc. The #37130 note lists restoreVersion's
refusePlatformRecord option under @objectstack/metadata-protocol, where
SysMetadataRepository ships.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxba3jmfHtmkWfFXfVTc
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#1 · os-warren · session_01JQwxba3jmfHtmkWfFXfVTc

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 43a6758fe8859a4e4b6a96a7ea49cceaae6fae63
Local-runs: none
Scope: packages/metadata-protocol/src/protocol-history-slots.ts, packages/metadata-protocol/src/protocol-package-commits.ts, packages/metadata-protocol/src/sys-metadata-repository.ts, packages/metadata/src/index.ts, packages/metadata/src/loaders/database-loader.ts, packages/metadata/src/metadata-manager.ts, packages/metadata/src/package-slotted-store.ts, packages/metadata-protocol/src/protocol-diff-history-slots.33308.test.ts, packages/metadata-protocol/src/protocol-history-slots.test.ts, packages/metadata-protocol/src/protocol.platform-mark-rollback.test.ts, packages/metadata/src/loaders/database-loader.test.ts, packages/qa/dogfood/test/history-diff-two-holders-33308.dogfood.test.ts, .changeset/37130-platform-record-restore-doors.md, .changeset/37013-platform-skill-own-slot.md + packages/metadata-protocol/src/protocol-authoring-gate.ts, packages/metadata-protocol/src/protocol-class-head.ts, packages/metadata-protocol/src/batch-object-registration.ts, packages/metadata-protocol/src/protocol-history-and-publish.ts, packages/metadata-protocol/src/protocol-save.ts, packages/metadata-protocol/src/protocol-diff-delete-load.ts, packages/metadata-protocol/src/protocol-package-commit-record.ts, packages/metadata-protocol/src/index.ts, packages/metadata-core/src/objects/sys-metadata-commit.object.ts, packages/spec/src/api/protocol.zod.ts, packages/spec/src/contracts/metadata-service.ts
Security-touching: no
Rule-change-verified: none

Face: narrowing (Clause-②: yes (narrowing) on the PR body and on .changeset/37130-platform-record-restore-doors.md; no published schema and no governed path in the 14-file list, none under .claude/**). Inputs: card #37130 with its six comments, PR #37423 (body, file list, net diff against main at merge base ecbe854b), and the check-runs on the head. The review began on abc706ce; the head then moved to 43a6758f. I read git diff abc706ce..43a6758f myself: two files, both under .changeset/, 6 insertions and 2 deletions, so every code and test hunk judged below is byte-identical on this head. The seat's note that moved the head also named the changeset correction as a duty; its two claims (a changeset-only delta, and a Check Changeset red that is the deliberate-correction class) were checked against the tree and the job log, not adopted.

① Derived judgments

Accept-set and public-surface changes the diff implies, each judged:

  1. rollbackMetaItem refuses a restore whose active row is the platform's own record: 409 RESOURCE_CONFLICT, nothing written (protocol-package-commits.ts:2268, judged at sys-metadata-repository.ts:2026 on the row the same call then writes). Right: card item 1, the service door's own refusal function.
  2. The restore limb of revertCommit refuses the same row per item, into failed[] with code: RESOURCE_CONFLICT, and the commit's other items still revert (protocol-package-commits.ts:1732; the per-item catch pushes to failed[], and revertPlan.push sits after restoreVersion, so a refused item is not in the revert's own commit). Right: ADR-0067 D3 as amended runs per item.
  3. The history, diff and rollback ?package= selector refuses a package that neither holds a row of the name nor ships it, also when the package-less row is stored (protocol-history-slots.ts:206-210). Right, and it is the spec's own refusal made real: HISTORY_PACKAGE_SELECTOR_DESCRIPTION (packages/spec/src/api/protocol.zod.ts:2727, unchanged on main) already says "a package that neither holds nor ships the name is refused 409 not-held-by-qualifier". What is taken away is a behaviour that description contradicted; the description needs no edit, since a shipper still addresses the package-less row.
  4. Public surface added: refusePlatformRecordRestore exported from @objectstack/metadata (packages/metadata/src/index.ts), and the optional refusePlatformRecord option of SysMetadataRepository.restoreVersion (the class is exported at packages/metadata-protocol/src/index.ts:246). Right: additive, default off, no caller changes behaviour without passing it. The private refusePlatformRecordRollback it replaces was never exported, so nothing is removed.
  5. The refusal's message gains one clause; code and status are unchanged. Right as to the envelope; the clause is N1.
  6. MetadataManager.list() after the boot priming pass lists a row whose body stamp differs from its column once, under the column (primedRowSlot, metadata-manager.ts:1911); a read naming the stamp's package no longer answers the primed copy. Right: it is what an unprimed process over the same rows answers, and the new pin holds a cold-manager control.
  7. listPackageBindings answers degraded: true, naming the loader, over a datasource: loader with no loadRowBindings. Right: packages/spec/src/contracts/metadata-service.ts:463 already tells a gating consumer to treat a degraded answer as unknown, so no contract text moves. DatabaseLoader is the only datasource: loader in the tree and offers the method.
  8. bindReadRowPackage records the column the re-read finds; the node that lost the first-boot race answers the bound package, not null. Right, and no query is added: the re-read predates the hunk.
  9. No schema key, accepted value, error code, refusal reason or route is added: RESOURCE_CONFLICT and not-held-by-qualifier both exist. Metadata-protocol: none is right.
  10. Three expectations are inverted to the 409 the ruling states (one unit case, its 33308 twin, one dogfood case). Right: each pinned the branch card item 2 removes.

Gate verdicts, read as check-run conclusions on 43a6758f at record time: every run has concluded (read 2026-11-26T04:20Z, head unchanged). Success: Build Core, Test Core and all ten of its shards, Type Check · workspace, Type Check · source gates, Type Check · consumer gates, Type Check · debt ledger, TypeScript Type Check, Dogfood Regression Gate, Live E2E UI, Test UI, Lint & Repo Gates with its eight Lint · jobs, Spec property liveness, Governed Surface Queue Guard, PR-body guards, Check PR Size, Plan Test Core shards, Flag docs affected by code changes, Auto Label, filter. Failure: Check Changeset, both runs, for the single reason judged in ② (the deliberate correction of a pending note); its level, ADR-0087 and major-bump lines pass. Eighteen runs are skipped (UI build and opt-in families this diff does not select). The dev's two local NOT MEASURED families are answered by these runs.

② Semver level

.changeset/37130-platform-record-restore-doors.md: patch on @objectstack/metadata and @objectstack/metadata-protocol, Clause-②: yes (narrowing), Metadata-protocol: none, a BREAKING banner with a "What to do" line under each breaking bullet, and one ADR-0087 marker (not-required (no-migration-prescription)). Right. AGENTS.md Post-Task step 3 sets the level by the metadata-protocol kind alone, and a non-protocol breaking change ships patch with its banner and disposition; nothing an author can write is added, refused or re-meant here. The Check Changeset job prints the same reading on this head: "LEVEL AXIS: this PR declares clause-② yes (narrowing) and metadata-protocol none ... a non-protocol change at patch", and "1 declared-breaking changeset(s), each carrying an ADR-0087 disposition". yes in place of the claim's no is right: the diff adds public surface (① item 4).

The new section "Also in @objectstack/metadata-protocol" of that note reads: "SysMetadataRepository.restoreVersion takes refusePlatformRecord: true to ask refusePlatformRecordRestore (@objectstack/metadata) on the row it writes; the undo writes do not pass it." Right, sentence by sentence: the option is declared at sys-metadata-repository.ts:1952; it is asked on activeRow, the row put then updates; and neither undo write passes it (batch-object-registration.ts:351, protocol-history-and-publish.ts:162). Moving it out of the @objectstack/metadata list is right, since the class ships from the other package. The bullet left under @objectstack/metadata ("refusePlatformRecordRestore(type, name, row) is exported: the one refusal the service's rollback and the protocol's two restore doors ask") is right: database-loader.ts:1932 and sys-metadata-repository.ts:2026 call the one function.

Deliberate correction of a pending note: .changeset/37013-platform-skill-own-slot.md. Check Changeset is red on this head in both of its runs for exactly one reason, the check-empty-changeset refusal that this file "exists on the merge base and was not added by this PR"; every other line of the job is a pass. The PR body declares the correction under "Deliberate correction" and names the note. git diff abc706ce..43a6758f shows one line of that file changed, in three places, with the frontmatter and the rest of the bullet untouched. Per .claude/skills/pm-dispatch/references/landing-operations.md, this record judges each rewritten sentence against the tree, before and after:

  • Strip sentence. Before: "... and so do the metadata protocol's save door and its restore doors (rollbackMetaItem and the restore limb of revertCommit); a stored row the boot pass re-registers keeps it only when the row held it as read." After: "... and so do the metadata protocol's save door and its restore doors (rollbackMetaItem and the restore limb of revertCommit) on every restore whose row is not the platform's own record; a stored row ...". On main the Before was true of every restore (the door pins were red there because the platform's row was written back). On this head a restore over the platform's row writes nothing, so the Before over-states and the After is exact: the strip is withoutPlatformOrigin in restoredBodyWriter (protocol-authoring-gate.ts:135), which both doors receive through restoreWriteFor, and the refusal precedes the write. Right.
  • Refusal sentence. Before: "rollback whose row is the platform's own record is refused (409 RESOURCE_CONFLICT, naming the fix), with nothing written." After: "A restore whose row is the platform's own record is refused (409 RESOURCE_CONFLICT, naming the fix), with nothing written, at all three restore doors: rollback, and the metadata protocol's rollbackMetaItem and the restore limb of revertCommit." The Before named one door of three on this head. The After matches database-loader.ts:1932, protocol-package-commits.ts:2268 and :1732. At revertCommit the refusal is per item, in failed[], which the 37130 note states beside it. Right.
  • getPublished sentence. Before: "getPublished serves it on the answer's top level only when the stored item carries it there, and never inside a publish snapshot;" After: "getPublished serves it on the answer's top level only when the stored item carries it there (the platform's own record's publish snapshot, served as the answer, keeps the mark it carries at its top), and never on a snapshot nested inside the answer;". The code is the same on main and on this head (metadata-manager.ts:3612, withoutServedPlatformMarks at :742): the answer is the item's publishedDefinition when it has one, keepTop is carriesPlatformStamp(item), and only a publishedDefinition nested in the answer is always stripped. So the Before was already inexact when it merged (a snapshot served as the answer can keep the mark), and the After is exact. Right. One note on the PR body's framing: this PR did not make that third sentence false, it was imprecise before; that is a wording matter of the PR body only and is folded into N4.
  • "of a failed batch row write", left unchanged on purpose: no longer the exact wording, and it was not exact before either. undoBatchRowWrite undoes a row whose write landed and whose registration the registry then refused (settleBatchObjectRows, batch-object-registration.ts; both callers' messages say "the registry refuses it"). A write that failed leaves nothing to undo. The same diff corrects this phrase in the code (PLATFORM_PROVENANCE: "the undo of a batch row the registry refused (undoBatchRowWrite)"), so the code doc and the pending note now differ. Graded N3.

The correction is confirmed for the three rewritten sentences.

③ Boundary flags

Open question (the export and the option without a maintainer decision): on the design, option A is right and I find no fork. (a) It is an additive export of a refusal the producer already shipped privately (refusePlatformRecordRollback), from the entry that since #37013 exports the mark's one definition to the same consumer (PLATFORM_PROVENANCE, carriesPlatformStamp, isPlatformOrigin, withoutPlatformOrigin, beside historyRowAttribution). (b) The card rules "the same prescription as the service's rollback"; option B is a second copy of code, status and sentence in metadata-protocol, which is the drift the card closes. (c) The option is optional and off by default, and the two undo writes stay byte for byte. (d) No error code, reason value, schema key or route is added.

On the route, two texts govern and I read them together. .claude/agents/os-dev.md (the stop section) has a change to a published export reported as needs_decision; pm-dispatch SKILL.md's escalation frame lands a new export name that has a producer precedent under the veto window, with the seat naming the precedent. A new export is not a change to a published one, so the second text governs the export, and its precedent is (a). The optional option on the already-published restoreVersion is nearer the first text's letter, though it is additive and changes no existing call. The dev reported done and asked, where the stricter reading would have stopped first: a process note for the seat, not rework. Answer: acceptable without a decision card, provided the seat's ACCEPT names both additions and the precedent so the maintainer's veto window covers them. This record does not rule in the maintainer's place; if the seat reads the option under the first text, it goes to him, and nothing in this review depends on which.

Deviations:

  • Clause-②: yes (narrowing) where the claim read no (narrowing): right, see ②.
  • The dogfood file outside the claim's surface, and its unit twin, retargeted to the 409: accepted. Both pinned the removed branch and would be red otherwise; the edit is the minimum, and the surviving branch (a shipper addressing the package-less row) keeps its unit pin through shippers: [BETA].
  • PR body stale on three readings at abc706ce: the body on this head carries the re-run figures. One line is stale again, N4.
  • Two local gate families NOT MEASURED: CI answers them; see the gate verdicts in ①.

Carriers the report names, each answered:

SQL push-down: no finding. No hunk adds a query, an id materialisation or an in-app join. restoreVersion judges the activeRow it already read, bindReadRowPackage reuses its existing re-read, historySlotOf asks the same two reads as before, and primedRowSlot and the listPackageBindings branch are in memory.

Security line: no. No hunk teaches permission, sharing, credential, token or authentication behaviour. The refusals apply to every caller alike and address which row a door writes or reads; degraded is a completeness signal.

Read outside the diff, not reviewed, for the seat: adoptOrphans (protocol-package-commits.ts, the orphan filter near line 897) rebinds every package-less row that is not artifact-backed by its column alone, and I found no exclusion of the platform's own record there. Read, not measured. If it holds, an adopted platform row keeps the mark under a package's column, and N5 applies to it.

④ Design judgment

No must-fix, no should-fix.

The narrowing against the published spec on main: it makes the spec's own refusal real (① item 3) and takes no declared capability away. The restore refusal is new behaviour the card rules, at doors whose spec text names no platform record.

Per file, against the card and the cited code:

  • sys-metadata-repository.ts: holds. The check sits after the read of the row the write addresses and before put, so "judged on the row it writes, before anything is written" is true sentence by sentence. Earlier refusals of the same call (VERSION_NOT_FOUND, the tombstone, a refused body) can answer first; each also writes nothing.
  • protocol-package-commits.ts: holds. Both doors always state packageId, so the row judged is the row restored. Tried: bare rollback of a platform-only name (refused); ?package= of a shipper falling back to the platform's row (slot null, refused here or at the package-less close before it); ?package= of a non-shipper (refused earlier by item 2); the two undo writes (unchanged, they are the only other restoreVersion callers); rollbackToPackageCommit (goes through revertCommit).
  • protocol-history-slots.ts: holds. The only branch that changes is slot === null with a package that does not ship the name. A package's own row, its .custom pair's declared override, the unserved-row branch, and the row-held-base recursion (the base holds a row when the bare door asks) all answer as before.
  • database-loader.ts: holds. registerRollback asks the same predicate on the same row as before; the function is the old one with the row test moved inside. The storedRowBodyOf comment sits on its function. N7's record is taken only for a legacy row the read handed out.
  • metadata-manager.ts: holds. primedRowSlot answers only for a body a row loader handed out (readRowColumnOf), on the boot pass (skipSourceLoader, whose one caller is plugin.ts:1821), with a filled column and a different stamp; every other write keeps the write rule's key. The unstamped-body sentence agrees with withEntryPackage, which stamps a body that names no package with its entry's.
  • package-slotted-store.ts: holds. Each sentence of the reworded PLATFORM_PROVENANCE doc matches the code: the strip list, the three refusing doors, the two undo writes by what they undo, and the snapshot rule.
  • index.ts: holds.
  • The five test files: the pins assert the refusal, the unchanged row and the surviving item; the selector pins assert reason, caller and candidates; the list(), N2 and N7 pins carry a control or an exact write count. Their red-on-base and ablation counts are the dev's reading, not re-run here.

Nits (none changes correctness or the contract):

  • N1 (nit) — the prescription's new clause, "to make an earlier version the environment's own item of the name, save that version's body again" (database-loader.ts, repeated in the 37130 note), names a route whose result lasts until the platform's next registration: the pending 37013 note states that a package-less environment write under a platform name "takes the bare slot without the stamp, and the platform's next registration restores its record". The same message says the platform registers again at its next boot, so a reader can infer it, but the clause does not say it.
  • N2 (nit) — the revertCommit door pin and the RESTART pin serve a commit row with no package_id. recordPackageCommit (protocol-package-commit-record.ts:56, packageId: string) is the only writer of that table, and the limb's own comment says it never writes the package-less row. With a commit that names its package the limb reads that package's row, which the platform's package-less record is not. The pins do go red without the line, and the earlier 技能元数据:平台注册的技能要能与同名应用技能并存,平台写入和撤回不碰应用的槽位 #37013 pin in this file uses the same harness shape; but the acceptance's restart pin rides this door, not rollbackMetaItem, where the scenario is reachable through a bare rollback, and the note's "Before, both doors wrote the version back" holds for revertCommit only on such a row.
  • N3 (nit) — "of a failed batch row write" in .changeset/37013-platform-skill-own-slot.md, see ②.
  • N4 (nit) — the PR body's "Acceptance notes" still say the 37013 note "still carries ... 'never inside a publish snapshot'" and is "outside this claim's file surface", beside a "Deliberate correction" section that rewrites it; and that section says the PR made the note false, which is true of two of its three sentences. PR-body prose only.
  • N5 (nit) — refusePlatformRecordRestore reads the mark off the row's body alone, while the protocol's own reader of the same fact, isPlatformRecordRow (protocol-diff-delete-load.ts:1867), also requires an empty package column. They agree on every row the current doors write. On a package-bound row whose body keeps the mark and names no package they differ, and the refusal would then prescribe naming the package the caller already named.

Implemented-by: claude/project-thread-fyj895
Reviewed-by: session_01JQwxba3jmfHtmkWfFXfVTc (an isolated sub-agent of this session, read-only; the dispatch order was not an input)

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#1 · os-warren · session_01JQwxba3jmfHtmkWfFXfVTc

席位核对

ACCEPT · head 43a6758fe8859a4e4b6a96a7ea49cceaae6fae63 · Area: cloud zone · read 2026-11-26T04:22Z

Checklist (l1-review-checklist.md). The mechanical items come from l1-face.mjs --pr 37423 at this head, and all are ok:

  • shape;
  • first line Fixes #37130, with no closing keyword on any other card;
  • no releases path;
  • the changeset covers both published packages (@objectstack/metadata, @objectstack/metadata-protocol, patch);
  • declarations Clause-②: yes (narrowing) · Metadata-protocol: none;
  • floor checks Lint & Repo Gates and TypeScript Type Check are success.

Checks at this head: 38 success, 18 expected skip, and 2 failed. Both failures are Check Changeset, red by design (below). check-governed-merges.mjs --pr 37423: NOT governed, 410 lines ≤ 3000.

  • Fixes is right. Card amendment 7147761520 lists what stays open, and the diff delivers it:

    • item 1: both protocol restore doors refuse the platform's own record through the one refusePlatformRecordRestore that the service's rollback asks, and revertCommit puts the refused item in failed[] (ADR-0067 D3 as amended);
    • item 2: the historySlotOf holdsSlot line;
    • item 3: the code nits.

    The ADR-0010 note is the one line outside this PR's surface. carrier: the weekly ADR revisions card, with the wording the PR body gives. R16 was re-verified on the tree with no code change: the four getPublished pins already exist in database-loader.test.ts. The folded follow-ups from 7180250767 are each fixed and pinned: (a) primedRowSlot, (b) N2 degraded, (c) N7 column record.

  • Sentence reads (owed by face). I read both changesets against the code at this head.

    • .changeset/37130-platform-record-restore-doors.md: each bullet matches the diff. The restoreVersion option now sits under @objectstack/metadata-protocol.
    • .changeset/37013-platform-skill-own-slot.md is a pending note that this PR rewrites, a DELIBERATE CORRECTION. The PR body's "Deliberate correction" section names the note and quotes the three sentences before and after. The same-head CONTRACT_REVIEW_TIER record, comment 7182526807, judges each rewritten sentence right in its ②. That record is the confirmation landing-operations.md asks for, because this PR changes code. The check-empty-changeset red at this head is that class and nothing else: the job log's only ##[error] names that note.
  • Tests. The PR body and report 7182042115 record real runs: @objectstack/metadata 83 files / 2808 passed, and @objectstack/metadata-protocol 370 files / 23440 passed. Eight ablations each went red, and the new door pins were red on base 5bf7242 with the quoted assertions.

  • L2. Narrowing face at CONTRACT_REVIEW_TIER: PASS on this head, No must-fix, no should-fix., five nits (comment 7182526807). Adopted: an isolated sub-agent at that tier, which never saw this seat's conclusions. Its Scope: covers every non-prose path of the diff, plus the cited files it read.

  • Open question (dev report): the export refusePlatformRecordRestore and the optional restoreVersion option refusePlatformRecord. Seat's call: A, keep both. There is precedent for each, so the maintainer's veto window applies rather than a decision card (SKILL.md 〈升级与决策〉):

    No error code or reason value is added: RESOURCE_CONFLICT and not-held-by-qualifier both exist.

Accepted deviations:

  • The claim (comment 7180818366) read Clause-②: no (narrowing). The diff also adds the export above, so the PR declares yes (narrowing). The diff decides, and the at-tier L2 PASS covers both arms.
  • packages/qa/dogfood/test/history-diff-two-holders-33308.dogfood.test.ts is outside the claimed surface. It pinned the branch that item 2 rules out, and now expects the 409. Its unit twin was retargeted the same way.
  • The L2 nits are not fixed here, because each would move the head:
    • N1: the prescription's "save that version's body again" lasts only until the platform's next registration;
    • N2: the revertCommit and RESTART pins use a commit row with no package_id;
    • N3: "of a failed batch row write" in the 37013 note;
    • N4: the PR body's acceptance notes predate the correction;
    • N5: the body-only mark read vs isPlatformRecordRow's empty-column test.
  • N2 (feat(metadata): listPackageBindings reads an item's package from its stored row's package column #37187's follow-up b) adds a cause of degraded that the listPackageBindings docblock and content/docs/kernel/contracts/metadata-service.mdx do not enumerate. It falls under their existing "a row loader whose rows could not be read" reading, and the consumer rule (treat degraded as unknown) is unchanged.

Follow-ups. carrier: the area:cloud zone; none are filed here.

Landing: owed the full dogfood battery on this head (the title has ! and the declaration a (narrowing) arm). The abc706c run (4128 passed) does not pin 43a6758, so the dev is re-running the battery on this head. The PR lands after that report, per landing-operations.md B. The red Check Changeset goes into the queue under SKILL.md's three conditions, with the confirmation above.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#1 · os-warren · session_01JQwxba3jmfHtmkWfFXfVTc

Landing 2026-11-26T05:18Z · head 43a6758fe8859a4e4b6a96a7ea49cceaae6fae63 · ACCEPT 7182545383 · L2 PASS 7182526807

probe reading
checks at head (pr-state.mjs) 38 success · 18 expected skip · Check Changeset red by design: the DELIBERATE CORRECTION of .changeset/37013-platform-skill-own-slot.md, which the same-head L2 record confirms
landing-k.mjs K = 10 < 15; no locale or shared-budget leg
dogfood battery 43a6758f · VERDICT command-exit 0 · 4128 passed, 0 failed (report 7183349622)
governed NOT governed, 410 lines ≤ 3000

State: ready + auto-merge. On MERGED, Fixes #37130 closes the card and pm:dispatched comes off.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 26, 2026 05:18
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 26, 2026
@objectstack-fleet
objectstack-fleet Bot marked this pull request as draft November 26, 2026 05:35
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#1 · os-warren · session_01JQwxba3jmfHtmkWfFXfVTc

维护者速读

  • 用户能看到什么变化:环境管理员在历史版本里恢复或整批撤销时,平台自带的技能等记录不再被改回旧版本,而是收到冲突提示和处理办法。按应用查看历史时,既没存过也不提供该名称的应用会被拒绝。
  • 为什么做:这是「平台技能与应用技能分开存放」的收尾,补上协议层的两个恢复入口;同一读取链上的三处小问题也一起修了。
  • 出错会怎样:最坏情况是本该成功的恢复被误拒,提示冲突但什么都不写;改动可以整体撤回。
  • 要你做什么:这个 PR 申报了收窄(Clause-②: yes (narrowing))。按 2026-11-19 的裁定,它要由维护者落地:请 os-zhuang 在 GitHub 上 Approve 现 head 43a6758fe8859a4e4b6a96a7ea49cceaae6fae63。合并队列的 Governed Surface Guard 在 2026-11-26T05:20Z 因缺这个批准把它踢出了队列。

Contract review PASS: comment 7182526807, Head-sha: 43a6758fe8859a4e4b6a96a7ea49cceaae6fae63, CONTRACT_REVIEW_TIER. ACCEPT: 7182545383. Dogfood at head: 7183349622. The PR goes back to draft until the approval lands, and then the seat re-arms it.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 26, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 26, 2026 05:37
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit 8e1e15b Nov 26, 2026
62 of 65 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-fyj895 branch November 26, 2026 06:08
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 26, 2026
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…nto a package's row, and adopt-orphans leaves the platform's record (objectstack-ai#37640)

Fixes objectstack-ai#37604

Clause-②: yes (narrowing)
Metadata-protocol: none
Skills-docs: none — no `skills/` page teaches restoring a
platform-registered version, adopting orphans over the platform's
record, or `listPackageBindings`

## 维护者速读
-
用户能看到什么变化:平台撤回某个内置记录后,管理员按包回滚(或回退某个包的提交)时,如果选中的是平台自己登记的那个版本,会被明确拒绝并提示改为重新保存;"领养孤儿元数据"不再把平台内置记录划进某个包;其余操作不变。
- 为什么做:这是平台内置技能、智能体、工具那一轮收尾留下的两处边角,防止平台自己的内容被悄悄写进某个包里,变成那个包的东西。
- 出错会怎样:只涉及两个少见的管理操作;被拒绝时什么都不写,本改动可直接撤回。
- 要你做什么:无。

## What changes

**Item 1 — a version the platform registered is never restored into a
package's row.** Reproduced on main first (pins red on base, readings
below): after the platform withdraws its record of a skill, the name's
one remaining holder is the package, a version attributed to the
environment counts as that package's slot (`isVersionOf` /
`isAddressedVersion`, M1), and a rollback naming the package, or bare,
answered `Reverted to version 1 (package=com.acme.crm)` and wrote the
platform's body into the package's row. It reproduced at all three
restore doors: the metadata service's `rollback`, and the protocol's
`rollbackMetaItem` and restore limb of `revertCommit` (the last for a
commit that names its package, as `recordPackageCommit` always writes
it; that limb passes no `versionOf`, so it reaches this whenever the
commit's version is one the platform registered).

Route taken: **the loud refusal**, `409 RESOURCE_CONFLICT`, the envelope
of `refusePlatformRecordRestore`, nothing written; `revertCommit` lands
the item in `failed[]` and still reverts the commit's other items.
Judged on the four axes:
- real business need: the scenario is the one the platform's withdrawal
produces for a name a package also ships (the objectstack-ai#37013 slot model),
measured at three doors, not a speculative surface;
- long-term soundness: one rule in the producer
(`@objectstack/metadata`) that all three doors ask, rather than a
per-door filter of which versions a package "wrote";
- keeping AI from writing wrong metadata: a refusal that names the fix
("save it again naming the package") beats a silently narrower version
list — an author or agent sees why, and nothing is written behind its
back;
- no scope growth: no new code, reason value, key or route; `restore
only the package's own versions` would have meant re-defining the M1
attribution rule that history reads share, a larger change for the same
outcome.

The refusal lives in `refusePlatformRecordRestore` as an optional fourth
argument (the version's history row, its number, and the package whose
row is written). The version is judged by its history row with the one
reader below: attributed to no package or to the environment, and its
body carries the platform's mark and names no package. A version
restored into the package-less row (the environment's own item) is left
as before.

**Item 2 — adopt-orphans leaves the platform's own record.** Reproduced
on main: `reassignOrphanedMetadata` rebound the platform's package-less
row to the target package. It now skips a row `isPlatformRecordRow`
reads as the platform's record, as it skips an artifact-backed overlay;
every other orphan is adopted as before.

**N5 — one platform-row reader.** `isPlatformRecordRow(row)` is now
exported from `@objectstack/metadata` (`database-loader.ts`): the
package column names no package (empty, or the environment's history
mark) and the body carries the platform's mark and names no package.
`refusePlatformRecordRestore`, the protocol's overlay census
(`protocol-diff-delete-load.ts`, whose private copy is deleted — the
only edit in that file) and the adoption ask it. Consequence: a
package-bound row whose body keeps the mark is no longer refused by the
row rule (it was refused, prescribing to name the package already
named).

**N1** — the refusal's prescription now says re-saving a version's body
as the environment's own item "holds until the platform's next
registration at boot writes its record back".

**N2** — new pins ride `rollbackMetaItem` (named and bare) and
`revertCommit` with a commit that names its package.

**objectstack-ai#37187 N3** — `listPackageBindings` skips, in its row walk, a loader
the list walk already lost: named once in `errors`, reported once, its
rows not read a second time.

**objectstack-ai#37187 N6** — one doc-comment sentence in
`packages/spec/src/contracts/metadata-service.ts`: a primed copy answers
its row's column as the registry last knew it (the column the boot
priming pass wrote when it bound the row, else the column it was read
with).

**N3 (objectstack-ai#37423 review) — dropped.**
`.changeset/37013-platform-skill-own-slot.md` is no longer pending: the
prerelease `chore: version packages (next)` (`33a31dc7`) compiled it
into `packages/metadata/CHANGELOG.md` and
`packages/metadata-protocol/CHANGELOG.md` and moved it to
`.changeset/pre/`. The same holds for the 37130 note that N1 mentions,
so N1 changes the runtime message only. A factual fix to a compiled
entry belongs in a docs-only PR, not here. N4 needed nothing.

Serial constraints: `protocol-save.ts` is untouched;
`protocol-diff-delete-load.ts` carries only the shared reader (an import
swap and the deleted private copy); `sys-metadata-repository.ts` carries
one call-site change.

Public surface: `isPlatformRecordRow` (new export) and the optional
fourth argument of `refusePlatformRecordRestore`. With the two refusals,
that is why this declares `Clause-②: yes (narrowing)`, not the claim's
`no`. `Metadata-protocol: none`: no key, accepted value, code or route
changes; level `patch`, BREAKING banner and ADR-0087 marker in
`.changeset/37604-platform-record-followups.md`.

## Tests

-
`packages/metadata-protocol/src/protocol.platform-mark-rollback.test.ts`:
`rollbackMetaItem` naming the package and bare, and `revertCommit` of a
commit naming the package, each asserting `code: RESOURCE_CONFLICT`,
`status: 409`, the message's "the platform registered", and the rows
byte-identical; plus a control that the package's own version still
restores.
-
`packages/metadata-protocol/src/protocol.adopt-orphans-platform-record.test.ts`:
the platform's row stays unbound while the environment orphan beside it
is adopted; a control that a package-less row whose body names a package
is adopted.
- `packages/metadata/src/loaders/database-loader.test.ts`: the service
door's `rollback` named and bare after a real `register(..., { origin:
'platform' })` + `unregister(..., { origin: 'platform' })`; N5 reader
and refusal envelope pins; the objectstack-ai#37187 N3 pin.

<details><summary>Red on base (main 4e10d4b)</summary>

- protocol door: 2 failed, `expected { success: true, … } to match
object { code: 'RESOURCE_CONFLICT', … }`; received message `Reverted to
version 1 (package=com.acme.crm) — type=skill, name=helper [seq=3]`.
- adopt-orphans: 1 failed, `expected 'app.base' to be null`.
- service door: 2 failed, `expected { name: 'data_explorer', … } to
match object { code: 'RESOURCE_CONFLICT', … }`.
</details>

<details><summary>Ablations (fix committed first; each mutation landed
via scripts/ablation-replace.mjs, rebuilt, dist preflight checked,
restored to HEAD and rebuilt)</summary>

- version refusal disabled: `database-loader.test.ts` 2 failed / 498
passed; protocol files 3 failed / 9 passed (the two `rollbackMetaItem`
pins and the `revertCommit` pin).
- lost-loader skip disabled: the objectstack-ai#37187 N3 pin failed (1 / 500).
- reader's column check removed: the two N5 pins failed (2 / 500).
- adopt-orphans filter disabled: the adopt pin failed (1 / 2).
</details>

<details><summary>Suites after the merge of main (33a31dc)</summary>

- `@objectstack/metadata` and `@objectstack/metadata-protocol`
typecheck: exit 0 (tree of 478efd8).
- `@objectstack/metadata` vitest: Test Files 83 passed, Tests 2814
passed (tree of 478efd8).
- `@objectstack/metadata-protocol` vitest: Test Files 371 passed / 9
skipped, Tests 23446 passed / 45 skipped (478efd8). The head d96a1a9
adds one module-top import to the new adopt pin (check:test-source-alias
asked for it).
- `@objectstack/spec` build + `check:generated`: all 14 generated
artifacts up to date.
- Local gates (exit 0): check-adr-0087-registration,
check-changeset-no-major, check-empty-changeset,
check-closing-keyword-parity, check-issue-citations,
check:durability-log-level, check:startup-registry-verdict,
check:doc-authoring, check:nul-bytes, check:undeclared-dep-imports,
check:facade-delegation-only, check:engine-double-contract,
check:test-source-alias, check:adr-anchors. NOT MEASURED:
check:published-readme-exports (exit 3, workspace not built),
check:dev-prereqs (workspace not built). The other derived families run
in CI.
- Full dogfood battery on the final head: running at PR open; its
reading goes to the dispatch report.
</details>

## Acceptance notes

- The two `.changeset/pre/` notes (37013, 37130) still carry "of a
failed batch row write" and the unqualified re-save prescription in the
compiled changelogs; not edited here (see N3 above).
- Other readers of the same fact remain in `database-loader.ts` (the
write path's `platformRow` and the platform withdrawal's `taken`); they
read `isPlatformOrigin` off the body alone. They were not N5's pair and
are left as they are; whether they should ask the shared reader is not
measured here.
- `restore only versions the package itself wrote` was the alternative
route; not taken, for the reasons above.

## Verification

Read first: `packages/metadata/src/loaders/database-loader.ts`
(`isPlatformRecordRow`, `refusePlatformRecordRestore`, the
`registerRollback` call),
`packages/metadata-protocol/src/sys-metadata-repository.ts`
(`restoreVersion`'s call),
`packages/metadata-protocol/src/protocol-package-commits.ts` (the orphan
filter).

Two minutes: `pnpm --filter @objectstack/metadata-protocol exec vitest
run --maxWorkers=2 src/protocol.platform-mark-rollback.test.ts
src/protocol.adopt-orphans-platform-record.test.ts` (after building
`@objectstack/metadata`) — expect 12 passed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01Q4EjjQkY5yXZrN9BEA3rEK
<!-- signed: repo:objectstack#6 · hotlong ·
session_01Q4EjjQkY5yXZrN9BEA3rEK -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…ut of step with main (week of 2026-11-25) (objectstack-ai#38289)

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

Fixes objectstack-ai#37245

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 用户能看到什么变化:用户无感;只在十份设计记录里补了带日期的说明,写明主线现在实际怎么做,原有的决定文字一个字没动。
- 为什么做:属于「每周设计记录修订」滚动清单(11 月 25
日这一周);清单每一行指出一处「记录写的和主线不一致」,这次一并补齐,免得照着记录干活的人被过时说法带偏。
- 出错会怎样:最坏是某条补充说明写得不准,读这些设计记录的人会碰到;纯文档、只增不删,可以直接撤回,不影响任何功能。
- 要你做什么:请审这些补充说明并亲手合并(设计记录须由你本人合)。

## What changes

Ten ADR files gain notes dated 2026-11-28. Every diff line is an
addition: 239 lines added, 0 removed. No original decision text is
rewritten, and no decision changes. Each note follows the note
convention its own record already uses.

Each row's "what is true now" was read against the code on `main` before
it was written. Where a row was wrong or had gone stale, the note says
what `main` does, and the table and the list under it say so.

| Row (comment id on the card) | ADR and section | Result |
|:---|:---|:---|
| Card body row (from objectstack-ai#37238) | ADR-0146, the 2026-11-24 amendment, "32
registered types" | **Landed. Row stale.** The row asks for 33; the
registry holds 35 entries on `main`. The note states no count and points
at the registry and at ADR-0084's table. |
| 7155511307, nit 1 | ADR-0160 D1, the door's page cap sentence |
**Landed. Row stale.** The row says the door has no page cap. PR objectstack-ai#37354
added one. The note says what `main` does: the list is cut one row under
the door's cap, not at it. |
| 7155511307, nit 2 | ADR-0160 D1, "only contains braces" | **Landed**
as the row asks. |
| 7155511307, nit 3 | ADR-0160 D3, the link-field sentence | **Landed as
a note that the sentence stands.** |
| 7161785832 | ADR-0158, Open items 9 and 12 | **Landed.** |
| 7178404228, anchor half | ADR-0066, line 146 | **No edit.** PR objectstack-ai#37621
already landed it (record 7198334624). |
| 7178404228, end-state half, with 7201928772 | ADR-0066 D2 ⑧ |
**Landed.** Its prerequisite, PR objectstack-ai#37371, is merged. The proposed text is
tightened in two places, listed below. |
| 7179515770 | ADR-0158 U3, U6, L4, Open item 10 | **Landed.** |
| 7184833647 | ADR-0159, Context, "One name already taken" (line 109) |
**Landed as a note. The anchor line is untouched.** This is not a
no-edit row: the anchor resolves, onto the opposite meaning. See below.
|
| 7187445064 | ADR-0158 L1, L2, Open items 6, 8, 10 and 11, and a new
Open item 13 | **Landed.** |
| 7195437501 | ADR-0010, the amendment note of 2026-11-24 | **Landed**,
with one arm `main` has gained since the row was written. See below. |
| 7212321297, first row | ADR-0067 D3 | **Landed. Row wording wrong.**
The note carries the revert rule that the `form` type brought. See
below. |
| 7212321297, second row | ADR-0160, implementation split, row 7's
bullet | **Landed.** The row places the stale path near line 425; it is
near line 491. |
| 7213085888 | ADR-0048 §3.5 | **Landed.** The row's ready text, dated
2026-11-28, with symbol anchors where it had line numbers. |
| 7215202653, corrected by 7215223685, with 7224476684 | ADR-0150 D3,
the note of 2026-11-26 | **Landed.** Item 2 of the first row said the
two doors were still open. The later row supersedes it: PR objectstack-ai#37948
merged, and both doors now refuse. |
| 7217585102 | ui ADR-0057, A2 and A3 | **Landed. Row stale on one
line.** The plan-marker line is written as `main` is today, after PR
objectstack-ai#37970, and not only as it was after PR objectstack-ai#37720. |

Comments that are not rows: 7186949648 (triage note), 7196224618 (a
one-row claim), 7196910014 (its report), 7198334624 (its landing record)
and 7237786310 (this claim).

**No row is held.** Every prerequisite is merged on `main`: PRs objectstack-ai#37219,
objectstack-ai#37240, objectstack-ai#37268, objectstack-ai#37354, objectstack-ai#37366 (which carried objectstack-ai#37422), objectstack-ai#37371, objectstack-ai#37389,
objectstack-ai#37423, objectstack-ai#37449, objectstack-ai#37640, objectstack-ai#37720, objectstack-ai#37818, objectstack-ai#37931, objectstack-ai#37948, objectstack-ai#37970, objectstack-ai#37065,
objectstack-ai#36138 and objectstack-ai#37021. The card has 19 comments as of this pull request; a
row added after comment 7237786310 is not in it.

### Where a note differs from its row

- **ADR-0146.** The row offers two forms, "give the count" or "point to
ADR-0084's table". The note takes the second. A count written today
would already be the third reading (32, then 33, now 35).
- **ADR-0160 D1, the page cap.** The row's premise was true when it was
written and is not now. `RecordContextDoor.pageCap` exists, and both
doors answer it. The note records the one-row difference between the
amendment's words and the code: a list whose cut plus its probe row
would pass the cap is cut one row under the cap.
- **ADR-0160 D3, the link field.** The note leaves the wording alone.
- **ADR-0066 D2 ⑧.** Two changes to the proposed text. The note says in
words that `viewAllFieldsReadVote` replaced `superuserFieldVote`, and
anchors only the function that exists. And it does not say that nothing
re-opens a lock across sets: another set's `viewAllFields` still makes a
hidden field readable, and another set's field row with `editable: true`
still grants the edit, because field grants union without deny.
- **ADR-0159, line 109.** PR objectstack-ai#37422 was merged into PR objectstack-ai#37366's branch,
so the anchor `view.zod.ts#defineForm` resolves and the gate is green on
it. It now resolves onto the `form` type's factory, while the paragraph
describes the Studio helper, which is `defineMetadataForm` today. The
paragraph is Context and describes the tree before the ruling was
carried out, so the note leaves it as written and states both names.
- **ADR-0010.** The row covers the three restore doors of PR objectstack-ai#37423. The
same rule has since gained a second refusal, from PR objectstack-ai#37640: a restore
that would write a version the platform registered into a package's row.
The note has one sentence on it. That sentence goes beyond the row; cut
it if the note should carry the row alone.
- **ADR-0067 D3.** The row asks for a note "naming `form` as a
translated metadata type". D3 is about undo granularity and has no such
notion. The contract reviews of PR objectstack-ai#37422 sent one fact to this record:
a `form` item is reverted only after every `view` row its commit edited
is put back, and it joins `failed[]` otherwise. The note records that.
- **ADR-0048.** The row's text was dated 2026-11-24. The note is dated
2026-11-28, the day it was written into the record.
- **ADR-0150.** Besides answering "Not judged yet", the note qualifies
one sentence of the 2026-11-26 note that said too much: the draft
discard is newly refused only over a stored package-less draft. Where it
was already refused, only its sentence moved.
- **ADR-0158.** Row 7179515770 points at a draft held by its seat, which
this session could not read. The notes are written from the two rows and
the code. Open item 13 is a new numbered item at the end of the list,
carried from the display card; it is marked not built and not settled.
- **ui ADR-0057.** The row asks for "what main does after objectstack-ai#37720".
`main` has moved once more: since PR objectstack-ai#37970 the entry's marker stands
for a write that waits for approval. The note says that, and that A5's
"Not recorded yet" bullet held until that pull request merged.

## Tests

Docs only. No package is touched, so no build closure and no package
test is owed for the change. No tested behaviour changed, so there is no
ablation.

What was checked by hand, on the committed text:

- Each phrase a note quotes from its ADR was compared with the base
file.
- Each verbatim maintainer quotation was compared, byte for byte, with
its record on GitHub.
- Each cited path and symbol exists on `main`. The one exception is
deliberate: the ADR-0160 note names `packages/spec/src/ai/skill.form.ts`
to say that no such file exists.
- Upstream moved ten commits while this was written (`e42520c67b` to
`e2a0e90025`). None touches an ADR file or a file a note cites.
`overlap-check` answers `VERDICT clean exit 0` against `origin/main` at
`e2a0e90025`, and no open pull request shares a file with this branch.

The local gate set is the `dispatch-gates --commands` derivation for
this change set, 27 commands, run on the final commit `c2c3345747`. Each
exit code was captured before any pipe. Reconciliation: `Run
reconciliation — 27 derived, 27 run, 0 NOT-MEASURED, 0 UNRUN`, all 27
with a recorded exit code.

<details><summary>ADR gates on c2c3345 (all exit 0)</summary>

| Command | Exit | Verdict line |
|:---|:---|:---|
| `pnpm check:adr-symbol-anchors` | 0 | `check-adr-symbol-anchors: 4525
anchors across 164 records resolve`, 0 line anchors survive. On the base
commit the same gate reads 4478. |
| `node scripts/check-adr-links.mjs` | 0 | `check-adr-links: 1268
relative link destination(s) under docs/adr/ resolve` |
| `node scripts/check-adr-links.mjs --self-test` | 0 | |
| `pnpm check:adr-anchors` | 0 | |
| `pnpm check:adr-index` | 0 | `adr-index --report: OK —
docs/adr/README.md is current, every record parsed` |
| `pnpm check:doc-authoring` | 0 | |
| `pnpm check:nul-bytes` | 0 | `check-nul-bytes: OK (scanned 28605 text
file(s)`, no raw control bytes |
| `pnpm check:closed-ceremony-text` | 0 | |
| `pnpm --filter @objectstack/lint run check:doc-formula-expressions` |
0 | run after building `@objectstack/formula` and `@objectstack/lint`
under the verify lock |
| `pnpm --dir ui run check:new-line-citations` | 0 | `VERDICT
new-cross-file-line-citations: 0 new citation(s)`. Not in the derived
list; run because a ui ADR changed. |

</details>

<details><summary>The other derived families on c2c3345 (all exit
0)</summary>

`node scripts/check-closing-keyword-parity.mjs` and its `--self-test`,
`node scripts/check-comment-mask-corpus.mjs`, `node
scripts/ci/plan-test-core-shards.mjs --self-test`, `pnpm
check:ci-filter-parity`, `pnpm check:cross-package-test-inputs`, `pnpm
check:driver-memory-census`, `pnpm check:gitlink-declared`, `pnpm
check:pm-governed-merges`, `pnpm check:pm-prior-rulings`, `pnpm
check:published-files`, `pnpm check:refd-timer-probe`, `pnpm
check:registry-log-declared`, `pnpm check:rest-log-spy-declared`, `pnpm
check:tier-file-adoption`, `pnpm check:undeclared-dep-imports`, `pnpm
check:watch-hint-literal`.

Before the push: `node scripts/check-commit-card-trailers.mjs --range
origin/main..HEAD` exit 0, one commit message, no card relation and no
model identifier in the trailer pair.

</details>

<details><summary>The ui scripts test family: one prerequisite failure,
then green</summary>

Derived command: `pnpm --dir ui exec vitest run scripts/`, run under the
verify lock with `--maxWorkers=2`.

- First run: `VERDICT command-exit 1`. `Test Files 1 failed | 171 passed
| 2 skipped (174)`, `Tests 1 failed | 5144 passed | 2 skipped (5147)`.
The one failure was
`scripts/__tests__/unit-registry-absence-collision.test.ts`, with
`Failed to resolve entry for package "@objectstack/client"`. The package
had no build output in the fresh worktree. That is a missing
prerequisite, not a verdict on this change.
- After building the `@objectstack/client` closure under the lock, the
same command on the same commit: `VERDICT command-exit 0`. `Test Files
172 passed | 2 skipped (174)`, `Tests 5145 passed | 2 skipped (5147)`.

</details>

Not run locally: the repository test project behind `test:repo`, which
CI runs on the pull request and on the merge group. Every other family
CI runs is read from this pull request's check runs, not re-run here.

## Acceptance notes

- **Changeset.** None, and the pull request carries `skip-changeset`.
`docs/adr/**` and `ui/docs/adr/**` ship in no package: the ui tree's
root is a private workspace root and `ui/docs` is under no package
directory.
- **Governed surface.** `docs/adr/**` lands by the maintainer's hand.
This pull request stays a draft; the seat hands it over.
- **The registry count.** The card row and the amendment both carry a
number. The repository rule for a volatile count is to remove it and not
to sync it, so the note adds none.
- **Seen and left alone.** These are outside the card and are not
changed here.
- ADR-0084, near line 226, says `form` is not a registered type. It is
about the working names of the 2026-07-01 table, and `form` is
registered now. It is a candidate row for next week's card of this name.
- One internal skill playbook and ui ADR-0056 still use the Studio form
helper's old name. The review of PR objectstack-ai#37366 already recorded both.
- Comments in the console's chat scope helper still describe the
`app:PKG:build` dock key and the Studio copilot.

## Verification

### Read first

1. `docs/adr/0066-unified-authorization-model.md`, the note of
2026-11-28 under D2 ⑧. It is the highest-risk hunk: one long paragraph
on authorization, and it supersedes parts of three earlier notes. Check
the sentences on what another set can still re-open, and the sentence
that stored sets are read with the new meaning and never rewritten.
2.
`docs/adr/0150-behavioural-metadata-addressed-by-package-objects-keep-the-literal-prefix.md`,
the amendment note of 2026-11-28. Check the four cells and their
remedies (enable, enable, name the package, name the package) against
the ruling it quotes.
3.
`docs/adr/0158-units-of-measure-standard-unit-table-org-units-quantity-unit-declaration-base-quantity.md`,
the notes under Open items 6 and 10 and the new Open item 13. Both notes
quote the maintainer, and item 10's records the shape of a new system
object.

### Two-minute check

Run `git diff --numstat origin/main...HEAD` on this branch. Expect ten
rows, nine under `docs/adr/` and one under `ui/docs/adr/`, each with `0`
in the removed column, and 239 added lines in total. Then run `pnpm
check:adr-symbol-anchors` and expect exit 0 with a line that contains
`check-adr-symbol-anchors: 4525 anchors across 164 records resolve`.

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

<!-- signed: repo:objectstack#1 · os-elon-musk ·
session_016WV4cxRDKprCtjpEdtiPFW -->

---------

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

Development

Successfully merging this pull request may close these issues.

元数据平台标记收尾:已发布读取只按顶层标记、平台自己的记录回滚保留标记

3 participants