Repository navigation
fix(metadata-protocol): revertCommit answers only what it achieved, and a revert is revertible - #33805
Conversation
…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
📓 Docs Drift CheckThis PR changes 1 package(s): 21 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 10 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # 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
|
|
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. |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6 Review — PASSHead-sha: 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), Correctness
Scope and declarations
Nits (no change required)
Follow-ups, not part of this PR (for the seat)
Check-runs at this head (read at review time)
Author. |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTkZnXtRhuEiiyidvJ 席位核对ACCEPT · area S4 (E1) · Head-sha:
Landing under the area authorising line: ready + auto-merge. |
…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>
… 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>
…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>
Requested by Steedos · project thread
Fixes #33563
Fixes #33564
Fixes #33486
Clause-②: no
Metadata-protocol: none
维护者速读
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.
f1bf9b77). InrevertCommit, every item now recordsrowWrittenonce 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 (theobject-storage-sync-refusedadvisory stays onadvisories), or the mutation projector answering{ success: false }(its driver text is not quoted). Such an item goes intofailed[], notreverted[], 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 thecatch. The revert's own commit is now built from the rows the walk changed (revertPlan), not fromreverted[], so a row that changed under a failed item is still recorded.rollbackToPackageCommitcarries each such item through its existing per-item channel and answerssuccess: false.7dccd175). Before each row write, the revert reads the committing package's active row version (the same addresspublishPackageDraftsreads for its own plan) and records it as the item'sprevVersion, withexistedBeforetrue 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 withexistedBefore: trueand noprevVersion(the shape every revert commit an earlier release recorded) is named infailed[]with nothing written, and points at the item's own version history. It is no longer skipped.bfb561ff). TherollbackToPackageCommitdocblock says each step attempts its revert commit, best effort, and thatrevertCommitIdis then omitted. It also names the post-row-write faults a step'sfailed[]now carries.1c566dfb:protocol.revert-stored-type-canonical.test.tspinned the revert plan'sprevVersion: null, the value metadata-protocol: reverting a revert commit restores nothing (its items carry prevVersion null), against ADR-0067 D3 #33564 fixes. It now pins2. It is a separate commit because this branch is not force-pushable.863bd4b8: the engine double inpackages/objectql/src/protocol-commit-history.test.tsgainssyncObjectSchema. 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.e546a942:scripts/engine-double-contract.pinned.jsongains three additive rows for the new test file'sfindOne,updateanddeletedoubles. This is the ledgercheck:engine-double-contract --writegenerates, committed with the seat's approval.No spec schema moves:
failed[].codeis already optional and free-form, no new error code is coined, and the response keeps its declared keys. The twoprotocol.tsdocblock paragraphs ship in the.d.ts, so the changeset is apatch.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 infailed[]with its row named, and the advisory assertions are unchanged. The reason is the revertCommit docblock: "a revert that answerssuccess: trueis 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:prevVersionnull 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 realSysMetadataRepository, with a commit store that keeps every commit the protocol records.codeisNAMESPACE_CONFLICTand the revert commit still lists the item; storage refused; the projector failing on each limb; a throw after the row write; a rollback carrying the fault.prevVersion: 2, and 'Renamed' comes back); revert-of-revert on the soft-remove limb (prevVersion: 1, and the row is written again); the legacyexistedBeforeitem with no version (failed[], and nothing written).Ablations (
scripts/ablation-replace.mjs, each landed and then restored toblob == HEAD; vitest compilessrc, so no rebuild is involved). A6 is run at the #33564 commit, the others where listed.settlealways pushesreverted[]prevVersionback to nullexistedBefore: false, prevVersion: nullA1 was predicted at 6 red and came out at 5: the throw case is carried by the
catchprefix, which A2 covers alone.Acceptance notes
applyRegistryWriteThrough's non-object branches andrestoreArtifactRegistryView's heal catch their own faults and only log them, insideprotocol-registry-hydration.ts. That helper is shared with the save and publish doors. So avieworpermissionwrite-through fault is still invisible torevertCommit.prevVersion: null, and post-row faults stay out offailed[]).docs/adr/**is out of bounds for this PR, so a status-line amendment is owed after merge.Verification
Readings, local, on this box:
d1480af6/1c566dfb:@objectstack/metadata-protocol(350 files, 22892 passed);@objectstack/objectql(597 files, 13114 of 13115 passed; the one red was the double fixed in863bd4b8, which is green alone, 32/32);@objectstack/rest(417 files, 8742 passed);@objectstack/runtime(607 files, 12229 passed).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 lintexits 0.typecheckfor 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-loadsexits 3 because it needs the whole workspace built, so it is left to CI.!and Clause-② has no (narrowing) arm.Human Minimum
packages/specholds no runtime logic. (spec untouched)pnpm lintpasses.main, one pull request. Three cards are folded by the seat's order, one commit each.packages/spectouched: not applicable.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01QsR2jSn6n7eb34wbyxhZja