Repository navigation
fix(client, app-shell): every draft-then-publish Save publishes only the draft it wrote - #37637
Conversation
Claude-Session: https://claude.ai/code/session_01L6bhgWAbKPqt7vTgX5qgUn Co-authored-by: Claude <noreply@anthropic.com>
… draft receipt Claude-Session: https://claude.ai/code/session_01L6bhgWAbKPqt7vTgX5qgUn Co-authored-by: Claude <noreply@anthropic.com>
…t they wrote Claude-Session: https://claude.ai/code/session_01L6bhgWAbKPqt7vTgX5qgUn Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgWAbKPqt7vTgX5qgUn Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgWAbKPqt7vTgX5qgUn Co-authored-by: Claude <noreply@anthropic.com>
… guarded-save PR Claude-Session: https://claude.ai/code/session_01L6bhgWAbKPqt7vTgX5qgUn Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgWAbKPqt7vTgX5qgUn Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgWAbKPqt7vTgX5qgUn Co-authored-by: Claude <noreply@anthropic.com>
…t pin Claude-Session: https://claude.ai/code/session_01L6bhgWAbKPqt7vTgX5qgUn Co-authored-by: Claude <noreply@anthropic.com>
The guard's draft pin (rule 10, the draftStillAt classification, isPublishDraftMoved, draftReceiptVersion) moves with the guard into draftVersionGuard.ts; the dialog re-exports the new names and keeps the header rule and the hook's stable heldDraftVersion. Claude-Session: https://claude.ai/code/session_01L6bhgWAbKPqt7vTgX5qgUn Co-authored-by: Claude <noreply@anthropic.com>
…save wrote Each row's publish now names the draft its own guarded save returned (heldDraftVersion right after the save), so another writer's draft that lands in between is refused and kept, never published or taken back. One PIN and one CONTROL in the row's existing harness. Claude-Session: https://claude.ai/code/session_01L6bhgWAbKPqt7vTgX5qgUn Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgWAbKPqt7vTgX5qgUn Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check1 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 21 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 d18cb79eda7c89e81b2663570dc2c704df02d4a1 && git checkout d18cb79eda7c89e81b2663570dc2c704df02d4a1
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 33a31dc7b083e1a25310b0323c8cc5d796c3b4b8 046abbb2e0a91b83b9b257e465662861f00c024d && git checkout -B drift-repro 33a31dc7b083e1a25310b0323c8cc5d796c3b4b8 && git merge --no-ff 046abbb2e0a91b83b9b257e465662861f00c024d
node scripts/docs-audit/affected-docs.mjs --json 33a31dc7b083e1a25310b0323c8cc5d796c3b4b8 |
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA Contract reviewServed-tier: Inputs read: card #37440 (body, both triage comments, the claim 7192440976, os-dev-reports 7195557089 and 7197868942); PR #37637 body and all 32 files, net diff merge-base Gate verdicts at this head: every check-run is completed, ① Derived judgments
② Semver level
The
③ Boundary flags
Nits (no effect on correctness or the contract):
Implemented-by: VERDICT: PASS |
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA 席位核对 — ACCEPT · head 046abbb · card #37440 · area s2-ux-S · 2026-11-26T17:09ZL1 checklist
Tier: S. Landing: ready + auto-merge by this stroke. |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 45865380828 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
Requested by Sales · project thread
Fixes #37440
Clause-②: yes (widening:
@objectstack/clientmeta.publishItemacceptsdraftVersionandparentVersionbesidemessageandpackageId)Metadata-protocol: none
维护者速读
What changes
client.meta.publishItemtakes the two optimistic-concurrency pins the per-item publish door already judges (ADR-0008,PublishMetaItemRequestSchema).draftVersiongoes in the body besidemessageand names the pending draft the publish promotes.parentVersionis sent asIf-Match, andnullis sent asIf-None-Match: *; it names the live row the publish replaces. With neither set, the request is byte-identical to before.Every console Save that writes a draft and publishes it at once now passes
draftVersion. The value is the version its OWN draft write returned:draftReceiptVersion(receipt), orheldDraftVersion(...)right after a guarded save. It is never a fresh re-read, which would pin another writer's draft. The callers:publishSavedIteminstudioSaveBar.tsxtakesSavedItem.draftVersion. It is forwarded by DataPillar (objects and object extensions), AutomationsPillar (flows and the on/off switch),objectHooksBuffer,pairObjectActions, PermissionMatrixEditor,newAppDoor, and MetadataListCreateDialog (new object and new flow).detailSaveAtOncevia ResourceEditPage.recordTabsConfigSave) and an installed object's field arrangement (objectExtensionArrangementSave).designModeHeaderPinsSave) and the menu plus menu labels (designModeMenuSave).A door refusal under the draft pin is
409 METADATA_CONFLICT, the same code the live-row pin gets, and the body does not say which pin refused. The draft-version guard (draftVersionGuard.ts, new rule 10 in theDraftConflictDialog.tsxheader) tells the two apart with one draft read after the refusal:isPublishDraftMoved.Every caller treats a moved draft the same way: nothing is published and the draft is kept, because it now holds the other writer's change. The Save reads as refused or says a draft is pending. Every take-back of the Save's own draft is pinned
If-Matchto that same receipt, so a refused Save never deletes a draft someone else changed.Why
#36350 added
draftVersionto the publish door, but no caller sent it. In the window between a Save's draft write and its publish, another writer's draft write (another tab, the copilot) is promoted live under the first author's Save. The client test reproduces this at the real door: the unpinned publish promotestheirs.Read first (risk order):
ui/packages/app-shell/src/views/metadata-admin/draftVersionGuard.ts: thepublishcatch anddraftStillAt. This is where a refusal is classified; a misclassification either asks the wrong question or keeps a draft that should be discarded.ui/packages/app-shell/src/views/studio-design/studioSaveBar.tsx:publishSavedItem, which holdsdraftMoved,discardScope, and the skipped discard.ui/packages/app-shell/src/layout/designModeMenuSave.ts:discardOwnDraft, the pinned take-back whose409means "moved, keep it".Two-minute verification: run
pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/studioSaveBar.draftPin-37440.test.ts. Expect 5 passed. The PIN case shows the other writer's draft still pending and the live row unchanged.Tests
Each caller got one PIN (another writer's draft lands between the Save's draft write and its publish: nothing goes live, their draft is kept, no reset) and one CONTROL (no interleave: the Save's draft goes live), in that caller's existing harness. The PIN asserts
draftVersionis the caller's own receipt; the CONTROLs assert the outcome only.packages/client/src/meta-publish-item-package.test.ts, Part 3, on the real per-item publish door: the reproduction, PIN, CONTROL, the wire shape (bodydraftVersion,If-Match,If-None-Match: *fornull, nothing when unset), andparentVersionstale ornullrefused.studioSaveBar.draftPin-37440.test.tsanddetailSaveAtOnce-37440.test.ts, over a stateful door double,views/__tests__/draftPublishDoor-37440.ts.recordTabsConfigSave-36499,objectExtensionArrangementSave-36499,designModeHeaderPinsSave-36366,designModeMenuSave-36538(menu and translation, plus the published-moved distinction),DraftConflictDialog.test.tsx(guard rule 10: PIN, live-row-moved still asks, overwrite keeps the draft pin, CONTROL), andPackageOwdOverviewPanel.draftPinned-37515.draftVersion: expect.any(String):AutomationsPillar.customizeFlow-28570,DataPillar.pairActions-30088,StudioDesignSurface.draftVersionConflict-11773.Ablation: one per pin (rebuild, on-disk mutation via
scripts/ablation-replace.mjs, restore). Every PIN went red with its CONTROL green, andgit diff HEADwas empty after each restore.Local test readings at head 046abbb (each under scripts/pm/os-verify-lock.sh)
pnpm --filter @objectstack/client exec vitest run --maxWorkers=2 src/meta-publish-item-package.test.ts: Test Files 1 passed (1), Tests 15 passed (15), VERDICT command-exit 0.firstScreenStudioCatalogue-37444): Test Files 9 passed (9), Tests 112 passed (112), VERDICT command-exit 0.draftVersionGuard.ts/customizeOverride.ts. Result: Test Files 346 passed (346), Tests 2658 passed (2658), VERDICT command-exit 0. This ran at 8192a73; the only later commit is the changeset.pnpm --filter @object-ui/app-shell type-check: VERDICT command-exit 0.Ablation readings (every PIN red, CONTROL green, restored)
After every restore,
git diff HEADwas empty.Acceptance notes
StudioDesignSurfacepublishDraft('flow')(about line 655),usePublishAllDraftsand PackagesPagepublishDrafts. These are publish-all doors with no draft write of their own, so there is no receipt to pin.runtime-metadata-persistenceboundToPackage, which is already pinned.draftVersionGuard.ts. Rule 10,draftStillAt,isPublishDraftMovedanddraftReceiptVersionnow live there;DraftConflictDialog.tsxre-exports them and keeps the header rule and the hook's stableheldDraftVersion. The Console first screen: home, object list and record page miss the 2.5 s LCP threshold (baseline 3.6 / 4.6 / 4.2 s); re-measure on a production build first #37444 first-screen import walk (firstScreenStudioCatalogue-37444) stays green: the list and record save paths import the new names fromdraftVersionGuard.ts, never from the dialog.publishSavedItemordetailSaveAtOnce) and the updated exact-argument asserts above, not each by its own PIN.version, every caller publishes unpinned, as before.Verification
Derived gate families at head 046abbb
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 74 families. 73 exited 0, includingpnpm --dir ui exec vitest run scripts/,check:type-check-debtandcheck:skill-examples, each after building their prerequisite dist.pnpm check:dual-build-cjs-loadsexited 3, PREREQUISITE NOT MET: not every package has a dist in this container. NOT MEASURED locally; it is read from this PR's checks.--ranreconciliation: 74 derived, 74 run, 0 UNRUN.node scripts/check-nul-bytes.mjs: OK.node scripts/pm/overlap-check.mjs: VERDICT clean exit 0, against origin/main 54d6726 and 0 open PR heads.Merge, not rebase: origin/main (including #37589 and #37554) was merged into the branch in 6f1e735.
Human Minimum
packages/specholds no runtime logic. (packages/specuntouched.)pnpm lintpasses. (No formatter ran;pnpm lintis the CI-owned repo scan, read from this PR's checks.)main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (Not touched: n/a.)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgWAbKPqt7vTgX5qgUn