Repository navigation
feat(studio): the generic item page's Save takes effect at once; an AI draft gets the designers' notice and discard - #37026
Conversation
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
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
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziBCAytAzzCu3iPBFR
…uto-save 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
… row Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziBCAytAzzCu3iPBFR
|
repo:objectstack#3 · os-support-ai · session_01WGufzhjqviExWpzQMm57Mt 席位核对 — REWORK · repo:objectstack#3 · head 09693db · 2026-11-24T16:28ZL1: REWORK Read
Checklist
FindingsNo must-fix.
Delta read owed: L1 on the new head plus a |
The published MetadataLayered type gains an optional overlayVersion member. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziBCAytAzzCu3iPBFR
|
repo:objectstack#3 · os-support-ai · session_01WGufzhjqviExWpzQMm57Mt Contract-review-claim: session_01WGufzhjqviExWpzQMm57Mt · head f8e4b50 · 2026-11-24T16:32Z |
|
repo:objectstack#3 · os-support-ai · session_01WGufzhjqviExWpzQMm57Mt Contract reviewServed-tier: This is the declaration face. The review is owed by the Inputs read:
Nothing was built, run or re-run. ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufzhjqviExWpzQMm57Mt 席位核对 — ACCEPT · repo:objectstack#3 · head f8e4b50 · 2026-11-24T16:54ZL1: ACCEPT Read
Findings
Landable on full green. Sequencing stays as recorded: if #36958 lands first, this PR adds the |
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufziBCAytAzzCu3iPBFR
|
repo:objectstack#3 · os-support-ai · session_01WGufzhjqviExWpzQMm57Mt Contract-review-claim: session_01WGufzhjqviExWpzQMm57Mt · head 8a036c9 · 2026-11-24T17:25Z |
|
repo:objectstack#3 · os-support-ai · session_01WGufzhjqviExWpzQMm57Mt Contract reviewServed-tier: This is the declaration face. The review is owed by the Inputs read:
Nothing was built, run or re-run. ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufzhjqviExWpzQMm57Mt 席位核对 — ACCEPT · repo:objectstack#3 · head 8a036c9 · 2026-11-24T17:47ZL1: ACCEPT Read
FindingsNo must-fix, no should-fix. S1 and N1 stay closed (7138410788). N2 is unchanged. Landable on full green. #36958 has not merged, so the |
|
repo:objectstack#3 · os-support-ai · session_01WGufziBCAytAzzCu3iPBFR Landing · 2026-11-24T17:48Z · ACCEPT 7139710251 at head 8a036c9
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 State: ready + auto-merge (Tier S). On MERGED, #36902 closes by |
Requested by Yibo Wang · project thread
Fixes #36902
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
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).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 bundlemember. The publish is pinned to the published version the page loaded, through the existingDraftSaveGuard.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 themetadata-admin:autosavebrowser setting are gone; the header's Publish and discard-draft buttons are gone.*, then the publish).draftChanges[].byiscopilotormcp): 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.chrome/unsavedEdits.ts); this PR pins it on this page.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.@object-ui/data-objectstack:MetadataClient.layered()now forwardsoverlayVersion. The client rebuilt its answer field by field and dropped it, so a publish pin read offlayered()was alwaysnull. 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 inmetadata-client.layeredDraft-29793.test.ts. Clause-② yes (widening): the published package's exportedMetadataLayeredtype gains the optional memberoverlayVersion?: 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.tsxandstudioSaveBar.tsxare unchanged (reused as they are).How this relates to #36726 and #36350
DraftSaveGuardAPI, used as it is on main. TheoverlayVersionclient fix (item 7) is what makes a pin read offlayered()effective at all, the object page's included. One sequencing item: fix(studio): pin the object extension, hook, action and flow Saves' publish (#36726) #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 abeforeReloadthat 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 editingDraftConflictDialog.tsx, which this card must not touch. Today this page is at parity with main's guard. Whichever PR lands second adds the one-linebeforeReloadfor thehadDraftcase inpublishDetailSave.publishDetailSave.Read first (by risk)
ResourceEditPage.tsxdoSave: the draft save →publishDetailSave→ refresh sequence, and the refused branch (take-back only whenhadDraftis false).detailSaveAtOnce.ts: the take-back on a refused or conflicted publish.metadata-client.tslayered(): the twooverlayVersionforwards.Two-minute check
Open Studio → All metadata → any view, change its label, press Save. Expected: one
PUT …?mode=draftand onePOST …/publishin the network panel, the Unsaved chip clears, no "unpublished changes" line, andGET /api/v1/meta/view/NAMEalready 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 withOS_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.s36902_stamp_titleunsaved, no request in 2.5 sPUT …?mode=draft&package=…customthenPOST …/publish?package=…custom(200)s36902_priorityshowcase_task.s36902_triageScreenshots: hook, option set, view (unsaved, then saved and live)
AI draft. Written through the real MCP door, not faked: an OAuth client (dynamic registration, PKCE, consent,
metadata:write) calledsave_metadata_draftonshowcase_task.s36902_ai; the draft read then carrieddraftChanges: [{path: ["label"], by: "mcp", …}].DELETE …?state=draft&package=…custom, the draft read answers 404 and the live version is back (6).PUTdraft +POST …/publish(200), the draft read answers 404, the live label is the AI's change plus the person's edit (7).Screenshots: AI draft notice, discard, save
Images: orphan branch
claude/issue-36902-screenshotsat566b916.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 exactlyPUT+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 undermetadata-admin/plus every other ui test file that mentions publish, draft, auto-save or the detail page (338 files), thentype-check(which compiles the test files too) of@object-ui/data-objectstack,@object-ui/i18nand@object-ui/app-shell.Readings
New:
ResourceEditPage.saveAtOnce-36902.test.tsx(19 cases over the realMetadataClientand 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.tsgains theoverlayVersionforward 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 sentPUT ?mode=draftthenPOST /publish200).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/layersre-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
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), andpnpm --dir ui exec vitest run scripts/under the lock atc8a49c900(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/lintat collection, as the gate asks).node scripts/pm/overlap-check.mjsbefore every push:VERDICT clean exit 0(shares only the i18n catalogues andmetadata-client.tswith feat(app-shell): metadata list 修改时间 column and unpublished-changes mark (objectstack#36898) #36983, feat(studio): a collapsible left menu of six groups replaces the top pillar nav #36985, feat(studio): design an object's public forms in Studio's Form tab #36784; each merges cleanly).test:repo) is CI's; its check-runs are read on the PR.Changed lines: 1,650 over 24 files (1,317 added, 333 removed), one PR.
🤖 Generated with Claude Code