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) |
…il (objectstack-ai#37579) repo:objectstack#5 · os-bill · session_01Utp6CbL6Nn3scsU8yvLyU4 <!-- claude-projects-attribution: {"github_login":"os-bill"} --> _Requested by **Bill** · [project thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgPUWudpC44JvVj61ofRTo8S)_ Fixes objectstack-ai#37456 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:Studio 不再有顶栏。左栏顶部两行:第一行 Studio 标识和收起按钮;第二行「返回应用」和软件包切换器(应用图标、名称,只读带锁,末行「新建软件包」)。变更和发布在「概览 › 待发布」;组织流程(~org)没有概览,左栏保留一行「变更 N」。「新建应用」按钮去掉。手机宽度顶部一条细栏打开菜单。左栏收起后成窄栏。 - 为什么做:App Studio 改版去掉顶栏(ADR-0084 2026-11-26 修订)。 - 出错会怎样:最坏是某个入口找不到(发布、返回),不丢数据;撤回即恢复。 - 要你做什么:暂无(区域审完后合入)。 ## What changes Two halves on one branch. **Half 1** gives Studio's left column the two top-left rows the ADR-0084 amendment (`#amendment-2026-11-26-frame`, `#amendment-2026-11-26-homes`) gives it, built as their own files so objectstack-ai#37553's split of `StudioDesignSurface.tsx` is not disturbed. **Half 2** (after objectstack-ai#37454 / PR objectstack-ai#37546 merged; `main` merged once) deletes the top bar. ### Half 2: the top bar is gone - **`StudioDesignSurface.tsx`.** The header is deleted with everything only it used: the create-app button, state and dialog; the Publish button, its disabled / read-only reasons and the posture state; the now-unused imports. Each tenant's home, per the amendment's table: way back → the package row; ⋯ → 概览's header; Changes + Publish → 概览's Pending tab, with the count as the menu's `studio-menu-overview-pending` badge; Save / Cancel → the item header; assistant / panel toggle → the title row's end; menu toggle → Studio's row; Create app → nowhere (the silent item 5). The changes sheet stays for the ~org scope and now passes `posture="review"` explicitly. The switcher's pick opens the package's 概览 (`studioPackageOverviewPath`). - **`StudioTopLeft.tsx`.** `StudioScopePendingRow`: on the package-less ~org scope, which has no 概览, a "Changes · N" row (`studio-scope-changes`) under the package row (compact on the rail) opens the existing sheet and its `doPublish`. `StudioMobileStrip`: below 768 px a strip (`studio-mobile-strip`) holding the menu trigger and Studio's mark, since the drawer otherwise has no door. - **`StudioBackToApp.tsx`.** The top bar's `StudioBackToApp` is removed; `studioBackTarget` and `StudioBackButton` stay. - **`studio-tokens.ts`.** `STUDIO_HEADER`, `STUDIO_HEADER_PACKAGE_COLUMN`, `STUDIO_HEADER_WIDE_WORD` removed. - `StudioRoute.tsx` draws no bar, so it is untouched. - **Copy repointed (S1).** `engine.studio.newApp.appFailed` now points to the 应用 row in the package's menu. `engine.studio.data.draftObjectHint` now points to 概览 › Pending. The stale "Save in the top bar" strings (the two permission-set notes, `customize.saveFooter` and `inspector.draftFooter`) now say "page header" / 「页头」, in both en and zh. - **Missing-package way back (S2).** `StudioMissingPackageStrip` in `StudioTopLeft.tsx` is mounted when the package is missing, at every width. It holds `StudioBackButton` plus Studio's mark and name, in the place where the bar's way back used to be. ### Half 1: the rows - **`StudioTopLeft.tsx` (new).** Row 1 (`StudioBrandRow`): Studio's graphite mark, its name (`engine.studio.mark`, the existing key, which objectstack-ai#37566 renamed through objectstack-ai#37581 so it now reads App Studio / 应用搭建), the collapse control. Row 2 (`StudioPackageRow`): the way back, then the package switcher. Collapsed on desktop, the column is a rail (`studio-rail-head`): expand control, way back, app logo, stacked. - **`StudioPackageSwitcher.tsx` (new).** A popover naming the open package by its app (logo via `AppMark`, label via `navItemLabelText`, else the package name), with a lock when read-only. The list holds the openable packages: kernel packages out, `.custom` pairs folded ("with PAIR"), ~org / ~all not listed; a search box; the current row checked. Picking a package passes `beforeNavigate` (the unsaved-changes guard) and opens it. The last row, **New package** (authors only), opens the existing `CreatePackageDialog` (objectstack-ai#37134) and opens the created package. The list reloads on `objectui:packages-changed`; a failed read toasts under the shared `PACKAGE_LIST_TOAST_ID`. - **`StudioBackToApp.tsx`.** Adds `StudioBackButton`, the chevron-only way back with the same target as `studioBackTarget`. Its own testid (`studio-package-back`) so it does not clash with the top bar's `studio-back-to-app` while both exist. - **`StudioTitleRowFallback.tsx` (new).** The panel control (and save / assistant) for a page that draws no title row (loading, not found). It registers as a title row after the page in document order, so the page's own title row always wins and this draws only when there is none. - **`StudioMenu.tsx`.** A `head` slot at the top of the menu header; `collapsible` moves from `offcanvas` to `icon` (the rail); search and the advanced toggle hide on the rail; each menu item gets a tooltip, shown only on the rail. - **`StudioDesignSurface.tsx`.** Mounts `StudioTopLeft` as the menu's head and `StudioTitleRowFallback` after the pillars. The top bar's own menu toggle is removed (the toggle now lives in row 1, so the page never draws two). - **i18n.** `engine.studio.pkg.switcher`, `.search`, `.noMatches`, `.newPackage` (en, zh). ## Tests **Half 2** - `StudioDesignSurface.noTopBar-37456.test.tsx` (new, 8 cases) walks every former tenant at its new home: no top bar (control: the rows are drawn); the way back first in the package row and the one menu toggle in Studio's row; the phone strip opens the drawer; a switcher pick lands on `/studio/X/overview`; ⋯ only in 概览's header; badge → Pending → Publish POSTs `/api/v1/packages/<id>/publish-drafts`; a read-only Pending has no Publish; no Create app anywhere. - `notFound-26708` is re-pointed: in all 4 pillar cases it requires the way back on the missing-package strip (`studio-package-back`, target `/home`). The ablation (strip not mounted) turns 4 red. - `StudioTopLeft-37456.test.tsx`: +2 cases, the ~org Changes row (expanded and on the rail) and its control (a package scope draws none). `packageLessFlows-11553` gains the row → sheet path. - Re-pointed from the bar to the new homes (same claims): `backToApp-36501`, `graphite-37455`, `rightSlot-12725`, `desktopHint-11795`, `accessSegment-12452`, `interfacesRetired-36502`, `copilotDoors`, `copilotDraftBadge`, `itemDraftLine`, `metadataArea`, `packageListErrorPosture`, `pillarNavGuard`, `StudioPackageMenu-37139`, `StudioPackageOverview-37454`, `entryReadsOnce-11797`, `publishBackfill-12929` (badge → embedded panel → open the row), `customizePublish-28562`, `saveBar-36511`, `PackageFormDialog.newAppStep-36748`. - Deleted, because what they pinned no longer exists: `narrowHeader-12509` (the bar's narrow layout), `createAppAccessibleName` and the app cases of `CreateItemDialog.labels-13128` / `createTaken-26917` (Create app is gone), `publishPosture-12517` and `publishReadOnlyReason-12303` (the bar's Publish; the Pending tab's read-only posture is pinned in `noTopBar-37456` and objectstack-ai#37454's suite), `changesCount-11787` (its claim, a saved draft counts before its own re-read, is held by `metadataArea-28561`). - Ablations (each restored, `git diff HEAD` empty): `scopePending` never passed → 2 red in `packageLessFlows-11553`; the strip returns null → 2 red (`noTopBar`, `desktopHint`); the pick goes to the bare package path → 1 red (`noTopBar`). **Half 1** - `StudioTopLeft-37456.test.tsx` (new, 11 cases): the two rows and their order; naming by the app; the lock on a read-only package and its control (writable: no lock); the list folds a pair and checks the open package; pick opens a package; re-picking the open one does nothing; a declined leave keeps the page; search and its empty state; New package (authors only) opens the create dialog and then the created package; the package-less scope; the rail; the fallback with and without a page title row. - Re-pointed, not weakened: `homeLoop-12513` now asserts the way back is the first button of the package row and the toggle sits in Studio's row; `rightSlot-12725` waits for the assistant inside the list's title row (the fallback holds it while the list loads); the `PackageFormDialog.newAppStep-36748` door census adds the switcher's New package door. - `ui/e2e/studio-left-menu-36899.spec.ts`: re-pointed, not loosened. The collapsed case pinned the column off the canvas; the amendment's rail replaces that, so it now asserts a 3rem rail at the left edge with the content beside it, and still asserts the collapse cookie and the reload. - Ablations (each restored, `git diff HEAD` empty): the lock condition forced false, the lock case red; the fallback's `drawn` forced false, the fallback case red. <details><summary>Readings</summary> - Half 2 at 748026a: studio-design, i18n, `__tests__`, StudioRoute, DraftChangesPanel and newAppStep suites, `Test Files 314 passed`, `Tests 2843 passed`; app-shell `tsconfig.test.json` 0 errors; eslint 0 errors; derived gates 39/39 exit 0 (`vitest run scripts/` at 2 workers). - Half 1: `StudioTopLeft-37456`, `homeLoop-12513`, `rightSlot-12725`, `PackageFormDialog.newAppStep-36748`, the studio-design and i18n suites: 16 test files, all passed. At the head: `StudioTopLeft-37456` `Tests 11 passed (11)`. - `@object-ui/app-shell` sources and `tsconfig.test.json`: 0 errors; full workspace build (docs excluded) 123/123 tasks green. - Derived gate families (`dispatch-gates.mjs --commands`, 39): 37 exit 0 in the batch run; `check:test-source-alias` was red on the new suite (a clocked first load of `@objectstack/lint` through the create dialog) and is fixed by a module-top import, now OK; `vitest run scripts/` was killed by the container's memory limit in the batch and passes alone at 2 workers: `Test Files 172 passed | 2 skipped (174)`. </details> ## Acceptance notes - **A gap in ADR-0084's homes table: ~org Changes / Publish.** The table sends Changes + Publish to 概览's Pending tab, but the package-less organization-flows scope (~org) has no 概览 (`studioMenuOverviewEntry` returns null there), so deleting the bar would have left its drafts with no way to publish. Per the area's call, ~org keeps a "Changes · N" row in the left column (`StudioScopePendingRow`, within the `StudioTopLeft` files) that opens the existing sheet and its existing `doPublish`; nothing new on the server. Pinned by `StudioTopLeft-37456` + `packageLessFlows-11553` with an ablation, and shot light/dark. S3: the table gains this row in docs/adr follow-up objectstack-ai#37685. - **N5:** the read-only reason for keyboard and assistive-tech users is follow-up objectstack-ai#37687. N1–N4 are accepted as they are. - **Leftover i18n keys** (`engine.studio.app.*`, `backToApp`, `publish`, `publishTitle`) are now unreferenced; some were already dead before this card. Left in place for a sweep, not removed here. - **Follow-up objectstack-ai#37580:** the list page's New on a read-only package as disabled-with-tooltip (`ResourceListPage.tsx`, outside this card's surface). - **Studio's name** reads the existing `engine.studio.mark` key. objectstack-ai#37566 renamed it to App Studio / 应用搭建 through objectstack-ai#37581, and `StudioTopLeft-37456` pins the exact name (`/^App Studio$/`). - **The ~org scope's name in the switcher** is 「组织元数据」 / "Organization metadata" (a new key, `engine.studio.pkg.orgScope`, en and zh), because that scope's menu lists more than flows. The maintainer asked for this in the card thread on 2026-11-26. The menu row keeps 「组织级流程」. - **Main was merged three times**, each time because of a conflict that blocked CI or landing (objectstack-ai#37581, objectstack-ai#37542, objectstack-ai#37637, then objectstack-ai#37602). Main's incoming test assertions are kept wherever they still hold without the bar. Only the assertions that pinned the bar itself were dropped: the `studio-back` text and accessible name, `studio-back-app-name`, the bar's `studio-mark`, and the settle on the bar's Create app button. Two auto-merged objectstack-ai#37542 pins that anchored on `studio-shell-header` are re-pointed, not loosened (`graphite-37455` via `studio-top-left`, `pillarsClaimSlot-12725`). - `ui/e2e/studio-left-menu-36899.spec.ts` is **re-pointed, not loosened** (see Tests). - `ui/e2e/live/studio-customize-journey.spec.ts` is **re-pointed, not loosened**. Its `publishPair` clicked the deleted top bar's Publish. It now opens the menu's 概览 badge, publishes the pair in the embedded `draft-changes-panel`, and still asserts that the pair's `publish-drafts` POST answers 200 with `published`. The full live lane passed 23/23 locally. - Screenshots (Chromium, dsf 2, light and dark, showcase app): no top bar, switcher open, rail, 概览 Pending, ~org Changes, phone strip and drawer; with the area beside mockups 1 and 3 (`shots-37456/final/`). ## Verification Read first, by risk: 1. `StudioDesignSurface.tsx` hunks: what the header held and that each piece is either rehomed or deliberately gone (Create app); the sheet's explicit `posture="review"`; `packagePath={studioPackageOverviewPath}`. 2. `StudioScopePendingRow` and `StudioMobileStrip` in `StudioTopLeft.tsx` (the ~org gap; the phone's only door to the menu). 3. The deleted tests and the reason each claim is gone or held elsewhere (Tests, half 2). 4. `StudioPackageSwitcher.tsx`: the pick path (`beforeNavigate` before every navigation, including after create) and the list filter (kernel out, pairs folded). 5. `StudioMenu.tsx`: `collapsible="icon"` and the `RAIL_HIDDEN` classes (a missed class leaves a half-drawn control on the rail). 6. `StudioTitleRowFallback.tsx` and its mount point in `StudioDesignSurface.tsx` (it must stay after the page in document order). 7. `StudioBackButton` in `StudioBackToApp.tsx` (same target as the top bar's way back). ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: n/a. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Utp6CYYe7UScDrgUJxx5iP --------- 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>
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