Repository navigation
feat(rest,metadata-protocol,spec): the per-item publish takes a draft-version pin, so Save to this view never publishes a moved draft - #37387
Conversation
…asurement, M1 red on main) Measurement only, for a needs_decision report: M1 shows the publish door's active-row If-Match does not see a draft written between Save to this view's draft write and its publish; M2 shows a client-side pin on updateView's draft write does not either; M0 and M3 record the tokens and the active-save door's answer. Not for landing. Claude-Session: https://claude.ai/code/session_012MmDsSBHy5paNUz6zke9Re Co-authored-by: Claude <noreply@anthropic.com>
…ew-draft-publish-pin
…-version pin (draftVersion) The publish door refuses a draft that moved since the caller wrote or read it, 409 METADATA_CONFLICT naming the draft's current token, beside the active-row If-Match pin. Ruling 7168616260 (A1). Claude-Session: https://claude.ai/code/session_012MmDsSpwtcn5gbWrBDA3Jm Co-authored-by: Claude <noreply@anthropic.com>
…to the draft version Claude-Session: https://claude.ai/code/session_012MmDsSpwtcn5gbWrBDA3Jm Co-authored-by: Claude <noreply@anthropic.com>
…e draft they read Claude-Session: https://claude.ai/code/session_012MmDsSpwtcn5gbWrBDA3Jm Co-authored-by: Claude <noreply@anthropic.com>
…est.draftVersion Claude-Session: https://claude.ai/code/session_012MmDsSpwtcn5gbWrBDA3Jm Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012MmDsSpwtcn5gbWrBDA3Jm Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012MmDsSpwtcn5gbWrBDA3Jm Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 8 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 4 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 180 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 0205816c29915f2e23d423a4b3c9eb3a72e1f6ba && git checkout 0205816c29915f2e23d423a4b3c9eb3a72e1f6ba
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin da7c559990d879de9038ccf54e294e58bbaa647f a586b8c54572f8a0307da2143e41d4292dff22c5 && git checkout -B drift-repro da7c559990d879de9038ccf54e294e58bbaa647f && git merge --no-ff a586b8c54572f8a0307da2143e41d4292dff22c5
node scripts/docs-audit/affected-docs.mjs --json da7c559990d879de9038ccf54e294e58bbaa647f
|
|
repo:objectstack#6 · os-lizheng · session_012MmDsSBHy5paNUz6zke9Re Contract reviewServed-tier: Read: card #36350 with all ten comments (ruling record 7168616260, reports 7164597391 and 7179271525), ruling 7058616478 on #35955, the PR body, its 26-file list, and the net diff against Two must-fix findings (M1, M2), three should-fix (S1 to S3), five nits. The door itself holds: I could not make it publish a draft the caller did not pin. ① Derived judgments
② Semver levelM1 (must-fix) — The rest of ② holds. Every published package the diff touches has a changeset: spec, metadata-protocol, rest, data-objectstack, and app-shell with console. ③ Boundary flags
④ Design judgment
S1 (should-fix) — published contract text the diff leaves false.
S2 (should-fix) — the member is added to the private
M2 (must-fix) — ruling item 3 is not met on the draft bar's main path. Item 3: the bar's Publish "passes the draft token it showed, which closes the dev's out-of-scope finding on that caller". Line 151 clears the shown version when Nits:
Implemented-by: VERDICT: FAIL |
…in — protocol kind, bar pin after the host's save, conflict text Claude-Session: https://claude.ai/code/session_012MmDsSpwtcn5gbWrBDA3Jm Co-authored-by: Claude <noreply@anthropic.com>
…ict text Claude-Session: https://claude.ai/code/session_012MmDsSpwtcn5gbWrBDA3Jm Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#6 · os-lizheng · session_012MmDsSBHy5paNUz6zke9Re Contract reviewServed-tier: This is a DELTA record on record 7179921339 (FAIL at 8eee708: M1, M2, S1 to S3, N1 to N5). Read: the two commits between that head and this one (18 files), the PR body as rewritten at 02:49Z, the seat's correction 7179935180 and the dev's reports 7181146930 and 7181181714 on #36350, and this head's check-runs. Check-runs on this head, read at 2026-11-26T03:19Z with none pending: 74 runs, 62 success, 11 skipped, 1 failure. The failure is the All ten findings are closed. One new nit (N6), one changeset nit (N7). No must-fix, no should-fix. ① Derived judgments
② Semver levelM1: closed.
③ Boundary flags
④ Design judgment
S1: closed. N2: closed. The
S2: closed.
N1: closed. An off-type N3: closed. The acceptance case asserts exactly one The rest of the file is as reviewed at the last head.
S3: closed. A publish conflict whose body parses as
M2: closed. The panel hands the bar the version its save guard holds after each landed save, and the bar pins its Publish to it with no re-read. Followed through on this head:
So the window of the first record (A saves in view settings, B's rename lands, A presses Publish) now ends in a 409 with B's draft left pending. N4: closed. The PR body no longer claims an immediate retry for the bar; it says the author reopens the view settings.
N5: closed (see ③). No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#6 · os-lizheng · session_012MmDsSBHy5paNUz6zke9Re 席位核对ACCEPT · 2026-11-26T04:20Z · head
|
|
repo:objectstack#6 · os-lizheng · session_012MmDsSBHy5paNUz6zke9Re Landing (2026-11-26T04:20Z): head
State: |
…record, and the history selector refuses a package that neither holds nor ships the name (objectstack-ai#37423) <!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8B1Mg5PDzRbxsNX8cyVk17x)_ Fixes objectstack-ai#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 objectstack-ai#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 objectstack-ai#37039 bindings case now expects `differs` once (it recorded the double listing); N2 and N7 pins. <details><summary>Ablation (each fix line removed, then restored with git checkout)</summary> | 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 objectstack-ai#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 objectstack-ai#37013 | </details> <details><summary>Package runs</summary> - `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. </details> ## 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. - objectstack-ai#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 `[objectstack-ai#37130]` door pins and the two `[objectstack-ai#37130]` selector refusals. <details><summary>Local gates at abc706c</summary> `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 objectstack-ai#37387. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01JQwxba3jmfHtmkWfFXfVTc <!-- signed: repo:cloud#1 · os-warren · session_01JQwxba3jmfHtmkWfFXfVTc --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…nflict "reload" (objectstack-ai#37648) (objectstack-ai#37715) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuDJAbBe3iTrFcF7GZrucZ32)_ Fixes objectstack-ai#37648 The three review follow-ups PR objectstack-ai#37637 left on card objectstack-ai#37440: N6 of objectstack-ai#37387's review (the runtime draft bar keeps a stale token after "reload") and N1, N2 of contract review 7198547999 (the `publishItem` pin docs). ## What changes - **Draft bar after a conflict "reload" (`@object-ui/app-shell`).** A view settings Save refused because the draft moved opens the draft-conflict dialog. On "reload", `ViewConfigPanel` re-read the stored view into its buffer, but `handleViewConfigSave` answers `false` on `'reloaded'`, so no `savedSignal` reached `RuntimeDraftBar`, which kept the draft version it read on open. Its Publish was then pinned to a draft that had moved, refused `409 METADATA_CONFLICT`, until the panel was reopened. - The guard's reload callback is now `handleConflictReload`, which marks the next stored-view read as the reload's. That read, once it installs a buffer, hands the bar the version it found: `reloadedSignal` (bumped), `reloadedDraftVersion` (the `If-Match` of the read's pin; absent when the read named none) and `reloadedHasDraft` (whether a pending draft was served). - `RuntimeDraftBar` takes them as it takes `savedSignal`: the Publish is pinned to `reloadedDraftVersion`, and the indicator follows `reloadedHasDraft`. The bar never re-reads for it (objectstack-ai#36350: a re-read would pin whatever draft is pending by then, which the panel never showed). - A reload whose read fails installs no buffer and hands the bar nothing, so its Publish stays pinned to the draft it showed and is refused, never sent unpinned. - **`client.meta.publishItem` (`@objectstack/client`).** The `parentVersion` JSDoc now says an empty string pins nothing and is not sent, as `draftVersion`'s does (N1). JSDoc only; `metaPublishHeaders` already treated `''` so. - **Client SDK page (`content/docs/api/client-sdk.mdx`).** The `publishItem` example now shows a publish pinned with `draftVersion` (a draft save's receipt `version`) and `parentVersion` (the version the earlier publish returned), with the refusal and the empty-string rule (N2). ## Decisions made here - **Only `ViewConfigPanel` is changed.** It is the one host of `RuntimeDraftBar` with a draft-conflict guard (`useDraftSaveGuard`); `ReportConfigPanel` and `ReportView` host the bar without one, so no "reload" reaches them. - **The bar takes the panel's read, not a read of its own,** for the objectstack-ai#36350 reason above; and only the read that answers a "reload" is handed over, so an ordinary open, publish or discard behaves as before. ## Verification - New tests, red on `main` and green here (4 red with the two source files reverted): - `ViewConfigPanel.pinnedDraftSave-36137.test.tsx` (2): another writer's draft moves past the panel's receipt, the next Save is refused, "reload" hands the bar that writer's draft version with `reloadedHasDraft: true` (the landed-save signal unmoved); a reload that finds no pending draft hands `reloadedHasDraft: false` and no version. - `RuntimeDraftBar.test.tsx` (3): the Publish after `reloadedSignal` sends `draftVersion` = the reloaded version with no second draft read; a reload with no draft takes the indicator down; the mount's own signal changes nothing (control). - `vitest` over every `ViewConfigPanel*`, `RuntimeDraftBar*`, `ObjectView*`, `DraftConflictDialog*` and `viewCacheInvalidation*` test: 1,059 green. `tsc` for `app-shell` (`tsconfig.json` and `tsconfig.test.json`) on the changed files: clean; `eslint`: 0 errors. `check-doc-anchors`: pass. - `overlap-check`: exit 0 (no open PR touches these files). - Premise: static read on `main` (`handleViewConfigSave`'s `'reloaded'` → `false`; the bar sets its pin only on open and on `savedSignal`), and the red tests above. Clause-②: no Metadata-protocol: none Skills-docs: none ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (No spec change.) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `eslint` on the changed files passes (the full `pnpm lint` runs in CI). - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgUuauSMJu1nVSQRQri)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgUuauSMJu1nVSQRQri Co-authored-by: Claude <noreply@anthropic.com>
Fixes #36350
Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: none —
skills/**teaches no per-item metadata publish request: 0 hits overskills/for a/meta/…/publishroute,PublishMetaItem,publishMetaItem,draftVersionorparentVersion(the oneIf-Matchhit is the dataPATCHroute's optimistic lock).维护者速读
What changes
Ruling 7168616260 (A1) on #36350, executed as ruled:
PublishMetaItemRequestSchemagains one optional member,draftVersion: the version token of the draft the caller wrote or read and means to publish; its describe says the draft is judged first and that an address refusal (404 NO_DRAFT) precedes both pins.parentVersion(If-Match) keeps its shipped meaning, the active row's token; its describe now points at the draft's own pin.MetadataConflictErrorSchemanames the draft pin: on the publish door a refuseddraftVersionreturns the draft's token, sent back asdraftVersion, never asIf-Match, andnullthere means nothing is pending to publish. The publish route's declaration inplugin-rest-api.zod.tslists the 409 causes, both body read keys and the new 400. Generated reference (content/docs/references/api/protocol.mdx) andauthorable-surface/api.jsonregenerated by the build /check:generated --fix.packages/metadata-protocol/src/protocol-history-and-publish.ts) —promoteDraftForPublishjudgesdraftVersionagainst the draft row it just read, before any authoring rule judges that draft, with the save door's keyed comparison (storedParentForToken). A moved draft, or a pinned draft no longer pending, is refused409 METADATA_CONFLICTwithcurrentVersion= the draft's current token (nullwhen none), nothing promoted, and the same optimistic-conflict audit row as the other publish conflicts. An off-typedraftVersionfrom an in-process caller is refused400 VALIDATION_ERROR, never read as unpinned.PublishMetaItemRequest(protocol-door-requests.ts, the publicpublishMetaItemtype) now declaresdraftVersionandparentVersion. The existingexpectedDraftHashkeeps the promotion locked to that row through the write. The conflict-to-refusal mapping moved into one local helper shared by the pin and the promotion's owncatch(same text and audit as before for the existing two conflicts).packages/rest/src/meta-item-history-routes.ts) —POST /meta/:type/:name/publishreadsdraftVersionfrom its body besidemessageand forwards it when present; a present non-string is refused400 VALIDATION_ERROR, never read as absent.ui/packages/data-objectstack) —MetadataClient.publishtakesdraftVersionand sends it in the body.ObjectStackAdapter.updateView's draft branch reads the draft throughgetDraft(the envelope carriesversion) BEFORE the layered read it merges from, and writes pinned to it (If-Match, orIf-None-Match: *when the read saw no draft).ui/packages/app-shell/src/views/) — "Save to this view" (saveAndPublishRuntimeMetadata) passes the version its own draft write returned; a moved draft's409resolves'pending-draft'and the moved draft is NOT discarded (it now holds the other writer's change); a409withcurrentVersion: null(the draft was published or discarded by someone else) rethrows, since there is no draft to review. The runtime draft bar's Publish (publishRuntimeMetadata) passes the draft token the bar shows: on open, the one its draft read (readRuntimeDraftForPublish, throughgetDraft) returned; after its host's own save, that save's receipt version, which the view settings panel hands it assavedDraftVersionfrom its draft-version guard (useDraftSaveGuard().heldDraftVersion). Never a blind re-read.Absent
draftVersionis unpinned everywhere, as before.Why
Measured on main before any code (report 7164597391, re-run on the merged tree here): "Save to this view"'s draft write, then an
updateView-style draft write, then the publish pinned with the only pin main offered (If-Matchon the active row) answered 200 and published the interleaved draft. Ruling 7058616478 (#35955): an unpublished draft is never published on someone else's behalf.Tests
packages/rest/src/meta-item-publish-version-pin.test.ts(new top-level describe, ruling record 6583487846), real stack at the HTTP door:updateViewdraft write (pinned, and unpinned) interleaved between Save's draft write and its publish: refused409 METADATA_CONFLICT,currentVersion= the moved draft's token (parsed byMetadataConflictErrorSchema), active row unchanged, moved draft still pending;409,currentVersion: null; a draft token sent asIf-Matchstill answers the active row's refusal; non-stringdraftVersion(number, null, object):400 VALIDATION_ERROR, nothing promoted; in process, an off-typedraftVersionis refused400by the protocol; the acceptance refusal writes onepublish/deniedmetadata_conflictaudit row.meta-item-publish-draft-interleave-36350.test.tsis removed: its M1 is now the acceptance pin above; M0 (token identity) is asserted there (readDraft().versionequals the receipt and the refusal'scurrentVersion); M2 and M3 measured options B-extended and C, which the ruling did not take, and their readings stay recorded in report 7164597391.protocol.test.tspinsdraftVersionpreserved through parse, absent stays absent, non-strings refused.updateView.draft.test.ts(new describe:If-Matchfrom the draft read, read before the layers;If-None-Match: *when the read saw none; a409reaches the caller; no version pins nothing),metadata-client.publishPackageBinding.test.ts(body carriesdraftVersionbesidemessage; omitted, no key),runtime-metadata-persistence.test.ts(Save passes its receipt's version; a moved draft resolvespending-draftand is not discarded;currentVersion: nullrethrows; draft bar passes the shown token),RuntimeDraftBar.test.tsx(Publish sends the shown version; refusal keeps the bar; after the host's own save the Publish is pinned to that save's receipt version with no re-read; the save-then-publish window refuses another writer's draft; a host with no receipt version stays unpinned),ViewConfigPanel.pinnedDraftSave-36137.test.tsx(each landed save hands the bar its own receipt version). Four existing draft-bar /updateViewdoubles now answergetDraftand the drafts ledger.Readings (head a0b4863; first round at 8cee422/8eee7080 in report 7179271525)
pnpm --filter @objectstack/rest exec vitest run src/meta-item-publish-version-pin.test.ts—Tests 18 passed (18)(adds the in-process off-type pin and the audit-row assertion).draftVersioncheck mutated, metadata-protocol rebuilt, marker indist/:Tests 3 failed | 14 passed (17); restored blob == HEAD, rebuilt,--absentclean:17 passed.shownDraftVersionRef.current = savedDraftVersion;replaced viascripts/ablation-replace.mjs(blobda8e79d7->e00baf11):RuntimeDraftBar.test.tsxTests 2 failed | 11 passed (13)(the after-save pin and the save-then-publish window); restored, blob == HEAD,git diff HEADempty.pnpm --filter @objectstack/spec test—Test Files 895 passed (895),Tests 28420 passed | 1 todo.pnpm --filter @objectstack/metadata-protocol test—Test Files 370 passed | 9 skipped (379),Tests 23435 passed | 45 skipped.pnpm --filter @objectstack/rest test—Test Files 429 passed (429),Tests 8852 passed | 351 skipped.ui(vitest run): the draft-bar, persistence, view-settings and report files plus all ofpackages/app-shell/src/views/metadata-admin/—Test Files 810 passed (810),Tests 8717 passed | 1 skipped.packages/data-objectstack/(unchanged this round) —127 passedin round 1. The fullpackages/app-shell/suite was not re-run this round;Test UIcarries it.@objectstack/spec,@objectstack/metadata-protocol,@objectstack/resttypecheckand@object-ui/app-shelltype-check, chained with&&:VERDICT command-exit 0.Acceptance notes
parentVersion) is still judged where Studio save goes live: two admins saving the same published object, the later save silently overwrites the earlier one (the published layer has no version a save can pin) #36601 put it, inside the promotion.'pending-draft'(the same answer as over a draft found pending before its write) and leaves the draft for review. That draft holds this save's body with the other writer's change on top; it is not discarded because it is no longer this call's own.updateViewnow reads its draft sequentially (getDraft, then/layers) instead of in parallel, one extra round trip, so a pin can only be older than the body it merges, never newer.savedSignal, which the view settings panel bumps on every landed save), pins its Publish to that save's receipt version (savedDraftVersion). A host that gives no receipt version leaves that Publish unpinned, as before.draftVersionyet (studio-design/studioSaveBar.tsxtwice,metadata-admin/DraftConflictDialog.tsx,metadata-admin/detailSaveAtOnce.ts,recordTabsConfigSave.ts,objectExtensionArrangementSave.ts,layout/designModeMenuSave.tstwice), and@objectstack/client'spublishItemcan state neither pin. The member is opt-in by ruling; ruling item 3 named the four callers this PR pins.Verification
Gates (local subset, derived by dispatch-gates.mjs from the diff, on a0b4863)
node scripts/pm/dispatch-gates.mjs --ran(exit codes recorded):125 derived, 123 run, 2 NOT-MEASURED, 0 UNRUN.node scripts/check-plugin-teardown-shape.mjs --self-test: exit 3, its positive control is pinned to a commit this shallow clone cannot reach. CI runs it.pnpm check:dual-build-cjs-loads: exit 3, packages outside this diff have nodist/in this container (PREREQUISITE NOT MET). CI runs it.pnpm --filter @objectstack/spec run check:skill-examples: exit 3 untilclient-reactwas built, then exit 0.pnpm --filter @objectstack/spec check:generated:check:docsstale after the conflict-text edit, regenerated with--fixand committed;check:api-surfacegreen on the built dist.overlap-check:VERDICT cleanagainst origin/main and the one PR head sharing a file (feat(security)!: View All and Modify All stop opening fields; viewAllFields is the one every-field bit #37371, generated reference page: merges cleanly).Two-minute check:
pnpm --filter @objectstack/rest exec vitest run src/meta-item-publish-version-pin.test.ts— expectTests 18 passed (18), including the[#36350]describe.Read first (by risk):
packages/metadata-protocol/src/protocol-history-and-publish.ts(the pin and the shared conflict helper),ui/packages/app-shell/src/views/RuntimeDraftBar.tsxwithViewConfigPanel.tsx(the pin after the host's save),ui/packages/app-shell/src/views/runtime-metadata-persistence.ts(the no-discard and nothing-pending branches).Human Minimum
packages/specholds no runtime logic.pnpm lintpasses (CI-owned run).main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_012MmDsSpwtcn5gbWrBDA3Jm
Generated by Claude Code