Skip to content

fix(metadata-protocol): revertCommit answers only what it achieved, and a revert is revertible - #33805

Merged
objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/project-thread-gv2u7w
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/project-thread-gv2u7w

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Fixes #33563
Fixes #33564
Fixes #33486

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:撤销一次 AI 提交(revertCommit)时,行已写回但注册表/存储/投影没跟上的条目改报失败并写明行的状态;撤销提交记下它覆盖掉的版本,所以「撤销这次撤销」能真的恢复;整包回滚的注释改成如实说明撤销记录是尽力而为。
  • 为什么改:原来这些情况一律报 success:true,和方法自己的契约「success 即运行中的进程已生效」以及 ADR-0067 D3「撤销本身可撤销」相反,操作员以为撤销成功了,实际进程没生效、或再撤销什么都没恢复。
  • 风险与回滚:原来报 success 的少数撤销现在报 success:false 并列出失败条目(行已写回,只是如实上报);旧版本写下的撤销提交再被撤销时会点名失败、什么都不写。回滚即 revert 本 PR 六个提交。
  • 先看:packages/metadata-protocol/src/protocol-package-commits.ts 的 revertCommit(settle、replacedVersion、无版本条目分支),再看 protocol.revert-commit-honest-outcome.test.ts,最后 protocol.ts 两段注释。
  • 两分钟验证:pnpm --filter @objectstack/metadata-protocol exec vitest run src/protocol.revert-commit-honest-outcome.test.ts,预期 10 个用例全绿(含撤销再撤销把 'Renamed' 恢复回来)。
  • 需要你做的:无,席位落地。

What changes

One commit per card, then three test and ledger follow-ups.

  1. metadata-protocol: revertCommit discards its registry write-through and projector results, so a revert answers success for an item the process never applied #33563 (f1bf9b77). In revertCommit, every item now records rowWritten once its row write lands. A step after that write which does not land is collected per item: the runtime registry refusing the restored object (the write-through's returned refusal, with its client-facing text and code), the storage sync refused (the object-storage-sync-refused advisory stays on advisories), or the mutation projector answering { success: false } (its driver text is not quoted). Such an item goes into failed[], not reverted[], naming the row state ("its row was restored to the body of version N" or "its row was removed from sys_metadata"). A throw after the row write gets the same prefix in the catch. The revert's own commit is now built from the rows the walk changed (revertPlan), not from reverted[], so a row that changed under a failed item is still recorded. rollbackToPackageCommit carries each such item through its existing per-item channel and answers success: false.
  2. metadata-protocol: reverting a revert commit restores nothing (its items carry prevVersion null), against ADR-0067 D3 #33564 (7dccd175). Before each row write, the revert reads the committing package's active row version (the same address publishPackageDrafts reads for its own plan) and records it as the item's prevVersion, with existedBefore true exactly when the row was there. Reverting a revert therefore restores the body the revert replaced, and an item the revert removed is written again. An item recorded with existedBefore: true and no prevVersion (the shape every revert commit an earlier release recorded) is named in failed[] with nothing written, and points at the item's own version history. It is no longer skipped.
  3. docs(metadata-protocol): rollbackToPackageCommit docblock says each step records its revert commit; the record is best effort #33486 (bfb561ff). The rollbackToPackageCommit docblock says each step attempts its revert commit, best effort, and that revertCommitId is then omitted. It also names the post-row-write faults a step's failed[] now carries.
  4. 1c566dfb: protocol.revert-stored-type-canonical.test.ts pinned the revert plan's prevVersion: null, the value metadata-protocol: reverting a revert commit restores nothing (its items carry prevVersion null), against ADR-0067 D3 #33564 fixes. It now pins 2. It is a separate commit because this branch is not force-pushable.
  5. 863bd4b8: the engine double in packages/objectql/src/protocol-commit-history.test.ts gains syncObjectSchema. Without that door, the double read as a refused storage sync, which now fails the item. This is a test-double gap, not a behaviour pin, and the edit was approved by the seat.
  6. e546a942: scripts/engine-double-contract.pinned.json gains three additive rows for the new test file's findOne, update and delete doubles. This is the ledger check:engine-double-contract --write generates, committed with the seat's approval.

No spec schema moves: failed[].code is already optional and free-form, no new error code is coined, and the response keeps its declared keys. The two protocol.ts docblock paragraphs ship in the .d.ts, so the changeset is a patch.

Pins this PR flips on purpose.

  • packages/objectql/src/stored-expression-backfill.test.ts ("a revert whose storage sync is refused writes no row, and says so per field"): the item is now in failed[] with its row named, and the advisory assertions are unchanged. The reason is the revertCommit docblock: "a revert that answers success: true is one the running process has already acted on". Edited with the seat's approval.
  • packages/metadata-protocol/src/protocol.revert-stored-type-canonical.test.ts: prevVersion null to 2, as above.

Tests

packages/metadata-protocol/src/protocol.revert-commit-honest-outcome.test.ts (new, 10 cases) runs on a stub engine under the real SysMetadataRepository, with a commit store that keeps every commit the protocol records.

Ablations (scripts/ablation-replace.mjs, each landed and then restored to blob == HEAD; vitest compiles src, so no rebuild is involved). A6 is run at the #33564 commit, the others where listed.

Ablation Red Green
A1: settle always pushes reverted[] 5 (registry, storage, projector restore, projector remove, rollback) 2 (control, throw-after-write)
A2: catch prefix off 1 (throw-after-write) 6
A3: registry refusal not read 2 (registry, rollback) 5
A4: restore-limb prevVersion back to null 1 (restore revert-of-revert) 9
A5: soft-remove plan back to existedBefore: false, prevVersion: null 1 (soft-remove revert-of-revert) 9
A6: no-version guard off 1 (legacy item) 9

A1 was predicted at 6 red and came out at 5: the throw case is carried by the catch prefix, which A2 covers alone.

Acceptance notes

  • Not seen by the revert, and not changed here (seat ruling: a loose end, not this PR): applyRegistryWriteThrough's non-object branches and restoreArtifactRegistryView's heal catch their own faults and only log them, inside protocol-registry-hydration.ts. That helper is shared with the save and publish doors. So a view or permission write-through fault is still invisible to revertCommit.
  • The 2026-11-14 ADR-0067 amendment ("What the doors do") describes the code before this PR (revert plans carry prevVersion: null, and post-row faults stay out of failed[]). docs/adr/** is out of bounds for this PR, so a status-line amendment is owed after merge.

Verification

Readings, local, on this box:

  • Package suites at d1480af6/1c566dfb: @objectstack/metadata-protocol (350 files, 22892 passed); @objectstack/objectql (597 files, 13114 of 13115 passed; the one red was the double fixed in 863bd4b8, which is green alone, 32/32); @objectstack/rest (417 files, 8742 passed); @objectstack/runtime (607 files, 12229 passed).
  • After the last merge of main (340d02d8), with the closure rebuilt: every metadata-protocol revert test (24 files, 432 tests) and the four objectql revert/commit files (113 tests) are green.
  • pnpm lint exits 0. typecheck for objectql and metadata-protocol exits 0.
  • dispatch-gates --ran: all 81 derived families are accounted for. 80 exit 0. 1 is NOT MEASURED: check:dual-build-cjs-loads exits 3 because it needs the whole workspace built, so it is left to CI.
  • Dogfood: not run. The title has no ! and Clause-② has no (narrowing) arm.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (spec untouched)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One branch off an up-to-date main, one pull request. Three cards are folded by the seat's order, one commit each.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: not applicable.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English (the 维护者速读 block is Chinese by the repository's convention).

Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01QsR2jSn6n7eb34wbyxhZja

…row write in failed[]

An item whose row the revert wrote, but whose registry write-through,
storage sync or mutation projector then failed (or threw), was reported
in reverted[] and the revert answered success: true. It now lands in
failed[] with the row state named, the revert's own commit still records
the row change, and rollbackToPackageCommit carries it.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jSn6n7eb34wbyxhZja
…ced, so a revert is revertible

Every revert commit recorded its items with prevVersion null, so reverting
a revert restored nothing, and an item recorded as existing with no
version took neither limb and was reported nowhere. The revert now reads
each row's version before it writes and records it, and an item with no
version to restore is named in failed[] with nothing written.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jSn6n7eb34wbyxhZja
…ert commit is best effort

The docblock said each step records its revert commit. recordPackageCommit
catches every error and returns no record, so a step that returns may
have recorded nothing; the docblock now says so, and names the
post-row-write faults a step's failed[] now carries.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jSn6n7eb34wbyxhZja
… the revert replaced

The revert's own plan now records each restored row's replaced version,
so the neighbour-revert pin expects prevVersion 2 where it pinned null.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jSn6n7eb34wbyxhZja
…sync

The revert's restore limb syncs a restored object's storage. The double
had no syncObjectSchema, which reads as a refused sync and now fails the
item, so it answers the door the real engine has.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jSn6n7eb34wbyxhZja
The new revertCommit test file pins its findOne, update and delete
doubles; the pinned ledger learns the three rows so the gate protects it.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jSn6n7eb34wbyxhZja
…lection

Both files reach the source's dynamic @objectstack/lint import; a
module-top import pays that load before any clocked case runs.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jSn6n7eb34wbyxhZja
@github-actions github-actions Bot added size/l 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 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

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

21 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 1e65a389e12e7c07e2121378d1d0755226c2ad60.

⛔ 10 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: /api/v1/meta (route, 51 pages)
  • 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 — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 1e65a389e12e7c07e2121378d1d0755226c2ad60 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 1e65a389e12e7c07e2121378d1d0755226c2ad60

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTkZnXtRhuEiiyidvJ

Request: review · PR #33805 · area S4 (E1) · Fixes #33563 #33564 #33486 · head 340d02d

Clause-② no · Metadata-protocol none · patch changeset. Reviewer: review-b. Report on #33563.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6

Review claim · head 340d02d · 2026-11-15T11:16Z

review (review-b, areas S2+S4). Verdict follows on this PR.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6

Review — PASS

Head-sha: 340d02d8c0252a63a2778715bd240b5cec8df6a6

review (review-b, areas S2+S4) · 2026-11-15T11:18Z

I read the full diff at this head against GitHub: 8 files, +672/−30. I also read the three cards, the claims (6892161268 and its siblings), ensureObjectStorage on this tree, and check-governed-merges --pr 33805, which reports NOT governed at 702 lines.

Correctness

  1. metadata-protocol: revertCommit discards its registry write-through and projector results, so a revert answers success for an item the process never applied #33563, honest outcome: holds.
    • rowWritten is set only after a row write lands. The removal limb sets it inside if (current), and its projector call is gated on the same current, so a failed[] entry never reads "undefined".
    • settle routes any notApplied step to failed[]. The steps are:
      • the registry write-through's returned refusal, now read instead of discarded;
      • ensureObjectStorage's advisory;
      • a projector answering success: false.
    • The catch prefixes the row state only when a row was written.
    • The revert commit is built from revertPlan, the rows the walk changed, so a row restored under a failed item is still on the append-only history.
    • The success rule ("true exactly when nothing failed") already follows failed[].
    • Choosing "report in failed[]" over "weaken the docblock and ADR" keeps ADR-0067's promise and the method's own docblock. Neither is reinterpreted.
  2. metadata-protocol: reverting a revert commit restores nothing (its items carry prevVersion null), against ADR-0067 D3 #33564, revert of a revert: holds.
    • replacedVersion() reads the committing package's active row, the same address and the same typeof version === 'number' reading as publishPackageDrafts (protocol-history-and-publish.ts:1973). It reads before each write on both limbs, inside the try, so a read fault fails the item with nothing written.
    • existedBefore is current !== null on both limbs:
      • a removed row's revert-of-revert restores it;
      • a row the restore wrote again is removed by the revert-of-revert.
    • A legacy item (existedBefore with no version) is named in failed[] with nothing written, with the history/rollback route as its remedy, instead of being skipped silently.
  3. docs(metadata-protocol): rollbackToPackageCommit docblock says each step records its revert commit; the record is best effort #33486, docblock: holds. The prose matches recordPackageCommit: best effort, and revertCommitId is omitted on failure. Blocker docs(adr-0067): stale rollback claims follow the code: the in-memory driver rolls back, and revert runs per item #33465 has merged.
  4. Pins and ablations.
    • The new file's 10 cases assert the item's placement, the row state, code (NAMESPACE_CONFLICT) and the revert commit's items, not just success.
    • A1–A6 each map to a limb; A1's predicted 6 came out as 5, which is explained.
    • The two flipped pins (prevVersion null → 2, and the stored-expression revert now in failed[]) are the behaviour these cards correct, and both are named in the body.

Scope and declarations

  • Clause-②: no and Metadata-protocol: none are correct.
    • There are no new exports, and no type or key moves. failed[].code was already optional and free-form, and no error code is coined.
    • A revert that used to answer success: true while the process had not acted on it now answers false. That brings the answer back to its declared contract; it neither widens nor narrows a published accept set.
  • Changeset. patch on @objectstack/metadata-protocol. I checked each sentence against the diff, including the legacy-revert remedy route and the best-effort record.
  • File surface. The claim names protocol-package-commits.ts and the protocol.ts docblocks. The objectql test double (syncObjectSchema), the flipped objectql pin and the three additive engine-double-contract.pinned.json rows are outside it; they are named in the body as seat-approved and are test or ledger only. protocol.ts changes docblock prose only. Not governed.
  • Card relation. Fixes #33563, Fixes #33564 and Fixes #33486 are each correct; nothing remains on any of them.

Nits (no change required)

  1. The storage step fails on more than a refused sync. ensureObjectStorage also returns the column-changes-not-applied warning, and that fails the item too. The entry names the advisory's rule, so it is accurate. The body's "storage sync refused" undersells this; the changeset's "its storage not following the restored body" is correct.
  2. One extra read per item. replacedVersion() reads the row repo.get just read as current.
  3. A no-op removal is still in the plan. On the removal limb with no current row, revertPlan still records an item that changed no row (existedBefore: false). The earlier code did the same through reverted[], so this is not a regression.

Follow-ups, not part of this PR (for the seat)

  • The ADR-0067 amendment's "What the doors do" text (11-14) now describes the code before this PR. A status-line amendment is owed, and it is governed (Tier H).
  • applyRegistryWriteThrough (non-object types) and restoreArtifactRegistryView still only log their own faults. This is the body's loose end, shared with the save and publish doors.

Check-runs at this head (read at review time)

  • 16 success, including Lint · ESLint, Type Check · source gates, Check Changeset, PR-body guards and Governed Surface Queue Guard.
  • 16 skipped.
  • 16 still running: Build Core, Test Core 1–8/8, Type Check · workspace, consumer gates and debt ledger, three Lint jobs, and Live E2E UI. None had failed.
  • Landing waits for every check on this head to be green or an expected skip.

Author. objectstack-fleet[bot] (relay write).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTkZnXtRhuEiiyidvJ

席位核对

ACCEPT · area S4 (E1) · Head-sha: 340d02d8c0252a63a2778715bd240b5cec8df6a6

  • Review: review-b PASS on this head (comment 6893528798); three nits, none requiring change.
  • Governed: check-governed-merges --pr 33805 NOT governed, 0 of 8 paths on the register, 702 changed lines (≤ 3000).
  • Checks on this head: 51 check-runs, every one success or an expected skip (UI, docs, opt-in harness and queue-only jobs skipped by the selector); Lint & Repo Gates, TypeScript Type Check, Test Core 1–8 and aggregate, Build Core, Live E2E UI, Governed Surface Queue Guard, Check Changeset, PR-body guards all success.
  • Declarations: Clause-②: no, Metadata-protocol: none, patch changeset — confirmed by the review.
  • Card relation: Fixes #33563, Fixes #33564, Fixes #33486.
  • Follow-ups held by the seat (not this PR): the ADR-0067 status-line amendment (Tier H) and write-through faults on non-object types that are still only logged.

Landing under the area authorising line: ready + auto-merge.

scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…em whose registry write-through faults (objectstack-ai#33979)

<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbNTugWasvhTMrtCZiFGrZYK)_

Fixes objectstack-ai#33851

Clause-②: no
Metadata-protocol: none

## 维护者速读

-
改了什么:撤销提交(revertCommit)现在对所有类型如实上报两类故障。第一类是恢复视图、权限、对象扩展等条目时,写入运行时注册表出错;这时该条目列入
failed[],写明「行已恢复到版本 N」。第二类是撤销删除条目后注册表修复(heal)中途停止;这时写明「行已从 sys_metadata
移除,注册表可能仍在提供被删的行」。两类都带出错原因和 code,success 为 false,和对象条目的处理一致。
- 为什么改:以前这些故障只记日志,撤销照样报 success:true,但进程实际还在使用旧内容,违反 revertCommit
自己的契约「success 即进程已生效」(ADR-0067 D3)。
- 风险与回滚:只有 revertCommit
读这两个新返回值。保存、发布、删除等其他调用方都忽略它们,同样的故障下仍答成功,日志也不变(有对照测试,另有消融证明对照测试能变红)。回滚即
revert 本 PR。
- 先看:`protocol-registry-hydration.ts` 中 `applyRegistryWriteThrough` 的两个
catch 和 `restoreArtifactRegistryView` 的外层
catch、剩余行循环;`protocol-package-commits.ts` 的 revertCommit
两个分支;`protocol.ts` 中两个转发方法的类型。
- 两分钟验证:`pnpm --filter @objectstack/metadata-protocol exec vitest run
src/protocol.revert-commit-honest-outcome.test.ts`,预期 31 个用例全绿(§3 共 12
个,§4 共 9 个)。
- 需要你做的:无,席位落地。objectstack-ai#33563 那条变更说明里的一句旧话,在单独的纯文本 PR 中更正。

## What changes

`applyRegistryWriteThrough` has three branches. The `object` branch has
answered the registry's refusal since objectstack-ai#33805. The two non-object
branches caught their faults and logged them at `warn`. The first is the
overlay hydration, which every type except `object` and
`object_extension` takes. The second is the `object_extension`
registration. The registry heal that a removal runs
(`restoreArtifactRegistryView`) logged its stop at `error` and returned
nothing.

- `protocol-registry-hydration.ts`, write-through. The request has its
own exported type, `RegistryWriteThroughRequest`, with one new optional
field, `answerFaults`. When it is `true`, a non-object branch that
throws still logs the same `warn` line, and then returns the fault in
the `ObjectRegistryRefusal` shape (`{ error }`). When it is unset, the
answer is `undefined`, as before.
- `protocol-registry-hydration.ts`, heal. `restoreArtifactRegistryView`
now returns a `RegistryHealStop` (`{ error }`) in two cases. The first
is when its outer catch stopped the walk; the `error` line it logs is
unchanged. The second is when a row still stored under another package,
which the heal registers again (with `answerFaults: true`), is refused
or faults; every remaining row is still tried. Otherwise it returns
`undefined`, and that includes the designed outcomes: a refused baseline
read that retires the entry, and a degraded read that keeps it.
- `protocol-package-commits.ts`, `revertCommit`. The restore limb sets
`answerFaults: true`. The soft-remove limb reads the heal's stop, but
only where a row was actually removed; with no row removed, the heal is
a self-heal and stays logged. Both feed the existing `notApplied` /
`settle` path, so the item lands in `failed[]` with the row state, the
reason and its `code`. The revert's own commit still records the row
change. `rollbackToPackageCommit` carries the item through its existing
per-item channel.
- `protocol.ts`, two private forwarders. The
`restoreArtifactRegistryView` forwarder now returns `Promise` of
`RegistryHealStop | undefined` (`ProtocolHost` derives its type from
it). The `applyRegistryWriteThrough` forwarder's parameter is now
`RegistryWriteThroughRequest`, in place of its inline copy. The
`revertCommit` docblock sentence that said a non-object write-through
fault "is not seen here" now says that every type, and a stopped heal,
is reported. The `.d.ts` carries that docblock, so this change takes a
`patch` changeset.
- Every other caller ignores the new answers. Save and publish
(`protocol-save.ts`, `protocol-history-and-publish.ts`) do not set
`answerFaults`. They would report any returned refusal as an object's
(`object-registry-refused`), which ablation A4 shows. The delete door, a
publish's undo and a peer's convergence `await` the heal and discard its
answer.
- Changeset: `.changeset/33851-revert-non-object-write-through-fault.md`
(`patch`). It says that it supersedes the sentence of the objectstack-ai#33563 note
claiming such a fault "is still not seen by the revert". The objectstack-ai#33563 note
itself is unchanged here: its one sentence is corrected in a separate
text-only PR (DELIBERATE CORRECTION).

## Tests


`packages/metadata-protocol/src/protocol.revert-commit-honest-outcome.test.ts`,
the revert harness, gains two top-level describes. They go there as
AGENTS.md requires (ruling record 6583487846).

- §3 has 12 cases, 4 each for `view`, `permission` and
`object_extension`: a clean restore control, which reaches the registry
verb as a non-vacuity check; a write-through throw that goes to
`failed[]` with `code`, "its row was restored to the body of version 1",
the reason and `success: false`; a save control; and a publish control.
The two controls hold under the same fault: `success: true`, no
advisories, and the same `warn` line.
- §4 has 9 cases, 4 each for `view` and `permission`: a clean
soft-remove control; a heal stop that goes to `failed[]` with `code`,
"its row was removed from sys_metadata", "may still serve the removed
row", `success: false` and the heal's `error` line kept; a delete
control (`success: true`, `error` line kept); and a save-and-publish
control (both `success: true`, no advisories). The ninth case is an
`action` row still stored under another package that the registry
refuses: it goes to `failed[]`. As a non-vacuity check, the stop is the
remaining row's write-through `warn`, not the heal's outer-catch
`error`.

Premise, measured on the code before each half. On the write-through
half (source at `63e47feeca`), §3's 3 fault cases were red: each
answered `success: true`. On the heal half (source at `2d23b49dd1`),
§4's 3 fault cases were red, with 28 cases green.

<details><summary>Ablations (scripts/ablation-replace.mjs, each landed,
run, then restored to blob == HEAD with git diff HEAD empty)</summary>

| Ablation | Red | Green |
| --- | --- | --- |
| A1: the overlay branch does not answer | 2 (§3 view, permission fault)
| 20 of 22 |
| A2: the extension branch does not answer | 1 (§3 object_extension
fault) | 21 of 22 |
| A3: revertCommit does not set `answerFaults` | 3 (every §3 fault case)
| 19 of 22 |
| A4: the overlay branch answers every caller | 4 (view and permission
save and publish controls; the save answered an
`object-registry-refused` advisory, "object 'ticket.grid' was published,
but the runtime registry refused it") | 18 of 22 |
| A5: the extension branch answers every caller | 2 (object_extension
save and publish controls) | 20 of 22 |
| B1: the heal's outer catch does not return its stop | 2 (§4 view,
permission heal stop: "expected true to be false" on `success`) | 29 of
31 |
| B2: the remaining row's refusal is dropped | 1 (§4 remaining-row case)
| 30 of 31 |
| B3: revertCommit does not read the heal's stop | 3 (every §4 fault
case) | 28 of 31 |

My first A1 to A3 attempt was a no-op: the replacement was a substring
of the anchor, `ablation-replace` refused it, and no test ran. They were
re-run with distinct markers, and the table shows those runs. A1 to A5
were run before §4 existed (22 cases). B1 to B3 were run on all 31
cases.
</details>

## Acceptance notes

- Out of scope, left as it is: in the heal, the object owner branch's
`unregisterObject` refusal ("object 'x' was deleted from sys_metadata
but stays registered") is still a `warn` line that answers no stop. It
is an object-only path, and the card's ruling covered the outer catch
and the remaining rows.

## Verification

<details><summary>Readings, local, at head 999b09d</summary>

- One locked run, at `999b09d9c3` with `origin/main` `68e726d631` merged
in (lock VERDICT command-exit 0; queued 6m18s, after a first attempt's
queue-timeout exit 99). It ran: the metadata-protocol dependency closure
build; `typecheck` exit 0; `test` 342 files passed and 9 skipped, 22923
tests passed; the metadata-protocol build; and the objectql suite, 597
of 597 files and 13177 of 13177 tests.
- The other direct dependents (runtime, cli, service-automation,
cloud-connection) were not run locally. CI runs them (Test Core). The
only type that moved is on private forwarders; `RegistryHealStop` and
`RegistryWriteThroughRequest` are not exported from the package entry.
- `pnpm lint`: exit 0.
- `dispatch-gates --ran`: 73 derived families, each with its exit code
recorded. 70 exit 0. 3 are NOT MEASURED, because each needs the whole
workspace built: `check:dual-build-cjs-loads`,
`check:lean-entry-closure` and `check:type-check-debt`, all exit 3
(PREREQUISITE NOT MET). CI runs them. The body gates (closing-keyword
parity, Part-of, changeset no-major, ADR-0087 registration) exit 0.
- `git merge-tree --write-tree --name-only`: clean against `origin/main`
`68e726d631`, against objectstack-ai#33885's head `fa7fb66a7c`, and against S5's
`claude/area-E1b-33832` head `9c4f75f36e`. No open PR for objectstack-ai#33308 was
found. No other open PR touches `protocol.ts`,
`protocol-registry-hydration.ts`, `protocol-package-commits.ts` or the
harness file.
- Dogfood: not run, because the title has no `!` and Clause-② has no
(narrowing) arm.
</details>

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

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

https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
<!-- signed: domain:server#5 · zhuangjianguo ·
session_01QsR2jTkZnXtRhuEiiyidvJ -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
… non-object registry fault (objectstack-ai#34017)

<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbNTugWasvhTMrtCZiFGrZYK)_

Part of objectstack-ai#33851

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 改了什么:只改一个文件里的一句话。未发布的变更说明
`.changeset/33563-revert-commit-honest-outcome.md`
中,有一句说「非对象类型的注册表写入故障撤销仍看不到」,改成如实描述 objectstack-ai#33979 落地后的行为。
- 为什么改:objectstack-ai#33979 让撤销提交如实上报这些故障,原句因此变为错误;这条说明尚未发布,会原样进入 CHANGELOG。
- 风险与回滚:纯文本,不改代码。应在 objectstack-ai#33979 之后落地,否则这句话会先于代码生效。回滚即 revert 本 PR。
- 先看:`.changeset/33563-revert-commit-honest-outcome.md` 第 12 行。
- 两分钟验证:`git diff origin/main --
.changeset/33563-revert-commit-honest-outcome.md`,预期只有一行改动。
- 需要你做的:无,席位落地(本更正由区域 ACCEPT 确认)。

## What changes

**DELIBERATE CORRECTION** of the unreleased note
`.changeset/33563-revert-commit-honest-outcome.md` (shipped by objectstack-ai#33805).
One sentence is rewritten, and nothing else in the note changes.

Before:

> A write-through fault the registry helper only logs (every metadata
type other than `object`) is still not seen by the revert.

After:

> The same holds for an item of any other metadata type: a restored item
whose registry write-through throws, and a removed item whose registry
heal stops, so that the registry may still serve the removed row.

"The same holds" continues the note's paragraph above it. That paragraph
says an item whose row was written but whose next step did not land goes
into `failed[]`, not `reverted[]`, and the answer's `success` is
`false`. The corrected sentence describes the code of objectstack-ai#33979, which
makes `revertCommit` report both faults for every type. Without objectstack-ai#33979,
the old sentence is true and the new one is false, so this PR lands
after objectstack-ai#33979.

The correction is in its own text-only PR because rewriting an existing
changeset inside a PR that also changes code needs a same-head contract
review, and objectstack-ai#33979 has no contract face. A text-only correction is
confirmed by the area's ACCEPT.

## Tests

None: a changeset prose change. `git diff --stat origin/main...HEAD`
shows one file changed, with 1 insertion and 1 deletion.

## Verification

- Body gates: closing-keyword parity, Part-of, changeset no-major and
ADR-0087 registration all exit 0.
- Check Changeset is expected to report the edit to a changeset that
exists on the merge base. This body is the declaration of that edit as a
DELIBERATE CORRECTION; the `skip-changeset` label is not applied.

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

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

https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ

Co-authored-by: Claude <noreply@anthropic.com>
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…es the caller (objectstack-ai#34138)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9Dnx7PUeFruJdBHdG9Tmzjt)_

Fixes objectstack-ai#34077

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 改了什么:只在 ADR-0094 里加注记,不改代码。状态行加一条 2026-11-15 修订;9 月 4
日修订里那句「投影器失败只记日志、不报给调用方」后面、该修订表格正下方、D2 下同一说法的 9 月 4 日注记里,各加一个 ⚠️
指针。原文一个字不改。
- 为什么改:PR objectstack-ai#33805 之后,撤销一次提交(`revertCommit`)时投影器失败,该条目会进 `failed[]`,整体回
`success: false`,调用方能看到;ADR
还写着「不报给调用方」,读者会被误导。按版本回滚(`rollbackMetaItem`)没变,仍然只记日志,原句对它照旧成立。
- 风险与回滚:纯文档、只增不删,不影响任何运行行为。回滚即 revert 本 PR 一个提交。
- 先看:`docs/adr/0094-sys-permission-set-pure-projection.md` 的四处新增:第 3
行状态行末尾、第 130–135 行(D2 注记内)、第 575–580 行(修订表格正下方)、第 599–609 行(9 月 4 日修订的
`projectionApplied` 一条下)。
- 两分钟验证:`git diff --word-diff origin/main...HEAD --
docs/adr/0094-sys-permission-set-pure-projection.md`,预期只有 `{+…+}` 新增,没有
`[-…-]` 删除。
- 需要你做的:请批准并合并,或批准后由席位落地。

## What changes

ADR-0094's 2026-09-04 amendment says, verbatim: "`rollbackMetaItem` and
both `revertCommit` limbs declare no such key on their response types
and objectstack-ai#14982 deliberately added none: there the projector is called and
awaited, and a failure is logged without reaching the caller."

Premise, read on `main` (`385ea1cc`),
`packages/metadata-protocol/src/protocol-package-commits.ts`:

- `revertCommit`, soft-remove limb and restore limb: each reads the
projector's answer, and a `success: false` marks the item's step as not
applied; an item with any such step settles into `failed[]` (row state
named, the projector's own error text left on the log line) instead of
`reverted[]`, and the revert answers `success: false`. Landed by PR
objectstack-ai#33805 (`568f214a6c`), the sibling fix of PR objectstack-ai#34063. Pinned by
`protocol.revert-commit-honest-outcome.test.ts` ("the projector failing
on the restore limb…", "…on the soft-remove limb…").
- `rollbackMetaItem`: still `await host.runMutationProjector({...})`
with the answer discarded, then `success: true`. **The 2026-09-04
sentence is kept for it** and the notes say so.
- No `projectionApplied` key was added to either response type, so the
first half of the sentence still holds; only "logged without reaching
the caller" is stale, and only for the two `revertCommit` limbs.

Four add-only insertions in
`docs/adr/0094-sys-permission-set-pure-projection.md`; no existing
character is removed or rewritten, no sentence moves:

1. `**Status**:` line: ` · **Amended** (2026-11-15, objectstack-ai#34077): …` appended
in the form of the line's existing 2026-10-14 entry, narrowed to the
`revertCommit` limbs, citing PR objectstack-ai#33805.
2. An in-place `⚠️ **Amended 2026-11-15 (objectstack-ai#34077 / PR objectstack-ai#33805)**` pointer
indented under the 2026-09-04 bullet, right after the quoted sentence,
anchored at
`packages/metadata-protocol/src/protocol-package-commits.ts#revertCommit`.
3. **Beyond the card's two items (declared; accepted by review
6901691666):** the same pointer inside D2's own 2026-09-04 note, after
"three of the seven call and await the projector without putting an
outcome on the response." That note repeats the stale claim for the same
two limbs; leaving one copy unmarked is the defect an at-tier review
flagged on PR objectstack-ai#34063. Add-only, same narrowing.
4. **Fix round 1 (review 6901691666, S-1):** a ⚠️ pointer directly below
the amendment's door table, saying the `—` in the two `revertCommit`
rows now means only that the answer carries no `projectionApplied` key,
and that a projector failure there is reported through `failed[]` and
`success: false`; the `rollbackMetaItem` row is unchanged. No table cell
is touched. (N-2: the Status entry, text this PR adds, now names where
the notes sit.)

`docs/adr/README.md` is not regenerated: `adr-index` reports it current
(the 0094 row's status cell truncates before the appended text).

## Tests

None: docs-only diff, no code, no test. `skip-changeset` (`docs/adr/**`
publishes nothing).

## Acceptance notes

- Authoring ran in an isolated os-dev subagent pinned to the
contract-review tier (`dispatch-gates --tier`: MANDATORY for
`docs/adr/**`), effort xhigh, on this branch; this thread is served
below that tier. Recorded here and in the report's deviations.
- Same amendment, outside this card's surface, filed by the seat as
objectstack-ai#34142 (serial after this card): its tripwire `git grep -c
"this.runMutationProjector(" --
packages/metadata-protocol/src/protocol.ts` no longer answers `7`,
because the call sites moved into facet files (`protocol-save.ts`,
`protocol-history-and-publish.ts`, `protocol-diff-delete-load.ts`,
`protocol-package-commits.ts`). The amendment itself says that answer
means the table went stale. Not touched here.
- Landing: expect Tier H (a grown Status line reads as -1/+1; the
low-risk add-only reader refuses it). The PR stays a draft until a
GOVERNED_APPROVERS approval.

## Verification

Head `bd358f52` (fix round 1 on top of `2cc431b3`). `dispatch-gates
--commands` derives the same 21 commands; all 21 re-run on this head,
all exit 0; `--ran` reconciles: "21 derived famil(ies) accounted for —
21 run, 0 NOT-MEASURED (a DERIVED zero …)". The round on `2cc431b3` was
also 21/21 exit 0.

<details><summary>Gate record at bd358f5 (21 commands)</summary>

```text
node scripts/check-adr-links.mjs :: exit 0
node scripts/check-adr-links.mjs --self-test :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0
pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0
pnpm check:adr-anchors :: exit 0
pnpm check:adr-index :: exit 0
pnpm check:adr-symbol-anchors :: exit 0
pnpm check:ci-filter-parity :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:doc-authoring :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:pm-governed-merges :: exit 0
pnpm check:pm-prior-rulings :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:watch-hint-literal :: exit 0
```

</details>

Add-only proof against `main`: `git diff --word-diff` shows 0 `[-…-]`
runs over main's text (the line-3 word-diff inside the fix commit
touches only text this PR added); stripping the four insertions
reproduces the base file byte for byte. `git diff --check` clean; no
control bytes.

<!-- signed: domain:skills#2 · os-steve ·
session_01ADHkmT7hSxSj6X3GqfXJCn -->

---------

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/l 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