Repository navigation
fix(studio): pin the object extension, hook, action and flow Saves' publish (#36726) - #36958
Conversation
…Saves (WIP) Claude-Session: https://claude.ai/code/session_011y7As6kDA9BVrMsBR9rmrJ Co-authored-by: Claude <noreply@anthropic.com>
…s' publish (WIP) Claude-Session: https://claude.ai/code/session_011y7As6kDA9BVrMsBR9rmrJ Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As6kDA9BVrMsBR9rmrJ Co-authored-by: Claude <noreply@anthropic.com>
…udio-pinned-publish
…nesses; fixtures expect the create's If-None-Match Claude-Session: https://claude.ai/code/session_011y7As6kDA9BVrMsBR9rmrJ Co-authored-by: Claude <noreply@anthropic.com>
…f-None-Match Claude-Session: https://claude.ai/code/session_011y7As6kDA9BVrMsBR9rmrJ Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W Sequencing note from seat 3 · 2026-11-24T16:06Z. PR #37026 (#36902, generic detail save-on-save) and this PR share no files, and either can land first. However, this PR's new rule 9 needs Generated by Claude Code |
|
repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH 席位核对 — ACCEPT · head ab5ccacL1 reviewer for #36726, read at 2026-11-24T16:32Z against GitHub at this head. I did not rely on the report's own account. Checklist (
Reads against the card
Landing owed (patch round, not REWORK)
Governed: no. Narrowing: no. Dogfood battery: not owed. |
Resolves the StudioDesignSurface.tsx conflict with the pillar split (6902acb): this branch's DataPillar and AutomationsPillar hunks are moved unchanged into DataPillar.tsx and AutomationsPillar.tsx, and the three studioSaveBar imports they use (readPublishedPin, publishCreated, publishedPinOfLayers) plus isPublishConflictKeptEditing move with them into the new modules' import lines. StudioDesignSurface.tsx is main's. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH
|
repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH 席位核对 — ACCEPT · head 3c642c7This is a delta over the ACCEPT record 7137844915 at
|
|
repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH Landing — seat arms #36958
|
…pillar nav (objectstack-ai#36985) <!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBTuMGhLAZx29zwDrayDGZZF)_ Fixes objectstack-ai#36899 Part of objectstack-ai#36890 Clause-②: yes (widening) Metadata-protocol: none repo:objectstack#3 · os-support-ai · session_01WGufziBCAytAzzCu3iPBFR ## 维护者速读 - 建应用的人在 Studio 里,顶部那排“数据/自动化/访问/全部元数据”切换没了,换成左侧一列可折叠菜单:数据、界面、自动化、平台、访问、AI 六组,每组带数量和搜索,折叠后刷新还记得,手机上是抽屉。 - 属于“Studio 重构”这条主线(左侧菜单是后面列表页、全屏详情和设计器改造的落脚点)。 - 出问题时作者可能找不到某类元数据的入口,或折叠状态不记忆;不动任何数据,直接撤回这次改动就回到顶部切换。 - 无。 ## What changes **Studio's one navigation is now a left menu of six groups** (amended ADR-0084: Data, UI, Automation, Platform, Access, AI; zh 数据、界面、自动化、平台、访问、AI). The top pillar switcher is gone from every Studio page. - **What it lists.** Each group lists the metadata types the open package holds, by the type directory's own rule: `scopeDirectoryEntries` (new `directoryScope.ts`) is now read by both `DirectoryPage` and the menu, so the two never disagree. A group carries its type count, an entry its item count (the diagnostics sweep the directory already reads), and a search box narrows entries by label or machine name. Object, Flow and Permission Set are always listed, so an empty package can create its first one. - **Where entries go.** A type entry opens that type's list in the area (`/studio/PKG/metadata/TYPE?package=PKG`); an item of an object, flow or permission set still opens its designer through `areaItemPillarPath`, so the pillar routes stay and are reached as before. Four entries are not a type: **Organization flows** (`/studio/~org/automations`) under Automation, **Default sharing** (the Access pillar on `?surface=owd:overview`; the page itself is objectstack-ai#36905's) under Access, **Diagnostics** (`metadata/_diagnostics`) under Platform, and **Positions and permissions** (the environment catalog on `~all`) under Access. Datasource still goes to Setup (ADR-0146 D1). - **Current entry.** The open page's entry carries `aria-current="page"` and the sidebar's active state: an area page marks its type, a pillar marks the type it designs (Data marks Object, Automations marks Flow, Access marks Permission Set, Access on the OWD overview marks Default sharing). - **Collapse.** It is the app sidebar's own primitive (`SidebarProvider` / `Sidebar collapsible="offcanvas"` from `@object-ui/components`), docked below the top bar. The top bar's leading toggle hides and shows it; the state survives a reload under **Studio's own cookie `studio_menu_state`**, never the app sidebar's `sidebar_state`. Below 768 px it is a drawer that closes when an entry is chosen. `SidebarProvider` gains an optional `cookieName` prop for this (default unchanged), declared as a new shadcn local-patch family in `ui/scripts/shadcn-local-patches.mjs` with its pin. - **Group names (binding note 7127465963, first option).** The menu maps the two names itself: `studioMenuGroupLabel` (new `studioMenuGroupLabel.ts`) names the `system` group Platform / 平台 and the `security` group Access / 访问 (new keys `engine.studio.menu.groupSystem` / `groupSecurity`); the other four groups read `translateMetadataDomain`. Only the left menu's group headings use it. The shared dictionary is unchanged (System / 系统, Security / 安全): Setup's datasource pages read it for `PageShell`'s domain badge, and no other Studio heading or chip is renamed. - **Clause-② yes (widening):** the published `@object-ui/components` `SidebarProvider` gains an optional `cookieName` prop (claim amendment on objectstack-ai#36899, 7134770955). - **`~all` frame: merged into one shell.** `/studio/~all/metadata/*` is now served by the same route as a package's area (`:packageId/metadata/*` already outranked `~all/*`), and `StudioDesignSurface` draws it with no package, no package actions and no right slot, beside the same menu. The landing's frame (`StudioConsoleFrame`) now frames only the landing. `areaLocationRedirect` now sends a `~org` area URL, or `?package=~org`, to the package-less flows instead of reading `~org` as a package. - **「‹ Back to app」 (decision 5 + maintainer ruling 7127681255).** It names the current package's app, never a remembered app of another package; a recorded page of one of the package's own apps is still where it returns. A package with no app, and the org-level and cross-package entries, name the package (or the scope: Organization flows / Positions and permissions) and go to the apps home. - **变更 / 发布 stay where they are:** at the right end of the top bar, beside Cancel and Save, drawn while drafts are pending (objectstack#36511). - Kept: the save coordinator, the unsaved-work guard (a menu link that leaves asks once through the shell's link guard; the Default sharing entry, which re-enters the open Access pillar on another query, asks through the surface's own confirm and then remounts the pillar once the router holds the new query), the right slot and copilot dock, the changes panel and Publish, the writable gate and paired package, and the package-missing empty state (no menu there). - en and zh strings: `engine.studio.pillar.*` removed, `engine.studio.menu.*` added. ### Choices the card asked to state | Question | Choice | | --- | --- | | Group names | Mapped in the menu only (`studioMenuGroupLabel`): system = Platform/平台, security = Access/访问; the shared dictionary keeps System/Security | | `~all` frame | Merged into the builder's shell: one shell, one menu on every Studio page | | Cookie key | `studio_menu_state` (own key; `sidebar_state` untouched) | | 变更 / 发布 | Stay at the top bar's right end beside Cancel / Save | | Address builder (objectstack-ai#36895, PR objectstack-ai#36973) | objectstack-ai#36973 landed first (9c57bd2); main merged at c840fdd and the menu repointed at 7617f52: every `studioMenuModel.ts` link and its open-page detection now come from the `studioAddress.ts` builders, byte-identical (the menu tests pin the hrefs). No `STUDIO_ITEM_PILLAR` row and no scope-segment encoding is changed here. | ### Where the work landed outside the stated file surface - `ui/packages/components/src/ui/sidebar.tsx` and `ui/scripts/shadcn-local-patches.mjs` (the surface said "read; a new cookie key"): the provider hard-coded `sidebar_state` on every write, ⌘B included, so a second key needed the `cookieName` prop. It is a declared local patch with its pin. - `ui/packages/app-shell/src/views/metadata-admin/DirectoryPage.tsx` and new `directoryScope.ts`: the directory's listing rule moved into one helper the menu shares (item 1 says the menu reuses the directory's grouping data). - The apps home: the console has no `/apps` index route, so "back to the apps home" goes to `useHomePath()` (the `/home` launcher in Studio), which is what the console calls the apps home. - The menu's group labels carry `HIDDEN_ICON_LABEL_NOT_FOCUSABLE`, as every `SidebarGroupLabel` call site does (objectui#12795 call-site pin); the menu is offcanvas, so the classes never take effect there. ### Known regression (temporary, accepted by the seat 2026-11-24 13:41Z) - **⌘K on `~all`:** `~all` now renders inside Studio's builder shell, so the console `AppHeader` and its ⌘K command palette are no longer drawn on the `~all` leg. Studio's own ⌘K arrives with objectstack-ai#36900, which is queued next on the list side once this PR and objectstack-ai#36895 land. ## Tests - New: `studioMenuModel.test.ts` (groups, entries, links, counts, current-entry rule, search), `StudioMenu.test.tsx` (own cookie and remount, app sidebar collapse does not collapse the menu, drawer below 768 px closing on choose, aria-current, counts, search with no-match status, focus order toggle then search then entries), a sidebar `cookieName` case in `sidebar-cookie-restore.test.tsx`, the patch-family pin in `shadcn-local-patches.test.ts`, a `~org` case in `metadataArea.test.ts`, console route cases (`~all` on the builder route, the entry gate before `~org/automations`, the OWD overview and Diagnostics, no recent-package record for `~all`). - The eight surface tests that asserted `studio-pillar-nav` now assert the menu: `notFound-26708`, `accessSegment-12452`, `heldDataLeave-26705`, `heldFlowLeave-26705`, `interfacesRetired-36502`, `metadataArea-28561`, `pillarNavGuard`, `narrowHeader-12509`; `backToApp-36501` and `packageLessFlows-11553` follow decision 5. Also converted: `packageListErrorPosture` (the menu and its toggle survive a package-list failure), `homeLoop-12513` (the menu toggle is the bar's first button, Back to app the first way out after it) and `heldFlowLeave-26705` (module-top `@objectstack/lint` import, as its held-data sibling has). `studioMenuModel.test.ts` also pins the menu's own group names (en and zh) and the shared dictionary keeping System/系统 and Security/安全; `PageShell.narrowHeader-12306` is back to main's 'Security'. - E2E: `ui/e2e/studio-left-menu-36899.spec.ts`, a Chromium page bundling the real menu: docked at the left with the content beside it, off the canvas when collapsed with the content at full width, still collapsed after a reload (cookie on a real http origin), a drawer inside the viewport at 390 px. <details><summary>Local readings at 214400b, patch rounds to 7617f52</summary> - `vitest run` on the 50 touched and related files (touched tests, every test naming `translateMetadataDomain` or a `security`/`system` domain, DirectoryPage, StudioRoute, StudioBackToApp, packageLess, sidebar): `Test Files 50 passed (50)`, `Tests 450 passed (450)`, lock `VERDICT command-exit 0`. - `pnpm --dir ui exec vitest run scripts/`: `Test Files 172 passed | 2 skipped (174)`, `Tests 5130 passed | 2 skipped`, `VERDICT command-exit 0` (at b901832; the last commit touched only the e2e spec). - `type-check` of `@object-ui/components`, `@object-ui/i18n`, `@object-ui/app-shell`, `@object-ui/console` and `type-check:e2e`: `VERDICT command-exit 0` (at b901832; `type-check:e2e` re-run at 214400b). - `playwright test e2e/studio-left-menu-36899.spec.ts --project chromium`: `3 passed`. - Derived gate families (`dispatch-gates.mjs --commands`): all 18 exit 0 locally; `check:i18n-keys`, `check:i18n-drift`, `check:i18n-dead-keys`, `check:new-line-citations`, `check-nul-bytes`, `check-platform-checklist --changed-from origin/main` exit 0. - Patch round at df57661 (CI red at 214400b on "Test-source alias gate"): `heldFlowLeave-26705` now imports `@objectstack/lint` at module top, as its held-data sibling does. `node scripts/check-test-source-alias.mjs` exit 1 before, exit 0 after (`123 packages with tests scanned`); `--self-test` exit 0. - Patch round at 1f7534d (CI red at df57661 on Test UI 3/16, 4/16, 14/16): the three files at the pre-fix versions `Test Files 3 failed (3)`, `Tests 3 failed | 10 passed (13)`, `VERDICT command-exit 1`; on the fix `Test Files 3 passed (3)`, `Tests 13 passed (13)`, `VERDICT command-exit 0`. - Patch round at 0af200c (L1 REWORK 7134737804, S1 + S2): `studioMenuModel.test.ts` `Tests 11 passed (11)` plus the other 5 touched files green; `check-test-source-alias` exit 0; `@object-ui/app-shell` type-check exit 0; `check:i18n-keys` / `check:i18n-dead-keys` / `check:i18n-drift` exit 0; card 2,362 changed lines. - Merge + repoint at 7617f52 (objectstack-ai#36973 merged): conflicts in `metadataArea.ts` (main's `studioAddress` imports kept, this branch's `~org` import added) and `StudioDesignSurface.tsx` (header pillar nav stays removed; main's other `studioAddress` edits kept). `studioAddress.guard.test.ts` red at c840fdd (`Tests 1 failed | 1 passed (2)`, offender `studioMenuModel.ts:173`), green after the repoint; 20 touched/related files `Tests 166 passed (166)`; card 2,364 changed lines (+1774/−590, 37 files). </details> ## Acceptance notes - Screenshots below are the real console (`ui/apps/console` dev server, this branch) against a running server: a self-built app (created through the Studio landing's New app, `com.default.field-service`) on the showcase example server, and HotCRM (its own repo at main, `app.objectstack.hotcrm`) on its published 18.6.0 server. On HotCRM the Data pillar's rail shows "Couldn't read customizations": that is this branch's console against an older published server, not the menu. - Readings from the same runs: no `studio-pillar-nav` on the page; six groups in order; the Object entry current on the Data pillar; after collapse `data-state=collapsed`, the cookie `studio_menu_state=false` and no `sidebar_state`, still collapsed after a reload; at 390 px no docked menu until the toggle, then a 288 px drawer at the left edge. - Overlap check (`overlap-check.mjs`, final head): merges cleanly with main; textual conflicts with objectstack-ai#36973, objectstack-ai#36958 and objectstack-ai#36784 in `StudioDesignSurface.tsx` (and `metadataArea.ts` with objectstack-ai#36973), all in the header region this card replaces. Their code is not reshaped here. ### Wide (self-built app)  ### Collapsed (self-built app)  ### Narrow, 390 px drawer (self-built app)  ### Wide (HotCRM)  ### Collapsed (HotCRM)  ### Narrow, 390 px drawer (HotCRM)  ## Verification Read first, by risk: 1. `ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx`: the header and body row (menu mounted inside the provider), the `~all` branch, and the re-entry remount (`reenterPillar` plus its layout effect). 2. `ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts`: what each scope lists and where each entry goes; `studioMenuCurrentKey`. 3. `ui/packages/components/src/ui/sidebar.tsx` with `ui/scripts/shadcn-local-patches.mjs`: the `cookieName` prop and its declared patch. Two-minute check: open `/studio/PKG/data` for any package, click the toggle at the top-left, reload. Expected: the left menu stays hidden after the reload, and the app sidebar elsewhere in the console keeps its own state. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- signed: repo:objectstack#3 · os-support-ai · session_01WGufziBCAytAzzCu3iPBFR --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…I draft gets the designers' notice and discard (objectstack-ai#37026) <!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBTuMGhLAZx29zwDrayDGZZF)_ Fixes objectstack-ai#36902 Clause-②: yes (widening) Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:管理员在 Studio 的通用详情页(钩子、选项集、视图等)改完点「保存」,改动立刻生效;不再有自动保存开关,也不用再点一次「发布」。 - 为什么做:Studio 重构专题里「通用详情保存即生效」这一项,让通用详情和各个设计器的保存方式一致。 - 出错会怎样:发布被拒时,页面上方写明原因,什么都不生效,页面上的修改保留可以再存;AI 留下的草稿保留并有提示,可以一键放弃;本改动可以直接撤回。 - 要你做什么:无 ## What changes Studio's generic item page (`ResourceEditPage`, every type without its own designer: hook, picklist, view, page, app, doc…) now saves the way the designers do (objectstack-ai#36511, epic decisions 1, 12, 14). 1. **Save = draft + this one item's publish.** Save writes the draft (`PUT /meta/:type/:name?mode=draft`, If-Match / If-None-Match pin and conflict dialog unchanged), then publishes that one item (`POST /meta/:type/:name/publish`) at the same `?package=` and bundle `member`. The publish is pinned to the published version the page loaded, through the existing `DraftSaveGuard.publish` (objectstack-ai#36601), so a Save over a row another editor published since opens the same conflict dialog (reload, overwrite, keep editing). The auto-save switch, its 1.5 s debounce and the `metadata-admin:autosave` browser setting are gone; the header's Publish and discard-draft buttons are gone. 2. **Create publishes after its first save** (If-None-Match `*`, then the publish). 3. **AI draft** (`draftChanges[].by` is `copilot` or `mcp`): the page shows the AI's version under the designers' `StudioAiDraftNotice`; a person's Save makes it live together with their edits; "Discard the AI's changes" drops that one item's draft at its package and member, and asks first (in the page's own dialog, objectui#13333) when the page holds unsaved edits. 4. **A person's pending draft** from before this change is marked "This item has unpublished changes" with its own Publish (pinned) and Discard for that one item. 5. **Leave guard**: ×, ‹ ›, the side menu, in-app links, reload and close ask first when the page holds unsaved edits; browser Back is not intercepted (decision 12). The seam was already in place (`chrome/unsavedEdits.ts`); this PR pins it on this page. 6. **A refused publish** shows its reason above the editor in the designers' words (`publishRefusal`, server text under Details). Nothing goes live; the draft the Save wrote is taken back when no draft was pending before, and the edits stay on the page, unsaved. A draft that was pending before (the AI's or a person's) is kept. 7. **`@object-ui/data-objectstack`: `MetadataClient.layered()` now forwards `overlayVersion`.** The client rebuilt its answer field by field and dropped it, so a publish pin read off `layered()` was always `null`. This is why the Save's publish could not be pinned; it also made the object page's objectstack-ai#36601 publish pin a no-op on a server that serves the field. Fixed in place (bounded fix: same defect class as the card's pin, mechanical, the file had no other claim, no new gate surface) and pinned in `metadata-client.layeredDraft-29793.test.ts`. **Clause-② yes (widening):** the published package's exported `MetadataLayered` type gains the optional member `overlayVersion?: string | null` (claim amendment on objectstack-ai#36902, 7137741670; L1-b (3) S1, 7137721696). New shared piece: `detailSaveAtOnce.ts` (`publishDetailSave`, `isAiDraft`). The designers' `publishSavedItem` (`studioSaveBar.tsx`) names no bundle member, so this page carries its own instead of changing that file. `StudioDesignSurface.tsx`, `DraftConflictDialog.tsx` and `studioSaveBar.tsx` are unchanged (reused as they are). ### How this relates to objectstack-ai#36726 and objectstack-ai#36350 - **objectstack-ai#36726** (open PR objectstack-ai#36958 pins the designers' publish): no shared files, either PR can land first. This card pins the generic page's own publish with the same objectstack-ai#36601 `DraftSaveGuard` API, used as it is on main. The `overlayVersion` client fix (item 7) is what makes a pin read off `layered()` effective at all, the object page's included. One sequencing item: objectstack-ai#36958 adds rule 9 to the guard (a reload over a draft that was pending before the Save keeps the conflict's pin until the author re-confirms), answered by a `beforeReload` that returns `'kept'`. On main that callback is typed to resolve to nothing (a void promise) and refuses that answer (tsc TS2345, measured), so it cannot be written here without editing `DraftConflictDialog.tsx`, which this card must not touch. Today this page is at parity with main's guard. Whichever PR lands second adds the one-line `beforeReload` for the `hadDraft` case in `publishDetailSave`. - **objectstack-ai#36350** (view-draft publish takes a draft-version precondition): left to objectstack-ai#36350. That is a change to the publish door (server / protocol), outside this card's boundary (Metadata-protocol: none). This page's publish is pinned on the published version, not on the draft version, so the window objectstack-ai#36350 describes (another writer's draft write between this Save's draft save and its publish, then published by this Save) is still open for views until objectstack-ai#36350 lands. When it does, the Save's publish can send the draft version it just received; the call site is `publishDetailSave`. ### Read first (by risk) 1. `ResourceEditPage.tsx` `doSave`: the draft save → `publishDetailSave` → refresh sequence, and the refused branch (take-back only when `hadDraft` is false). 2. `detailSaveAtOnce.ts`: the take-back on a refused or conflicted publish. 3. `metadata-client.ts` `layered()`: the two `overlayVersion` forwards. ### Two-minute check Open Studio → All metadata → any view, change its label, press Save. Expected: one `PUT …?mode=draft` and one `POST …/publish` in the network panel, the Unsaved chip clears, no "unpublished changes" line, and `GET /api/v1/meta/view/NAME` already serves the new label. ## Tests ### Acceptance run (the card's 验收 scenario, real browser, self-built stack) Backend `examples/app-showcase` (`objectstack dev --seed-admin --fresh`) and the console dev server, both built from this branch, on per-agent ports. The items are my own, authored into the showcase's customization package (`com.example.showcase.custom`): a hook, a shared option set (picklist) and two views. The backend ran with `OS_METADATA_WRITABLE=picklist`: the picklist type is not runtime-creatable by default (`NOT_CREATABLE`, its registry entry), so the option-set leg needs that operator setting. Each leg edits the label and presses Save once; the network log is the page's own requests. | Item | Before Save | Writes after Save | Live read after Save | |---|---|---|---| | hook `s36902_stamp_title` | chip `unsaved`, no request in 2.5 s | `PUT …?mode=draft&package=…custom` then `POST …/publish?package=…custom` (200) | new label served; no unpublished-changes line | | picklist `s36902_priority` | same | same pair (200) | same | | view `showcase_task.s36902_triage` | same | same pair (200) | same | <details><summary>Screenshots: hook, option set, view (unsaved, then saved and live)</summary>       </details> **AI draft.** Written through the real MCP door, not faked: an OAuth client (dynamic registration, PKCE, consent, `metadata:write`) called `save_metadata_draft` on `showcase_task.s36902_ai`; the draft read then carried `draftChanges: [{path: ["label"], by: "mcp", …}]`. - The page shows the AI's version under the notice (4). An edit then "Discard the AI's changes" asks in the page's own dialog (5); confirming sends one `DELETE …?state=draft&package=…custom`, the draft read answers 404 and the live version is back (6). - A second MCP draft, then an edit and Save: `PUT` draft + `POST …/publish` (200), the draft read answers 404, the live label is the AI's change plus the person's edit (7). - Leave guard: with an unsaved edit, × asked "You have unsaved changes. Leave this page anyway?", and Cancel stayed on the item. <details><summary>Screenshots: AI draft notice, discard, save</summary>     </details> Images: orphan branch `claude/issue-36902-screenshots` at `566b916`. ### Live e2e `LIVE_APP_URL=… LIVE_API_URL=… pnpm exec playwright test -c playwright.live.config.ts e2e/live/studio-detail-save-at-once.spec.ts e2e/live/studio-editor.spec.ts`: 3 passed (the new spec: no auto-save in 2.5 s, × asks, Save sends exactly `PUT` + `POST …/publish`, the live page has the added block, the draft read is 404, browser Back is not intercepted; `studio-editor.spec.ts`'s Add-block round trip now reads the published item after Save). ### Unit At head `09693db5c`, under the shared verify lock, one run: every test file under `metadata-admin/` plus every other ui test file that mentions publish, draft, auto-save or the detail page (338 files), then `type-check` (which compiles the test files too) of `@object-ui/data-objectstack`, `@object-ui/i18n` and `@object-ui/app-shell`. <details><summary>Readings</summary> ```text Test Files 338 passed (338) Tests 2918 passed (2918) packages/data-objectstack type-check: Done packages/i18n type-check: Done packages/app-shell type-check: Done os-verify-lock: VERDICT command-exit 0 ``` New: `ResourceEditPage.saveAtOnce-36902.test.tsx` (19 cases over the real `MetadataClient` and an in-memory server that honours If-Match / If-None-Match on the draft door and on the publish door: items 1–6, the leave guard on ×, ‹ ›, links, beforeunload, Back unguarded, create publishes, refused create). `metadata-client.layeredDraft-29793.test.ts` gains the `overlayVersion` forward on both answer shapes (served value, served null, absent). </details> ## Acceptance notes - 'Changes 1' in shots 1–3 is the AI draft of `showcase_task.s36902_ai`, written through MCP before the save leg for shots 4–7; it clears in shot 6 once that draft is discarded (not the hook: its Save sent `PUT ?mode=draft` then `POST /publish` 200). - Existing detail-page suites that waited out the auto-save or clicked the header's Publish / Discard draft now press Save and read the Save's own publish, or use the unpublished-changes line's buttons (14 files). Their doubles gained a publish that drains the draft, as the real door does; assertions that only held because a draft stayed pending after Save were rewritten to the live result. `layersUnsaved-11799`'s SAVE case now expects one `/layers` re-read: a Save publishes, so the item has a layer afterwards. - Leftover `localStorage.setItem('metadata-admin:autosave', '0')` lines in suites this PR does not otherwise touch are now no-ops; left as they are to keep the diff to the card. - The platform checklist step that says the ResourceEditPage draft auto-saves and is then published (`docs/qa/platform-checklist/areas/studio-authoring.json`, the page Add-block item) is now stale. carrier: objectstack-ai#36910 (the epic's checklist-and-docs card). - The designers' own auto-save (Data / Automations / Access pillars) is unchanged: out of this card. ## Verification <details><summary>Local gates (derived for this diff) and reconciliation</summary> - `node scripts/pm/dispatch-gates.mjs --commands`: 39 families. All 39 run locally: 38 exit 0 (`check:*` and the node scripts, re-run after the last code commit), and `pnpm --dir ui exec vitest run scripts/` under the lock at `c8a49c900` (the one later commit changes only a live e2e spec): `Test Files 172 passed | 2 skipped (174)`, VERDICT command-exit 0. - `node scripts/pm/dispatch-gates.mjs --ran FILE` (each line with its exit code): `39 derived famil(ies) accounted for — 39 run, 0 NOT-MEASURED (a DERIVED zero)`. - `node scripts/check-test-source-alias.mjs`: OK, 34 changed test files judged (the touched suites now load `@objectstack/lint` at collection, as the gate asks). - `node scripts/pm/overlap-check.mjs` before every push: `VERDICT clean exit 0` (shares only the i18n catalogues and `metadata-client.ts` with objectstack-ai#36983, objectstack-ai#36985, objectstack-ai#36784; each merges cleanly). - The rest of the farm (lint, the CI test shards, `test:repo`) is CI's; its check-runs are read on the PR. </details> Changed lines: 1,650 over 24 files (1,317 added, 333 removed), one PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- signed: repo:objectstack#3 · os-support-ai · session_01WGufziBCAytAzzCu3iPBFR --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Fixes #36726
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Each Studio editor that saves by "write the draft, then publish that one item" now pins its publish to the published row it was loaded at, the way the object page does since #36720. The server half (If-Match / If-None-Match on publish,
overlayVersionon/layers) is already on main.Per-site verdicts (line numbers at the dispatch base 844218f):
StudioDesignSurface.tsx:6884object extension Save/layersat the pair BEFORE the draft and body reads (version first, the server's own order), records it withrecordPublished, and the Save passes the guard'spublish. A buffer read at another package recordsIf-None-Match: *at the pair.:8913new flow createIf-None-Match: *through a newpublishCreatedhelper: a same-named flow another writer published first is refused, never replaced. No dialog: the refusal is the create's own.:9095flow Save/layersread is shared with the baseline read when they hit the same address. Customize-into-pair branch records*at the pair.:9240flow on/off switchobjectHooksBuffer.ts:365hook Save/layersat the package; a published hook with no pending draft is buffered from that same answer when it pins, so pin and body are one read. A new hook records*.pairObjectActions.ts:404pair action Save/layersanswer the buffer is already built from. A new row records*.Every editor handles the
reloadedoutcome the way the object page does (ruling 4): the Save is declined, the editor re-reads, its edits are dropped. Keep editing leaves the edits unsaved with the refusal shown. Dialog wording and locale keys from #36601 are reused unchanged; no new keys.The
hadDraftreload residual (scope addition 7104420437)Fix shape chosen: keep the published pin the conflict was raised on until the author re-confirms, in the guard (
DraftConflictDialog.tsx, header rule 9). Why this one rather than "install the live row and leave the pending draft under Changes":Mechanics:
beforeReloadnow answerskeptwhen the Save wrote into a draft that was pending before it (discardedotherwise). Onkept, the reload's freshrecordPublishedis parked instead of applied, and the next publish still carries the version the conflict was raised on, so the next Save is asked again. The hold ends on an overwrite, a publish that lands, a load that reads no pending draft (recordReadwith*), orforget.Tests
New files, each named for this card (keep editing, reload, overwrite, one editor's pins chain, create asserts
*, unpinned control, plus the residual pin):ObjectHooksPanel.publishPinned-36726.test.tsx(7)DataPillar.pairActionsPublishPinned-36726.test.tsx(7)AutomationsPillar.publishPinned-36726.test.tsx(incl. the switch)DataPillar.extensionPublishPinned-36726.test.tsxAppended: the guard's rule 9 unit tests in
DraftConflictDialog.test.tsx; the object page's residual pin inStudioDesignSurface.draftVersionConflict-11773.test.tsx(AGENTS.md puts a new pin in the existing harness that already models that surface; the dispatch asked for new files; I followed AGENTS.md for those two and say so here).Stale fixtures updated (the create/pair publish now asserts
*):DataPillar.pairActions-30088,AutomationsPillar.saveCancel-36511,AutomationsPillar.customizeFlow-28570;StudioDesignSurface.expectedMisses-11799(an unsaved flow now reads/layersonce, for its pin).Ablation (implementation files restored to origin/main d9c799c, tests kept; restored by
git checkout HEAD,git diff HEADempty, all five blob hashes re-matched): 31 of 78 tests red across all 6 files, every red is a race or residual pin, no control among them; 47 green including each file's control.Acceptance notes
/layersanswer when it pins (exact pairing), from the list otherwise.PackageOwdOverviewPanel.tsx:487), object create (StudioDesignSurface.tsx~6697), permission Save (~10962), new app door (newAppDoor.ts:72).Verification
Two minutes:
pnpm --dir ui exec vitest run --maxWorkers=2 packages/app-shell/src/views/studio-design/ObjectHooksPanel.publishPinned-36726.test.tsxexpect 7 passed.Read first, by risk:
DraftConflictDialog.tsx(rule 9 hold and release),objectHooksBuffer.ts(per-hook/layersread and the buffer source),StudioDesignSurface.tsxflow load (shared/layersread and baseline).Local readings at head 0b5e8f2: app-shell
type-checkexit 0 (both tsconfigs); 6 card files 78/78 (per-file reruns after the last harness fix);studio-design/+ guard tests 374 files, 1 stale fixture red (28570) then fixed and rerun 14/14; deriveddispatch-gates --commandsfamilies exit 0 (two long scans rerun with a longer timeout, exit 0);check:nul-bytesOK.test:repoand the full farm are CI's.Generated by Claude Code