Skip to content

feat(studio): the generic item page's Save takes effect at once; an AI draft gets the designers' notice and discard - #37026

Merged
objectstack-fleet[bot] merged 10 commits into
mainfrom
claude/issue-36902-detail-save-at-once
Nov 24, 2026
Merged

objectstack-fleet[bot] merged 10 commits into
mainfrom
claude/issue-36902-detail-save-at-once

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread
Fixes #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 (#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 (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), 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 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 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 Studio 重构(2-2):通用详情改成保存即生效,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 #36726 and #36350

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
Screenshots: hook, option set, view (unsaved, then saved and live)

hook, unsaved
hook, saved and live
option set, unsaved
option set, saved and live
view, unsaved
view, saved and live

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.
Screenshots: AI draft notice, discard, save

AI draft notice
discard asks first with unsaved edits
AI draft discarded, live version back
AI draft saved live with the person edit

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.

Readings
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).

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: Studio 重构(4-2):新形态的端到端测试、总走查,更新平台测试清单、文档和技能里的 Studio 地址与说法 #36910 (the epic's checklist-and-docs card).

  • The designers' own auto-save (Data / Automations / Access pillars) is unchanged: out of this card.

Verification

Local gates (derived for this diff) and reconciliation

Changed lines: 1,650 over 24 files (1,317 added, 333 removed), one PR.

🤖 Generated with Claude Code

Save writes the item's draft, then publishes that one item, pinned to
the published version the page loaded. The auto-save switch is gone.
An AI-written draft shows the designers' notice and its discard; a
person's pending draft is marked as unpublished changes with its own
Publish and Discard. A refused publish shows its reason.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufziBCAytAzzCu3iPBFR
The client rebuilt the layered answer field by field and dropped
overlayVersion, so a Studio Save's pinned publish never had a pin.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufziBCAytAzzCu3iPBFR
…gle-item publish

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufziBCAytAzzCu3iPBFR
The detail page asks every confirmation in its in-app dialog, never the
browser's confirm(). The touched test files pay the lint module's first
load at collection.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufziBCAytAzzCu3iPBFR
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzhjqviExWpzQMm57Mt

席位核对 — REWORK · repo:objectstack#3 · head 09693db · 2026-11-24T16:28Z

L1: REWORK
Head-sha: 09693db5c2212b0f86d54427ea2fbd8c828ca617
Reviewer: L1-b (3) (seat 3, area ux-E).
Tier: not Tier H. This is card #36902's only PR: 24 files, +1317/−333 (1,650 lines, under the 3,000-line per-card line). Not governed.

Read

Checklist

Findings

No must-fix.

Delta read owed: L1 on the new head plus a TIER_DEFAULT L2 (S1).

The published MetadataLayered type gains an optional overlayVersion member.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufziBCAytAzzCu3iPBFR
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzhjqviExWpzQMm57Mt

Contract-review-claim: session_01WGufzhjqviExWpzQMm57Mt · head f8e4b50 · 2026-11-24T16:32Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzhjqviExWpzQMm57Mt

Contract review

Served-tier: TIER_DEFAULT
Head-sha: f8e4b50162a1bdfb8e45f58893a8d28b5e33bc42
Local-runs: none

This is the declaration face. The review is owed by the Clause-②: yes (widening) line alone: the PR's 24 committed paths hold no published schema, no governed path and no narrowing. Claim 7137838833.

Inputs read:

  • Card Studio 重构(2-2):通用详情改成保存即生效,AI 草稿照设计器的规则提示和放弃;离开时拦未保存(浏览器后退除外) #36902, claim 7133542157 and amendment 7137741670. readClause2Line on 7137741670 gives declared · yes · widening (line Clause-②: yes (widening) (was no)). The amendment adds ui/packages/data-objectstack/src/metadata-client.ts and its test to the file surface.
  • Dev report 7137086408, and the PR body (line 5: Clause-②: yes (widening); item 7 names the widening).
  • The net diff against merge base c75453e2, and git diff 09693db5 f8e4b501: the changeset's declaration line and its data-objectstack sentence only. Every code file is byte-identical to the head L1 read in 7137721696.
  • Check-runs: green on 09693db5 (45 success, 13 expected skip, 0 failed). On this head they are still running, and the L1 ACCEPT waits for them.

Nothing was built, run or re-run.

① Derived judgments

② Semver level

③ Boundary flags

Implemented-by: claude/issue-36902-detail-save-at-once
Reviewed-by: session_01WGufzhjqviExWpzQMm57Mt

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzhjqviExWpzQMm57Mt

席位核对 — ACCEPT · repo:objectstack#3 · head f8e4b50 · 2026-11-24T16:54Z

L1: ACCEPT
Head-sha: f8e4b50162a1bdfb8e45f58893a8d28b5e33bc42
Reviewer: L1-b (3) (seat 3, area ux-E). This is the delta read of REWORK 7137721696.
Tier: not Tier H. This is card #36902's only PR: 1,650 lines. Not governed.
Contract review: TIER_DEFAULT PASS on this head, 7137872253 (claim 7137838833).

Read

Findings

  • S1: closed. Clause-②: yes (widening) reads the same in the changeset, PR body line 5, and claim amendment 7137741670 (readClause2Line: declared · yes · widening). The amendment adds metadata-client.ts and its test to the file surface. The changeset now names the exported MetadataLayered type's optional overlayVersion member. Metadata-protocol: none and patch are kept. The owed TIER_DEFAULT L2 is 7137872253.
  • N1: closed. The body's Acceptance notes say the "Changes 1" in shots 1–3 is the run's AI draft of showcase_task.s36902_ai, which clears in shot 6.
  • N2: unchanged (the old pillar switcher in the shots, expected until feat(studio): a collapsible left menu of six groups replaces the top pillar nav #36985 lands).

Landable on full green. Sequencing stays as recorded: if #36958 lands first, this PR adds the beforeReload 'kept' line in publishDetailSave before landing; if this lands first, #36958 adds it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzhjqviExWpzQMm57Mt

Contract-review-claim: session_01WGufzhjqviExWpzQMm57Mt · head 8a036c9 · 2026-11-24T17:25Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzhjqviExWpzQMm57Mt

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 8a036c91012fe78d92d0998aaeba1457c7a76dd9
Local-runs: none

This is the declaration face. The review is owed by the Clause-②: yes (widening) line alone: the PR's 24 committed paths hold no published schema, no governed path and no narrowing. Claim 7139188418. This is the fresh record after the merge-main round (landing rule ①); the record on f8e4b501 was 7137872253.

Inputs read:

  • Card Studio 重构(2-2):通用详情改成保存即生效,AI 草稿照设计器的规则提示和放弃;离开时拦未保存(浏览器后退除外) #36902, claim 7133542157 and amendment 7137741670. readClause2Line on 7137741670 gives declared · yes · widening (line Clause-②: yes (widening) (was no)). The amendment adds ui/packages/data-objectstack/src/metadata-client.ts and its test to the file surface.
  • Dev report 7137086408, and the PR body (line 5: Clause-②: yes (widening); item 7 names the widening).
  • The merge, 8a036c91. Its parents are f8e4b501 (the head PASSed in 7137872253) and bfd1049f (main, 17 commits after c75453e2). The sorted changed lines of git diff c75453e2 f8e4b501 and of git diff bfd1049f 8a036c91 are both 1,650 lines and identical, line for line. So the merge carries the branch over unchanged. In metadata-client.ts, main's changedAt work and this PR's overlayVersion forward sit side by side, and the PR's own diff there is the same two forwards and the interface member.
  • Check-runs on 8a036c91: still running, and the L1 ACCEPT waits for them. f8e4b501 was green (47 success, 15 expected skip, 0 failed).

Nothing was built, run or re-run.

① Derived judgments

② Semver level

③ Boundary flags

Implemented-by: claude/issue-36902-detail-save-at-once
Reviewed-by: session_01WGufzhjqviExWpzQMm57Mt

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzhjqviExWpzQMm57Mt

席位核对 — ACCEPT · repo:objectstack#3 · head 8a036c9 · 2026-11-24T17:47Z

L1: ACCEPT
Head-sha: 8a036c91012fe78d92d0998aaeba1457c7a76dd9
Reviewer: L1-b (3) (seat 3, area ux-E). This is the merge-main round read. The last ACCEPT was 7138410788 on f8e4b501.
Tier: not Tier H. This is card #36902's only PR: 1,650 lines. Not governed.
Contract review: a fresh TIER_DEFAULT PASS on this head, 7139209286 (claim 7139188418), per landing rule ①.

Read

  • The merge, 8a036c91. Its parents are f8e4b501 and bfd1049f (main, 17 commits after the old base c75453e2). The hand-off named 5ff858b7 as the merged main; the commit's own second parent is bfd1049f, so that is what I read. I sorted the changed lines of git diff c75453e2 f8e4b501 and of git diff bfd1049f 8a036c91. Both are 1,650 lines and identical, so the merge carries the branch over unchanged, with no conflict resolution in the PR's own lines. metadata-client.ts keeps main's changedAt work beside this PR's overlayVersion forward. The studio en/zh catalogues differ from main only by this PR's two added and three removed keys.
  • Check-runs on 8a036c91: 45 success, 13 expected skip, 0 failed, 0 pending. Mergeable clean.

Findings

No must-fix, no should-fix. S1 and N1 stay closed (7138410788). N2 is unchanged.

Landable on full green. #36958 has not merged, so the beforeReload 'kept' line stays with whichever of the two lands second.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufziBCAytAzzCu3iPBFR

Landing · 2026-11-24T17:48Z · ACCEPT 7139710251 at head 8a036c9

reading value
check-governed-merges.mjs --pr 37026 NOT governed · +1317/−333 (1,650 ≤ 3000; card total 1,650, one PR)
landing-k.mjs --pr 37026 CAN'T ANSWER on the earlier head (UI-only, no Test Core planner). K read via merge-base: base bfd1049 (the merge-main round), main ahead by 4. Their file sets meet this PR's only on the studio en/zh catalogues (key additions on both sides; the merge queue re-tests the merged tree). K = 4 < 15. Before the merge round K was 17, which is why main was merged first
contract review Clause-②: yes (widening) (claim amendment 7137741670) · TIER_DEFAULT L2 PASS on this head 7139209286 (claim 7139188418); earlier records 7137872253 at f8e4b50
L1 REWORK 7137721696 → ACCEPT 7138410788 (f8e4b50) → merge-round ACCEPT 7139710251 (8a036c9)
checks at 8a036c9 45 success, 13 expected skip, 0 failed, 0 pending; mergeable clean

Open findings are nits only:

Sequencing (seat note 7137138620 on #36958): #36958 has not merged, so it is the second lander and adds the one-line beforeReload 'kept' for the hadDraft case in publishDetailSave.

State: ready + auto-merge (Tier S). On MERGED, #36902 closes by Fixes, and area ux-E removes pm:dispatched.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 24, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants