Skip to content

feat(studio): the object page saves with Cancel and Save in the top bar, live at once - #36597

Merged
objectstack-fleet[bot] merged 15 commits into
mainfrom
claude/issue-36511-studio-save-cancel
Nov 23, 2026
Merged

objectstack-fleet[bot] merged 15 commits into
mainfrom
claude/issue-36511-studio-save-cancel

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread
Part of #36511
Clause-②: no
Metadata-protocol: none

This is the first of three PRs for the card. It covers the object page. Still to come:

  • PR 2: flows, the enable switch, permissions, and the object page's hooks and an installed app's own actions.
  • PR 3: field layout, the AI-draft notice with its 「放弃 AI 的改动」 button, and the card's closing line.

维护者速读

  • 用户能看到什么变化:在 Studio 的对象页(字段、校验规则、动作、设置)改完后,顶栏右侧原来「发布」的位置出现「取消」「保存」。点保存后改动立刻生效,不再每隔一秒半自动存草稿。「变更」「发布」只在有待发布草稿时出现。
  • 为什么做:维护者裁定,人类改一项就确认一项、点保存直接生效。本单是「保存即生效」这一系列的第一步,先做对象页。
  • 出错会怎样:保存被服务器拒绝时,改动留在页面上,并写明原因;同一次保存里成功的项会被列出来。删掉或改类型已生效的字段前会先问一句。出问题可以直接撤回本单,回到原来的自动存草稿。
  • 要你做什么:无。两人同时改同一对象时后保存的人可能覆盖先生效的改动,这件事已交席位按决策卡流程处理。

What changes

Mechanism. A new top-bar coordinator in studioSaveBar.tsx does the following:

  • Editors register their buffers with useStudioSaveEntry.
  • The surface draws Cancel and Save at the right of the top bar, where Publish was, and only while a registered buffer is dirty. They are the column's last actions; only the right-slot icon follows them, as it followed Publish.
  • One Save sends every dirty buffer in order. A refused buffer does not stop the others.
  • When something is refused, the toast names each refused item with its reason, then lists the items that were saved.
  • If any buffer holds an edit it cannot send yet, Save refuses before anything is written.
  • Save first waits out the editors' expression check of the last keystroke. That is LINT_DEBOUNCE_MS, now in its own module celLintDebounce.ts (which CelPredicateField imports), plus 50 ms. Without the wait, a formula or rule guard typed and saved at once could be sent before its check had judged it (the objectui#4306 rule).

Save = draft + that item's publish. publishSavedItem calls MetadataClient.publish(type, name, { packageId }), which is POST /api/v1/meta/:type/:name/publish?package= at the package the draft was written to. It is never the package batch.

If the publish is refused:

  • The draft the Save wrote is discarded, unless a draft was already pending before the Save (a copilot's). A pending draft is kept: it now carries the page's edits too.
  • The edits stay on the page, unsaved, and the reason is shown in the refusal strip.

Editors moved to explicit save in this PR. All of them are on the object page, as one buffer with one Save:

  • Fields:
    • Add, from the Records grid's plus column and from the Form toolbar.
    • Edit in the field inspector.
    • Remove.
    • Column reorder. This is now a buffer edit, not a save of its own.
  • Validation rules.
  • The object's own actions.
  • Settings.
  • Field groups.
  • An installed app's object: base-field patches and added __c fields. These are saved into its .custom pair as an object_extension and published there, so they take effect at once.

Editors not changed here (they keep their draft autosave):

  • Hooks. The hooks buffer lives in ObjectHooksPanel and unmounts on a tab switch, so it has to be lifted into the pillar first.
  • An installed app's own actions in the pair (pairObjectActions).
  • List and form views, navigation, flows and permissions.

Top bar.

  • Changes and Publish are drawn only while drafts are pending. The "No drafts pending publish" disabled state is gone, because nothing is drawn in its place.
  • Publish refuses, with a toast, while the page holds edits Save has not sent: its re-read would drop them.
  • The surface's comment saying there is no per-item publish is corrected.

Confirmations. Save asks before it sends a change that removes or retypes a published field (objectSaveConfirm.ts). The field-remove dialog at edit time stays, and its body now says the field leaves once the change is saved and live. Studio has no delete-object affordance (measured: none in the Data pillar or its item tools), so no dialog was added for that.

Leaving. Opening another object with unsaved edits asks through confirmDropUnsavedWork. The switch sends nothing. The unsaved-edit registry the console's leave prompt reads now includes the Save bar's dirty state.

i18n (namespaces/studio, en + zh):

  • New keys: engine.studio.save.{save,saving,cancel,title,cancelTitle,done,refused,refusedLine,savedLine,itemSeparator,held,publishFirst,confirmIrreversible,confirmRemoveField,confirmRetypeField} and engine.studio.held.lineExplicit.
  • designer.field.removeConfirmBody is reworded.
  • Alternatives considered: engine.studio.saveBar.* and engine.studio.commit.*. The name save matches the button's word.

Tests

New files, named for this card:

  • DataPillar.saveCancel-36511.test.tsx. Covers:
    • Nothing is sent before Save. Save sends a PUT of the draft with ?package=, then a POST to publish with ?package=.
    • Cancel re-reads the object with no writes.
    • A refused publish discards the draft. A refusal strip appears, the edit is kept, and Save is still offered.
    • A held picklist blocks Save.
    • Removing a published field asks at Save. Declined, nothing is sent; accepted, PUT then publish.
  • studioSaveBar.partialSave-36511.test.tsx. Covers ordering, a partial refusal naming the item and its reason, the saved list, a held buffer, and Cancel.
  • StudioDesignSurface.saveBar-36511.test.tsx. Covers:
    • With no draft, the top bar has no Changes or Publish, and Cancel then Save are the last actions.
    • With a draft, the order is Changes, Publish, Cancel, Save, and Publish waits for Save.
  • __tests__/studioSaveHarness.tsx. A harness so a pillar mounted alone gets the same coordinator and buttons.

Retired, with the reason:

  • DataPillar.savedAtDisplayLocale-10232.test.tsx (3 tests). The "Saved HH:MM" hint they pinned is gone: there is no autosave left to time.
  • StudioDesignSurface.draftVersionConflict-11773, the case where two editors each load and save once with no draft pending. A Save now publishes, so no draft is left for the second editor's If-None-Match: * to collide with. See Acceptance notes.
  • StudioDesignSurface.publishReadOnlyReason-12303, the objectstack#31495 "nothing pending" block (3 tests). Replaced by one case: no Publish and no reason are drawn.
  • StudioDesignSurface.interfacePolish, "no draft: disabled Publish with visible reason". Replaced by: no Publish at all.

Rewritten to the new semantics. Each flipped pin asserts nothing sent before Save, then the draft write and the item's publish after Save, or that Cancel or a declined question leaves the page as it was:

  • DataPillar, Save-gate suites: celGate, panelGate, panelHold-27629, heldIncomplete-11786, choiceWithoutOptions-11253, summaryHeld-27461, authorRefusal-11785, actionRefusal-26736, showMeFocus-26730, picklistServedOptions-10202.
  • DataPillar, other suites:
    • hiddenSystemFields-11780, recordsTab-34794, addFieldPopover-12516, copilotDraftMarks-12725.
    • destructiveChange-34931, draftSavedNamed-28984 (the toast is now "Saved, live now: Task" under one sonner id), draftUnreadable-29148.
    • authoredBuffer-29793, pairActions-30088 (only its writable control), baseObjectExtension-28575 (its double now publishes the pair's extension).
    • validationVerdictHold-27644 (its double's publish refuses the guard the door refuses), railSwitchFlush-27511 (the switch asks and sends nothing; a saved edit leaves nothing to ask about).
  • StudioDesignSurface suites: autosaveInFlight-11204 (Data block: an edit taken during a Save is the next Save's), autosaveSwitch-11232 (Data cases), draftVersionConflict-11773 (the race over a pending draft is refused, with reload and overwrite), customizePublish-28562, narrowHeader-12509, packageListErrorPosture, publishPosture-12517.
  • DataPillar.internalFormRetired-36425, added on main by feat(console)!: record create and edit stop loading internal forms; a field's Show on create switch #36543 while this branch was open, now presses Save before its two Add group saves. DataPillar.formViewLayout-30057 was deleted on main by that PR, and its one Data-page edit went with it.
  • 17 edited suites gained a module-top import '@objectstack/lint', as check:test-source-alias asks of an edited file that reaches the linter.
Studio-design suite after the last commit

Final head 1d6c0845, same tree as the run except the registry method rename, which the scripts run below covered.

cd ui && pnpm exec vitest run --maxWorkers=2 packages/app-shell/src/views/studio-design \
  (+ CelPredicateField, ObjectFieldInspector.celGate, ResourceEditPage.celGate,
     PermissionMatrixEditor.saveSurface-12725, i18n studio-namespace, studio-namespace-lazy)
 Test Files  359 passed (359)
      Tests  2774 passed (2774)

cd ui && pnpm exec vitest run --maxWorkers=2 scripts/ (+ the three new 36511 suites)
 Test Files  175 passed | 2 skipped (177)
      Tests  5138 passed | 2 skipped (5140)
os-verify-lock: VERDICT command-exit 0

Before the pins were rewritten, the same studio-design run read: 33 failed files and 89 failed tests out of 2733. Those are the pins this PR flips.

Type-check (both configs) and dependency build
pnpm --filter @object-ui/app-shell type-check   (tsc --noEmit && tsc -p tsconfig.test.json)
os-verify-lock: VERDICT command-exit 0 · held the lock 119s
pnpm --workspace-concurrency=2 --filter '@object-ui/app-shell^...' build (after merging origin/main)
os-verify-lock: VERDICT command-exit 0 · held the lock 433s
Gates (dispatch-gates --ran)

Head 1d6c0845. node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran FILE:

Run reconciliation — 39 derived, 39 run, 0 NOT-MEASURED, 0 UNRUN.
✓ dispatch-gates --ran: 39 derived famil(ies) accounted for — 39 run, 0 NOT-MEASURED
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-sdui-manifest.mjs :: exit 0
node scripts/check-sdui-manifest.mjs --self-test :: exit 0
node scripts/ci/snapshot-next.mjs --self-test :: exit 0
node scripts/pm/check-governed-queue-guard.mjs --self-test :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm --filter @objectstack/spec run check:error-code-provenance :: exit 0
pnpm check:adr-anchors :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:dispatcher-error-vocabulary :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:engine-double-contract :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:published-files :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0
pnpm --dir ui exec vitest run scripts/ :: exit 0

node scripts/check-nul-bytes.mjs: OK. node scripts/pm/overlap-check.mjs: VERDICT clean exit 0 (against #36580 and #36579, which share the studio namespace files).

Acceptance notes

  • Concurrent editors over a published object (seat ruling 7089589821 on Studio 里人工修改改成「保存」「取消」,保存后这一项立刻生效;不再自动存草稿,不用整包发布 #36511: accepted as a transitional window; the server guard is tracked on 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, not awaited here). The draft-version guard pins drafts only. After a Save publishes, no draft is left, so the second editor's next Save asserts no draft and succeeds over the first editor's live change. The server serves no published-layer version a save could pin. When a draft was pending at open, the race is still refused with the conflict dialog; that case is pinned in draftVersionConflict-11773. Until 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 lands, the second editor's Save overwrites the first editor's live change.
  • AI and a human on one item. While the page holds unsaved edits, the refresh pulse is held, so a copilot draft written meanwhile is not shown over them. Save is pinned to the draft read: if the copilot wrote a draft in between, the conflict dialog offers reload or overwrite, so neither side is lost silently. If the publish is refused, a pending copilot draft is kept and carries the page's edits.
  • A rule guard refused by the publish. The object publish locator does not place a validations.N.condition path, so the strip reads "Not published: the server refused this draft. Details say why." and the rule's reason is under Details. This is the locator's existing reach, not new here.
  • The served-verdict hold (objectstack#27644) still holds a rule whose stored draft the door refused, when that draft was pending at open. A Save the publish refuses now shows the reason at once instead of leaving a draft whose re-read holds the next edit.
  • Removing a published field asks twice: once in the remove dialog at edit time, and once at Save. The card names a confirmation for both removal and type changes. Folding them into one is a product call left to the card.
  • ADR sentences the new behaviour contradicts, for objectstack#36086:
    • ADR-0027 M2, "explicit, batched publish".
    • ADR-0037, "Publish remains the single commit gate".
    • The surface comment "There is no per-item publish". This one is corrected in code.
  • Not measured.
    • The single-item publish was not run against a live server in this run. The route POST /api/v1/meta/:type/:name/publish (publishMetaItem) and the existing caller saveAndPublishRuntimeMetadata are cited.
    • The full-farm CI families were not run locally (local scope rule).

Verification

Read first:

  1. ui/packages/app-shell/src/views/studio-design/studioSaveBar.tsx. The coordinator's held and settle check, and publishSavedItem's discard rule.
  2. StudioDesignSurface.tsx, the DataPillar doSave and doSaveExt hunk. Riskiest: the refused-publish restore of objStoredRef and hasDraft.
  3. DataPillar.saveCancel-36511.test.tsx.

Two-minute check: cd ui && pnpm exec vitest run packages/app-shell/src/views/studio-design/DataPillar.saveCancel-36511.test.tsx. Expected: 5 passed, including the case where nothing is sent before Save, then a PUT with mode=draft&package= followed by a POST to /publish?package=.

Session: https://claude.ai/code/session_01ADHkmPsv99YG2tCHoSe8Nb

🤖 Generated with Claude Code

…udio-save-cancel

# Conflicts:
#	ui/packages/app-shell/src/views/studio-design/DataPillar.formViewLayout-30057.test.tsx
#	ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx
…ounce in its own module

Claude-Session: https://claude.ai/code/session_01ADHkmPsv99YG2tCHoSe8Nb
Co-authored-by: Claude <noreply@anthropic.com>
…ve for the extension

The customize journey's extension step now asserts the new save: nothing
is written before the top bar's Save, which writes the extension's draft
into the pair and publishes that one item there, leaving no draft.

Claude-Session: https://claude.ai/code/session_01ADHkmPsv99YG2tCHoSe8Nb
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the tests label Nov 23, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmPsv99YG2tCHoSe8Nb

席位核对

ACCEPT — L1 (card thread for #36511, reporting to area s2-C) at head 0a019af0d730ef0552c3afe87da5c23a197378c4 · 2026-11-23T02:29Z

  • Shape: open draft to main; first line Part of #36511 (PR 1 of 3; the card stays open and keeps pm:dispatched until the closing PR); no closing keyword anywhere in the body. Clause-②: no · Metadata-protocol: none, same two lines in the changeset. Size 1903+847 = 2750 changed lines, 48 files (≤ 3000). No governed path; no packages/spec/**, no server path.
  • Premise measured: the save path is the existing per-item door. studioSaveBar.tsx publishSavedItem calls MetadataClient.publish(type, name, { packageId }) after the draft write; a refused publish discards the just-written draft only when no draft was pending before (a pending copilot draft is kept). Live E2E proves it end to end against a real server (below).
  • Gates at this head: check-runs 45 success · 13 expected skip · 0 failed · 0 pending (l1-face.mjs --pr 36597, read 2026-11-23T02:29Z), Lint & Repo Gates and TypeScript Type Check success. Dogfood not owed (no !, no narrowing arm). Gates-ran file /mnt/project-files/objectstack-seat2/36511-pr1-gates-ran.txt (39 derived, 39 run, 0 NOT-MEASURED, at 1d6c084).
  • Patch round 1d6c084 → 0a019af (CI red on the first head, both this PR's own consequence): Lint UI — seven rewritten DataPillar.*.test.tsx kept an unused act import, removed. Live E2E UI — rewritten test, not yet named in the PR body's list: ui/e2e/live/studio-customize-journey.spec.ts step 3 (Add region__c). It now asserts zero object_extension writes after Add with Save visible; after Save, a PUT draft (mode=draft, ?package= the pair) then POST /meta/object_extension/showcase_task/publish?package=PAIR that answers ok, Save gone, writes exactly ['PUT','POST'], and GET …?state=draft&package=PAIR answers 404 (no draft left). The step's former publishPair is removed; the later server, pair-read and export assertions are unchanged. Green on Live E2E UI at this head. Local readings for the patch: app-shell lint exit 0, tsc -p ui/tsconfig.e2e.json exit 0, the 7 suites 18/18 under the verify lock.
  • Flipped pins load-bearing: the rewritten autosave pins assert both halves of the ruled behaviour (nothing sent before Save; draft write then that item's publish after; Cancel restores). New suites DataPillar.saveCancel-36511, studioSaveBar.partialSave-36511, StudioDesignSurface.saveBar-36511. Retired pins are listed in the PR body with reasons.
  • Changeset read sentence by sentence (.changeset/36511-studio-save-cancel.md): each sentence matches the diff, including "Other Studio editors (flows, hooks, list and form views, navigation, permissions) keep their draft autosave for now" (they move in PR 2 and PR 3).
  • Accepted deviations: hooks and an installed app's own pair actions moved to PR 2 (the hooks buffer unmounts with its tab); metadata-admin/CelPredicateField.tsx imports LINT_DEBOUNCE_MS from the new celLintDebounce.ts (one-line move, so Save can wait out the lint). Studio has no delete-object affordance, so no dialog for it.
  • Two editors on one published object: seat ruling 7089589821 on Studio 里人工修改改成「保存」「取消」,保存后这一项立刻生效;不再自动存草稿,不用整包发布 #36511 — accepted as a transitional window, server guard on 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; the PR body says so. Save-time confirm for removing or retyping a published field kept, as the card asks. New i18n names engine.studio.save.* accepted by the seat (same ruling).
  • Out of scope, routed: ADR sentences the new behaviour contradicts — ADR-0027 M2 "explicit, batched publish" and ADR-0037 "Publish remains the single commit gate" — carrier: #36086, a row at landing. Acceptance note (not filed): the object publish locator places no validations.N.condition path, so a rule refused at publish shows its reason under Details only.
  • Landing: non-governed, ≤ 3000 lines; contract review not owed. Handed to the seat with PR number, full sha and this record id; this thread does not land.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmPsv99YG2tCHoSe8Nb

席位核对

ACCEPT — L1 delta at head 39ff80687df031df7dd61e9899f337cefb97bce4 · 2026-11-23T03:07Z (first read: comment 7089990378 at 0a019af0d730ef0552c3afe87da5c23a197378c4)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmQD4KwKe5BckFpeiuB

Landing · 2026-11-23T03:08Z · area s2-C lands this PR at head 39ff80687df031df7dd61e9899f337cefb97bce4.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 23, 2026 03:09
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit ed0edb1 Nov 23, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-36511-studio-save-cancel branch November 23, 2026 03:31
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
…custom package (objectstack-ai#36499, PR 2 of 2) (objectstack-ai#36624)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9Wq5utqEodnDCBh6heq37AG)_
Fixes objectstack-ai#36499

Clause-②: yes (widening)
Metadata-protocol: none

## 维护者速读

-
用户能看到什么变化:管理员在已安装(只读)应用的记录页「…」第一项就能「配置页签」,可拖动全部页签、隐藏或恢复关联页签,每个页签标明来自原包、其他包还是本环境;保存后所有人看到新排列,原包不动。自建应用的入口也挪到「…」第一项。
- 为什么做:本卡「记录页就地配置页签」的第二个也是最后一个合并请求,替管理员省去进 Studio 改已安装对象的绕路。
-
出错会怎样:只影响已安装对象记录页的页签排列,写在该应用配对的定制包里;管理员可再次进入配置改回,原包始终不变。定制总览读接口暂不列出页签排列,已另开卡跟进(定制总览列出页签排列)。
- 要你做什么:无(是否允许在已安装对象上隐藏附件、审批、动态三个内置页签,已另开决策卡等你裁定)。

## What changes

**Installed objects (card items 4 and 7).** On the record page of an
object whose package is installed read-only, 「Configure tabs」 is now
offered too. The gate is PR 1's admin gate (Studio opens the object,
posture `view` here) plus `useCustomizeDoorWalled()`: where the
customization door is walled (`group` / `isolated`), the entry is not
offered. The edit state is the same one PR 1 built: the design-mode
shell from objectstack-ai#36437, reused unchanged.

- Every tab can be moved: the object's own lists, a list another package
brings, and the built-in 附件 / 审批 / 动态.
- A related tab can be hidden and shown again. A built-in tab cannot be
hidden here, because the `.custom` list cannot hide it (spec: "cannot be
hidden here"). An attachments tab the base does not draw waits in
「Hidden」 and can be shown from there.
- Each related tab carries a source mark: 「Original package」, 「From
PACKAGE」 or 「This environment」.
- 「Save」 writes the `relatedLists` of the pair's object extension
(`object_extension`, filed under the object's name, in the base's paired
`.custom` package), in objectstack-ai#36498's shape. The write lists every shown tab
in order (a built-in by its bare name) and then every hidden related tab
as `{ list, hidden: true }`. A tab the list does not name is served
after the named ones.
- The pair is resolved through the ensure door (`POST
/packages/:id/ensure-customization`). That door creates the pair on the
first save, as Studio does. A pair the server does not list as writable
is refused before any write.

**One shared writer.** `views/objectExtensionArrangementSave.ts`,
`saveObjectExtensionArrangement`, is the only write of an installed
object's arrangement keys (`CUSTOM_ARRANGEMENT_KEYS`).

- It reads the pair's STORED extension and the object as stored (the
layered read).
- It replaces only the keys its caller returns. Every other key is kept:
`fields`, `fieldPatches`, `place`, the other arrangement key.
- It saves a draft with the first-write pin (`ifNoneMatch: '*'`), then
publishes. A refused publish discards that draft.
- It announces the refresh through the door.

The field-layout editor in objectstack-ai#36505 is meant to be its second caller
(`fieldGroups`). objectstack-ai#36505 is not implemented here.
`resolveRecordTabsSaveTarget` now answers `{ kind: 'package' } | { kind:
'pair' }`.

**The 「…」 entry is the first item (card item 1).** `page:header`
(`containers.tsx`): a host overflow entry that declares `leadsMenu:
true` is drawn first, ahead of Refresh, with a separator. Only host
entries can claim this place; an authored action cannot. The record
page's 「Configure tabs」 declares it, on self-built and installed objects
alike. No other entry declares it, so no other menu changes.

**A stored title is kept (fix to PR 1's write).** Since objectstack-ai#36574, the
served `relatedLists` labels are translated for the reader. PR 1 wrote
the editor's labels back as they were, which would have stored a
reader's translation as the title. Now a tab's stored label is written
unless the administrator renamed it (`recordTabLabelToWrite`). This
holds on both paths.

**i18n.** New keys under `designMode.recordTabs`: `pairNotWritable`,
`builtinMoves`, `sourceBase`, `sourcePackage`, `sourceEnvironment`. They
are added to all eleven locales; zh-Hant is regenerated by
`gen-zh-hant`.

## Tests

New files, named for the card:
-
`ui/packages/app-shell/src/views/__tests__/objectExtensionArrangementSave-36499.test.ts`
(6)
-
`ui/packages/app-shell/src/views/__tests__/recordTabsInstalled-36499.test.ts`
(7)
-
`ui/packages/app-shell/src/views/__tests__/RecordTabsConfigInstalled-36499.test.tsx`
(3)

**Existing tests changed** (both are PR 1's):
-
`ui/packages/app-shell/src/views/__tests__/recordTabsConfigSave-36499.test.ts`:
  - the doors gain `ensureCustomization` and `client.get`;
  - TEXTS gains `pairNotWritable`;
  - the read-only refusal case is replaced by the pair target;
  - the seam test expects the pair target.
-
`ui/packages/components/src/__tests__/page-header-overflow-close-36499.test.tsx`:
  - `renderHeader` takes `headerSystemActions`;
  - a new describe has 2 cases for `leadsMenu`.

Ablations. The fix was committed first. Each mutation was written with
`ablation-replace.mjs`, and each restore was proven by blob == HEAD.
- Dropping the `leadsMenu` flag: 1 test red.
- `recordTabLabelToWrite` returning the served label: 2 tests red.

<details><summary>Test and gate runs at head c7f9b58 (all through
os-verify-lock)</summary>

- The card's files plus PR 1's: 7 files, 44/44 passed.
- `packages/app-shell/src/views/RecordDetailView.*`: 99 files, 826/826
passed.
- components `page-header*`, `layout-containers*`,
`horizontal-overflow*`, `page-tabs*`, plus plugin-detail
`RecordPageColumns*` and `RecordRelatedListRenderer*`: 64 files, 598/598
passed.
- i18n `src/__tests__`: 106 files, 1978 passed and 13 skipped.
- `ui/scripts/` (a derived family): 174 files, 5127 passed and 2
skipped.
- `type-check` (both `tsconfig.json` and `tsconfig.test.json`) for
app-shell, components and i18n: exit 0.
- `dispatch-gates --commands`: 41 derived families, all run, all exit 0.
`--ran` reconciles them as 41 run, 0 NOT-MEASURED.
- The 40 `ui` lint-workflow checks, including `check:spec-symbols`,
`check:i18n-keys`, `check:i18n-drift` and `check:metadata-write-doors`:
exit 0.
- `check:doc-examples`, `check:doc-snippets` and `check:readme-exports`
first answered PRECONDITION NOT MET because `@object-ui/cli` was not
built. After building it, all three gave exit 0.
- `check:new-line-citations`: exit 0.
- `check:test-source-alias` and `check:nul-bytes` (both derived): exit
0.
- eslint with the ADR-0054 `no-synthetic-event-trigger` ratchet, on the
24 changed ui files: exit 0.
</details>

At head 28193db (patch round 1, after a merge of main): own and PR 1
files plus `DataPillar.panelHold-27629` 8 files 49/49; `ui/scripts/`
5127 passed and 2 skipped; app-shell and components `type-check` exit 0;
41 derived families exit 0, with `--ran` reporting 0 NOT-MEASURED;
`check:i18n-keys`, `check:i18n-drift`, `check:spec-symbols`,
`check:new-line-citations` and the three `check:vi-mock-*` checks exit
0. The large neighbour suites (RecordDetailView.*, i18n, page-header)
were not re-run locally after this merge; CI runs them.

## Acceptance notes

- **The customizations read does not list an arrangement: moved to
objectstack-ai#36626** (seat routing, 2026-11-23 04:26Z). After the save, `GET
/api/v1/packages/com.example.showcase/customizations` answered `200`
with every list empty. The extension itself is there: `GET
/api/v1/meta/object_extension/showcase_account?package=com.example.showcase.custom`
answers it. The read's contract is strict and names exactly three member
kinds, `extensions.kind` = `field` | `validation` | `index`, so a
`relatedLists`-only extension (and a `fieldGroups`-only one, for objectstack-ai#36505)
has no entry to appear as. Making it appear is a spec and runtime
change, carried by objectstack-ai#36626, not by this PR.
- **H2 (a per-tab source on `_relatedListsArrangement`) does not hold;
the narrow gap below is an accepted deviation** (seat routing,
2026-11-23 04:26Z; no card). The decoration carries `{ packageId,
hidden, unlisted }` and nothing per tab. The source marks are derived
from data the client already has:
- the child object's `_packageId`: the base means the original package;
`sys_metadata` or a `.custom` package means this environment; anything
else means that package;
  - a relationship field named `__c` means this environment.

The remaining gap: a relationship field that another package's extension
adds to a base-owned child object shows as 「Original package」. Closing
it needs a per-tab source from the server. No spec or server change is
made here.
- **Built-in tabs stay locked here: hiding them goes to decision card
objectstack-ai#36627** (seat routing, 2026-11-23 04:26Z). On installed objects 附件 / 审批
/ 动态 can be moved but not hidden: the spec says the `.custom` list
cannot hide them ("cannot be hidden here"). They are not renamable
either, on either path: a built-in entry is a bare name in the spec's
shape and carries no label, so there is no place to store a rename. Seat
ruling 7089839334 (no spec card for hiding 审批/动态 on self-built objects)
is unchanged.
- **Translated labels.** PR 1 combined with objectstack-ai#36574 would have written a
reader's translated tab title into the stored definition on any save.
Fixed on both paths; see What changes.
- **Visible effect beyond the card.** 「Configure tabs」 now sits above
Refresh in every record 「…」 where it is offered, including on self-built
objects (PR 1 placed it after Refresh). No other menu entry moves.
- **Observation, not filed.** For an installed object, the layered
read's `code` layer (`GET
/meta/object/showcase_account/layers?package=com.example.showcase`)
answered the extension-folded `relatedLists`, while the showcase source
declares none. The writer reads entries in the order extension first,
then owner, so this does not change what is written. I note it because a
reader of `code` would take the result for the package's own definition.
- **CI patch round 1 (head 28193db).** At c7f9b58, `Test UI (13/16)`
went red on one test that this change does not touch:
`DataPillar.panelHold-27629` › "Show me" reopens the action…, a 3000 ms
`waitFor` on the held line. That test was last changed by objectstack-ai#36597 on
main. No file in its import graph is in this diff, and the dom project
runs `isolate: true`, so no other file's mocks reach it. Under
os-verify-lock it passed alone (5/5) and with all 41 `DataPillar.*`
files on 4 workers (209/209). The merge group's CI for objectstack-ai#36597 and the
later runs on main are green. I read it as a timing flake in a loaded
shard (that file took 10 s there), not a defect of this change, so no
code or test was changed for it. The new head is a merge of main
(3110de5), which re-runs CI.
- **H1 holds.** The extension is written as `object_extension` in the
pair, and only `relatedLists` is replaced (unit:
`objectExtensionArrangementSave-36499` keeps `fields`, `fieldPatches`,
`place` and `fieldGroups`). Live: the second save in the browser pass
read back the first save's extension and replaced only its list.

## Verification

Browser pass at head `0aacc5aad`, with the same code as this head; the
merge of main brought in no file this change reads.

- Booted example app: `examples/app-showcase` (`objectstack dev --ui
--seed-admin`, own port and DB). The console was rebuilt from this
branch.
- Installed read-only package: `com.example.showcase` (type app,
`writable: false`).
- Object: `showcase_account`, record Northwind.
- Before the first save: no `com.example.showcase.custom` package
existed, and the customizations read was empty.
- To show a tab from another package, the run's DB holds a QA package
`com.qa.tabs` with an object `qtab_visit` that looks up
`showcase_account`. It exists only in the run's DB.

<details><summary>Admin, 1440: reorder, hide, save, reload</summary>

- 「…」 read `Configure tabs, Refresh, Share, Change Owner, Delete`.
- Editor chips:
  - `showcase_contact` [Original package]
  - `showcase_field_zoo.f_lookup` [Original package]
  - `showcase_field_zoo.f_lookups` [Original package]
  - `qtab_visit` [From Tabs QA]
  - 审批
  - 动态
- I dragged Visits first, hid 「Field Zoo · Lookup → Accounts (multiple)」
and saved. The writes, in order:
  - `POST /api/v1/packages/com.example.showcase/ensure-customization`
- `PUT
/api/v1/meta/object_extension/showcase_account?mode=draft&package=com.example.showcase.custom`
- `POST
/api/v1/meta/object_extension/showcase_account/publish?package=com.example.showcase.custom`
- Nothing was written to `com.example.showcase`.
- Tabs after save and after a reload: `Details, Visits, Contacts, Field
Zoo, Activity`.
- The pair's extension then read
`{"extend":"showcase_account","relatedLists":["qtab_visit","showcase_contact","showcase_field_zoo.f_lookup","sys_approval_request","sys_activity",{"list":"showcase_field_zoo.f_lookups","hidden":true}]}`.
- The served object carries `_relatedListsArrangement:
{"packageId":"com.example.showcase.custom","hidden":["showcase_field_zoo.f_lookups"],"unlisted":"shown"}`.
</details>

<details><summary>Original package unchanged</summary>

- `GET
/meta/object/showcase_account/layers?package=com.example.showcase`
answers `overlay: null`, `draft: null`, `provenance: package`,
`editable: false`.
- `GET /meta/object_extension?package=com.example.showcase` answers
`items: []`.
- `git status examples/` is clean.
- The customizations read: see Acceptance notes.
</details>

<details><summary>Another account (plain member), 1440 and
1280</summary>

- 「…」 read `Refresh, Share`: no entry.
- The member's served object carries the same `relatedLists` and the
same `_relatedListsArrangement`.
- Tabs drawn: `Details, Field Zoo, Activity`. The multi-lookup tab is
hidden. Visits and Contacts are not drawn because the member has no read
on `qtab_visit` and `showcase_contact` (`403 PERMISSION_DENIED` on the
data read), as before this change.
</details>

<details><summary>Admin, 1280: second save over the existing
extension</summary>

- The menu's first item is 「Configure tabs」.
- On reopening, the editor shows the saved order and 「Field Zoo · Lookup
→ Accounts (multiple)」 in 「Hidden」.
- I moved 动态 ahead of 审批, showed the hidden tab again and saved. The
same three writes followed (ensure, pinned draft, publish).
- After a reload: `Details, Visits, Contacts, Field Zoo · Lookup →
Account, Field Zoo · Lookup → Accounts (multiple), Activity`.
- A separate drag (not saved) moved 动态 to the very front, so built-ins
move to any place.
</details>

<details><summary>Self-built path (PR 1), admin, 1280</summary>

- On `qtab_account` (package `com.qa.tabs`, writable), 「…」 read
`Configure tabs, Refresh, …`.
- Chips carry no source mark.
- I dragged People first and saved. The writes were `PUT
/meta/object/qtab_account?mode=draft&package=com.qa.tabs`, then `POST
…/publish?package=com.qa.tabs`.
- After a reload: `People, Deals, Tickets, Attachments, Activity`.
</details>

The 「This environment」 mark is covered by
`RecordTabsConfigInstalled-36499` and `recordTabsInstalled-36499`. It
was not set up in the browser.

Screenshots (`/mnt/project-files/objectstack-seat2/shots/36499-pr2/`):
- `01-admin-1440-menu-first-item.png`: 「Configure tabs」 first in 「…」 on
the installed object
- `02-admin-1440-installed-edit-state.png`: the edit state with source
marks
- `03-admin-1440-installed-moved-hidden.png`: Visits moved first,
multi-lookup tab in 「Hidden」
- `04-admin-1440-installed-after-reload.png`: after save and reload
- `05-member-1440-installed-menu-no-entry.png`,
`05-member-1280-installed-menu-no-entry.png`: the member's 「…」 and tabs
- `06-admin-1280-menu-first-item.png`: the entry first at 1280
- `07-admin-1280-installed-reopened.png`: reopened on the saved
arrangement
- `08-admin-1280-installed-moved-restored.png`: 动态 moved, hidden tab
shown again
- `09-admin-1280-installed-after-reload.png`: after the second save and
reload
- `10-admin-1280-selfbuilt-edit.png`,
`11-admin-1280-selfbuilt-after-reload.png`: the self-built path

Files to read first, by risk:
1. `ui/packages/app-shell/src/views/objectExtensionArrangementSave.ts`:
which keys are kept and which are replaced, the pinned draft, publish,
and the discard on a refused publish.
2. `ui/packages/app-shell/src/views/recordTabsInstalled.ts`,
`installedTabsEntries`: what the pair's list holds (built-ins bare,
hidden related tabs, kept unknown entries, stored labels).
3. `ui/packages/components/src/renderers/layout/containers.tsx`:
`leadsMenu`, in the record bar and in the state-group menu.

Two-minute check: in `examples/app-showcase`, run `objectstack dev --ui
--seed-admin`. As admin, open any Account record and open 「…」. The first
item is 「Configure tabs」. Hide a tab, drag another, and save. `GET
/api/v1/meta/object_extension/showcase_account?package=com.example.showcase.custom`
answers the new `relatedLists`.

---

_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmP8GZoB2rUETxwNEDv)_

<!-- signed: repo:objectstack#2 · os-steve ·
session_01ADHkmP8GZoB2rUETxwNEDv -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
…with Cancel and Save, live at once (objectstack-ai#36634)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi96kzyjcbK53dPTb3U2Eb422)_
Part of objectstack-ai#36511
Clause-②: no
Metadata-protocol: none

This is the second PR for the card, on top of objectstack-ai#36597 (the object page,
merged). It covers the object page's hooks, the actions an installed
app's object gains in its customization package, and flows. Permission
sets in the Studio's Access pillar are done too, but are left out of
this PR to keep it under the 3000-line budget: they wait on the branch
`claude/issue-36511-studio-save-cancel-3`, about 380 more lines on top
of this one. Field layout and the AI-draft notice stay with the third
PR.

## 维护者速读

- 用户能看到什么变化:在 Studio
里,对象页的「钩子」「新增动作(已安装应用的定制)」和「自动化流程」不再每隔一秒半自动存草稿。改完点顶栏「保存」立即生效,点「取消」回到原样。流程的启用开关一按就生效,新建的流程一创建就上线(默认关闭),打开开关即刻运行。
-
为什么做:维护者裁定人类改一项就确认一项、点保存直接生效。这是「保存即生效」系列的第二步,接在已合入的对象页之后;权限集因行数预算另起一单紧随其后。
- 出错会怎样:保存被服务器拒绝时,改动留在页面上并写明原因,这次保存写下的草稿会被收回。可以直接撤回本单,回到原来的自动存草稿。
- 要你做什么:无。

## What changes

**Mechanism.** Nothing new. Each editor below registers its buffer with
the top bar's coordinator from objectstack-ai#36597 (`useStudioSaveEntry` in
`studioSaveBar.tsx`). Save writes the item's draft, then publishes that
one item with `publishSavedItem`. A refused publish takes back the draft
that Save wrote, unless a draft was already pending before the Save.

**Editors moved to explicit save in this PR.**

- **Hooks**, on the object page's Hooks tab (`ObjectHooksPanel.tsx`):
- The buffer moved out of the panel into a new `objectHooksBuffer.ts`.
It is owned by the Data pillar, so an edit survives a tab switch and is
still sent by Save.
- It is read the first time the Hooks tab opens for an object, so
opening an object reads nothing new.
- A new hook ("+ New", and the empty block's button) is written only by
Save, under the first-write pin (`If-None-Match: *`).
- A rename or an expression that does not parse holds the whole Save and
names why.
- The panel is now presentational. Its saved-at line is gone; the toast
names what was saved.
- **An installed app's added actions**, on the object page's Actions tab
(`pairObjectActions.ts`, `ObjectActionsPanel.tsx`):
  - The same lift: the Data pillar owns the buffer.
- A preset adds the action locally; nothing is written and the ensure
door is not asked until Save.
- Delete takes the row off the page; Save deletes its draft and its
published row in the pair.
- Save writes each new or edited action's draft in the pair and
publishes it there.
- **Flows**, on the canvas and in the properties aside
(`AutomationsPillar` in `StudioDesignSurface.tsx`):
- The flow's autosave is gone. Save writes the draft (into the pair for
a customized flow) and publishes that flow. Cancel reloads it as the
server holds it.
- **The enable switch needs no Save.** A flip writes the stored flow
with the new `status` and publishes it at once. An unsaved canvas edit
is not sent with it and stays on the page for Save. A refused flip rolls
the switch back.
- **A new flow is published as it is created**, switched off as before,
so turning it on makes it live straight away. Self-built and installed
apps take the same path. An installed app's flows that are switched
through the ledger (`FlowLedgerSwitch`) were already immediate.
- The header's 已保存 badge retired with the autosave. A Save also re-reads
the flow's verdict, so a stale problem clears.

**Words.**
- The switch's titles and toasts say a flip is live now, not "publish to
apply".
- The inspector footers and the Studio landing lead say Save makes a
change live.
- A customized item's pillar footer has its own key,
`engine.studio.customize.saveFooter`. The shared `customize.draftFooter`
stays as written for the All-metadata item page, which still autosaves.
- Three held clauses are new: `held.hookRename`, `held.celInvalidHook`,
`held.pairActionRename`.
- Three keys only the badge read are removed: `autoSaved`,
`flowSavedNamed`, `flowSaveFailed`.

**Two people saving the same item.** The later Save can overwrite one
that already went live. The seat accepted this for the transition
(ruling on the card, 7089589821); the server-side guard is objectstack-ai#36601.

## Tests

New suites, each asserting no write before Save (past the retired 1.5 s
debounce), then the draft write followed by the single-item publish, and
Cancel putting the page back with nothing sent:

- `ObjectHooksPanel.saveCancel-36511.test.tsx`: edit, Save, Cancel; "+
New" under `If-None-Match: *`; a refused publish keeps the edit and
takes back the draft; a rename holds Save.
- `AutomationsPillar.saveCancel-36511.test.tsx`: edit, Save, Cancel. The
switch is live at once without the unsaved edit. A new flow is published
off, and switched on it is published on.
- `DataPillar.pairActions-30088.test.tsx` (rewritten): a preset writes
nothing and asks no pair until Save; an edit is saved and published at
the pair; Delete is sent by Save. A new Cancel case covers an added
action plus an edit.

Rewritten onto the top bar's Save (the same assertions, with Save
pressed where the autosave used to fire):

- Hooks: `ObjectHooksPanel.celGate`, `.firstSavePinned-11773` (a
re-opened hook now asserts no draft again, since Save published the last
one), `.draftUnreadable-29148`, `.newHookTarget-11820`,
`.designerRegistryMissing`, `StudioEmptyState.panels-12514` (Hooks
block), `ObjectPanels.lateRegistration-11939`. The panel is mounted
through a new test host, `__tests__/hooksPanelHost.tsx`.
- Flows: `AutomationsPillar.customizeFlow-28570`,
`.problemsAgree-27799`, `.serverVerdict-26858`, `.heldIncomplete-11786`,
`StudioDesignSurface.autosaveInFlight-11204` (flow case),
`.autosaveSwitch-11232` (two flow cases), `.publishRefusal-26730` (the
switch's publish takes the draft off the pending feed),
`.heldPublish-11786`.
- `DirectoryPage.stateVocabulary-29705` pins the new
`customize.saveFooter` key to 定制.

Retired:

- `ObjectHooksPanel.autosave-11787.test.tsx`: the hook autosave it
pinned is gone. Its rename hold moved into the new hooks suite, and its
in-flight case has no autosave left to race.
- The three badge cases of
`StudioDesignSurface.flowAutosave-34818.test.tsx`: the badge is gone,
and the Save toast is pinned in the new flow suite. Its Interfaces,
Debug and Runs cases stay.

<details><summary>Local test readings</summary>

All runs went through `os-verify-lock.sh`, after a fresh build of the
app-shell dependency closure following the merge of main.

- At c496e8b, the code as in this PR's head: `vitest run` over
`app-shell/src/views/studio-design`, the `PermissionMatrix*` suites,
`DirectoryPage.stateVocabulary-29705`, `studioAutomationCopy*` and the
whole `packages/i18n`. Result: `Test Files 509 passed (509)`, `Tests
5138 passed | 13 skipped (5151)`, VERDICT command-exit 0.
- At bf7dbf0, the head. The only change since c496e8b is a
collection-time `import '@objectstack/lint'` in 13 suites, asked for by
`check:test-source-alias`. Those 13 suites plus the new flow suite and
the pair-actions suite: `Test Files 15 passed (15)`, `Tests 71 passed
(71)`, VERDICT command-exit 0.
- At bf7dbf0, app-shell `pnpm type-check` (both tsconfig and
tsconfig.test) and `pnpm lint`: VERDICT command-exit 0, lint 0 errors.
- `Test UI`, `Lint UI`, `Type Check UI` and the Live E2E run in CI.

</details>

## Acceptance notes

- Permission sets: they are on `claude/issue-36511-studio-save-cancel-3`
(the Access matrix sends with Save and publishes the set; the banners
say Save). They were left out only for the line budget: this PR is 30
files, +1773/−1008 against main.
- The create dialogs still read "Save as draft"
(`engine.studio.createDraft`, one label pinned for every create dialog
by `CreateItemDialog.oneLabel-11787`). Objects since objectstack-ai#36597, and flows
now, are live when created. The label is left for the card to settle in
one place.
- The Access pillar's OWD overview keeps its own Save, which writes
object drafts for Publish. It was not named in this PR's scope.
- After a Save, the Problems tab reads the live flow's verdict, because
no draft is left. A publish the server refuses still names the problem
in the refusal strip.

## Verification

Read first:
1.
`ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx`,
AutomationsPillar `doSave` and `toggleEnabled`: the publish after the
draft, and the switch writing the stored flow, not the buffer.
2. `ui/packages/app-shell/src/views/studio-design/objectHooksBuffer.ts`,
`save`: a new hook versus an existing one, and the re-pin after a
refused or a landed publish.
3. `ui/packages/app-shell/src/views/studio-design/pairObjectActions.ts`,
`save`: deletes first, then each draft and its publish, with refusals
collected.

Two minutes: open Studio on a self-built app, then Automations. Change a
step's label: Cancel and Save appear at the top right. Press Save: the
toast says the flow is saved, and reopening the app shows the label.
Flip the switch: the toast says it is live now, with no Save and no
Publish.

<details><summary>Local gates at bf7dbf0</summary>

Derived with `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` at bf7dbf0: 38 families, all run with
exit 0. `pnpm --dir ui exec vitest run scripts/` ran under the lock:
`Test Files 172 passed | 2 skipped`.

Reconciled with `--ran`: `38 derived famil(ies) accounted for — 38 run,
0 NOT-MEASURED (a DERIVED zero — all 38 recorded an exit code and none
of them is 3)`.

`overlap-check`: clean against origin/main 4ef1ea9.

</details>

🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- signed: repo:objectstack#2 · os-steve ·
session_01ADHkmPsv99YG2tCHoSe8Nb -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
… changes can be dropped on its page (objectstack-ai#36511, PR 3 of 3) (objectstack-ai#36652)

<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8TmfMWT7ctTvEhPrKWGwWUe)_

Fixes objectstack-ai#36511

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 这是「改完直接点保存」专题的最后一个 PR:权限集、对象的访问总览、字段布局也改成右上角「取消/保存」,保存即生效,不再留草稿。
- 新建对象、流程、权限集时按钮写「创建」,建好就生效;其余仍存草稿的新建照旧写「存为草稿」。
- 对象和流程上有 AI 没发布的改动时,页面提示「这一项有 AI 未发布的改动,保存会一并生效」,并可「放弃 AI
的改动」,顶上「变更」数随之减少。
- 要你做的:无产品问题待裁;本卡全部验收条目在下表,PR 1 objectstack-ai#36597、PR 2 objectstack-ai#36634 已合并。

## What changes

PR 3 of 3 for the card. PR 1 (objectstack-ai#36597) moved an object's fields,
validations, actions and settings to the Studio top-bar Cancel/Save; PR
2 (objectstack-ai#36634) moved hooks, an installed app's added actions, and flows.
This PR finishes the list:

- **Permission sets** (`PermissionMatrixEditor`, inside Studio's Access
pillar). Grants stay on the page until Save; Save writes the draft and
publishes that one set at its package. A refused publish keeps the grant
unsaved, says why, and takes back the draft it wrote. The full-metadata
item page keeps its own buttons, as the card says.
- **OWD overview** (`PackageOwdOverviewPanel`). Its own "Save" button is
gone; its rows register with the top-bar Save. Each changed object is
saved as a draft and published at once. The controlled-by-parent
prerequisite confirm still applies. Rows the server refuses stay edited
and are named in the refusal; the rest are saved. When a later row asks
the prerequisite, the rows already published are read back first, so
none shows as unsaved and Cancel never restores a value the server no
longer holds.
- **Field layout.** The form designer writes through the object's buffer
that PR 1 put on Save/Cancel, so no code changed. A new suite pins it:
moving a section sends nothing; Cancel restores the order; Save sends
one draft PUT, then the publish.
- **Creates.** Creating an object, a flow or a permission set now
publishes the new item right away, and those three dialogs say "Create"
/ 「创建」 (`engine.studio.createLive`). Every other create dialog still
writes a draft and still says "Save as draft".
`CreateItemDialog.oneLabel-11787` pins which is which.
- **Item 6: an item with the AI's unpublished changes** (objects and
flows). The page opens on the AI's version, as before. A line says 「这一项有
AI 未发布的改动,保存会一并生效」, with a 「放弃 AI 的改动」 button. The button discards that
one item's draft at its package (`DELETE
/meta/:type/:name?state=draft&package=`), never the package's batch
discard. It asks first if the page has unsaved edits. The page goes back
to the live version, and the Changes count re-reads the ledger, so it
drops by that item. A draft a person wrote draws neither the line nor
the button.
- **Changes count.** Live saves and the AI discard no longer report a
"draft saved". That report held the count at one or more. They send the
metadata refresh pulse instead, so the count reads the ledger again.

## Why

The maintainer ruled on 2026-11-22 that a human edit is saved and
confirmed one item at a time. Drafts plus the batch publish stay for the
AI. This PR moves the last human editors off the draft autosave and adds
the card's item 6.

## Acceptance

| Card acceptance line | Where | Test |
|---|---|---|
| Add a field to an object: nothing is written before Save; after Save
it is live, no publish needed | objectstack-ai#36597 | `DataPillar.saveCancel-36511` ›
an edit sends nothing until Save; Save writes the draft, then publishes
|
| Cancel/Save sit at the top-bar right where Publish was; hidden with no
edit | objectstack-ai#36597 | `StudioDesignSurface.saveBar-36511`,
`studioSaveBar.partialSave-36511` › is drawn only while a buffer is
dirty |
| A field, the display name in Settings and a validation, one Save: all
three live | objectstack-ai#36597 | `studioSaveBar.partialSave-36511` › sends every
dirty buffer in order; `DataPillar.saveCancel-36511` |
| Drag a field in the field layout: nothing written before Save; Cancel
puts the canvas back | this PR | `DataPillar.layoutSaveCancel-36511` (2
tests) |
| Validations, actions, settings, hooks, permissions: each edit saved is
live; no Draft chip, no Changes/Publish | objectstack-ai#36597, objectstack-ai#36634, this PR |
`DataPillar.saveCancel-36511`, `ObjectHooksPanel.saveCancel-36511`,
`PermissionMatrixEditor.studioSave-36511`, `PackageOwdOverviewPanel*`,
`StudioDesignSurface.saveBar-36511` › with no draft pending |
| Create a flow and save; switch it on: live with no publish | objectstack-ai#36634,
this PR | `AutomationsPillar.saveCancel-36511` › the switch is live at
once; a new flow is published as it is created |
| Delete a field and save: a confirm names the consequence | objectstack-ai#36597 |
`DataPillar.saveCancel-36511` › removing a published field asks at Save;
`DataPillar.destructiveChange-34931` |
| Save something that uses an unsaved new field: refused, says which
item to save first, edits kept | objectstack-ai#36597 | `DataPillar.saveCancel-36511`
› an edit that cannot be sent yet holds the whole Save and names what it
needs; a refused publish keeps the edits unsaved |
| AI left a draft: notice shows; 「放弃 AI 的改动」 goes back to live; Changes
count drops | this PR | `DataPillar.aiDraftDiscard-36511` (4 tests),
`AutomationsPillar.saveCancel-36511` › flow AI block (2 tests) |
| HotCRM object: an edit is saved and live; visible in `/customizations`
| objectstack-ai#36597, objectstack-ai#36634 | `DataPillar.baseObjectExtension-28575`,
`DataPillar.pairActions-30088` (writes the `.custom` pair, then
publishes there) |
| A person mid-edit while the AI edits the same item: say what happens |
this PR (below) | `StudioDesignSurface.draftVersionConflict-11773` |
| The PR body lists every editor changed and every test retired or
rewritten | each PR | lists below |

**A person and the AI edit the same item at once.** Neither side's
change is dropped silently:

- The page keeps the person's edits in its buffer until Save. The AI's
write goes to the item's draft on the server.
- On Save, the draft write carries the version the page read
(`If-Match`, or `If-None-Match: *` when the page read no draft). If the
AI wrote in between, the server refuses with a version conflict, and the
existing draft-conflict dialog opens.
- The dialog offers **overwrite**. It asks once more, then sends the
page's version pinned to the version the refusal served, and that
version goes live.
- It also offers **reload**: the page takes what the AI saved, and the
next Save is built on it.
- Nothing is written until the person picks one.
- `StudioDesignSurface.draftVersionConflict-11773` pins the refusal and
both choices (the "two editors", "reload" and "overwrite" cases).

## Editors changed in this PR

- `metadata-admin/PermissionMatrixEditor.tsx`: permission sets in
Studio.
- `studio-design/PackageOwdOverviewPanel.tsx`: org-wide default
overview.
- `studio-design/StudioDesignSurface.tsx`: object / flow / permission
creates; the object and flow AI notice and discard.
- New `studio-design/StudioAiDraftNotice.tsx`: the flow page's notice
line.
- Field layout: no code change; pinned by a test.

## Tests added, rewritten or retired

Added:

- `DataPillar.aiDraftDiscard-36511`
- `DataPillar.layoutSaveCancel-36511`
- `PermissionMatrixEditor.studioSave-36511`
- `PackageOwdOverviewPanel.partialSave-36511`: a refused row keeps its
edit and is named while the other goes live, with the draft taken back;
the controlled-by-parent prerequisite asked after an earlier row went
live
- `AutomationsPillar.saveCancel-36511`: the flow AI block

Rewritten:

- `CreateItemDialog.oneLabel-11787`. The three live creates must say
Create; every other dialog must say Save as draft. Two CONTROL tests are
included.
- All nine `PackageOwdOverviewPanel*` suites. "owd-save" becomes the
top-bar `studio-save`, and the fake clients gain `publish`/`reset`.
- `layersUnsaved-11799`: its FRESH layers count goes from 0 to 1, the
publish.
- `sharedSelect-11865` and `refusalClearsOnRevert-26846`: a "disabled
Save" now reads as "no Save drawn".
- `StudioDesignSurface.changesCount-11787` now drives Create app, which
still writes a draft. A permission set no longer leaves one.
- `StudioDesignSurface.draftVersionConflict-11773`: it asserts the
publish, and its save pins now read `If-None-Match: *` three times.
- `StudioDesignSurface.accessCreateTaken-26836` and `accessGuard`: the
client gains `publish`, and the create is asserted to publish.

Label-only (Save as draft → Create):

- `CreateItemDialog.storedName-11792`
- `createObjectOwd`
- `flowPresets-11861`
- `flowStatusTruth-11779`
- `heldDataCreate-26845`
- `newFlowTrigger-11788`
- `sharedSelect-11865`
- `createTaken-26917`
- `PermissionMatrixEditor.recordScope-26187` and `saveSurface-12725`:
the Studio save harness

Retired: none.

## Verification

Rework at head `a4ee300c4` (contract review 7096256689). Two things
changed: the OWD prerequisite path, and three comments.

```
cd ui && pnpm exec vitest run packages/app-shell/src/views/studio-design/PackageOwdOverviewPanel
 Test Files  11 passed (11)
      Tests  49 passed (49)
# the new partialSave-36511 suite against the previous PackageOwdOverviewPanel.tsx: 2 of 3 fail (the prerequisite cases); with the fix: 3 passed
pnpm exec turbo run type-check --filter=@object-ui/app-shell :: 69 tasks successful
pnpm check:test-source-alias :: exit 0
```

Run at head `f9e6bada7` (main merged at `f590f3eb3`):

```
cd ui && pnpm exec vitest run packages/app-shell/src/views/studio-design packages/app-shell/src/views/metadata-admin/PermissionMatrix* scripts/__tests__/check-i18n-en-drift.test.ts packages/i18n
 Test Files  511 passed (511)
      Tests  5100 passed | 13 skipped (5113)
(the ten suites given warm imports in the last commit, re-run after it: 10 files, 145 tests passed)

pnpm --dir ui run check:i18n-drift            :: exit 0 (every changed designer en value followed by its zh row)
pnpm check:test-source-alias                  :: exit 0
pnpm exec turbo run type-check --filter=...[merge-base] (affected UI packages) :: 105 tasks successful
pnpm --dir ui exec eslint <changed .ts/.tsx>  :: 0 errors
```

Permission-set work after the merge from main: a file-by-file check
confirmed it is all still there.

- For the permission-only files, each file's added/removed line counts
are the exact reverse of PR 2's split commit:
  - `PermissionMatrixEditor.tsx` +97/-7
  - `studioSave-36511` +201
  - `recordScope-26187` +15/-7
  - `saveSurface-12725` +10/-3
  - `accessPairCopy-29674` +3
- In the shared files (`StudioDesignSurface.tsx`, `en.ts`, `zh.ts`),
every permission line the split took out is back.
- The split commit itself is not in this branch's history.

## Acceptance notes

- Item 6 is wired for **objects and flows**: the pages that read the
draft's per-change provenance (`draftChanges[].by`). Hooks, actions and
permission sets do not read it, so they show no AI line. Their draft
still opens and is saved live as the AI's version plus the person's
edit. Adding that read is a separate change if wanted.
- The merge from `main` (1371428) also carries one changeset wording
edit. `.changeset/36511-studio-save-cancel.md` now says permission sets
moved to Save in a later change.
- `DataPillar.panelHold-27629` failed once in an earlier full local run
of the studio-design tests. It passes when run alone, and it passed in
the final full run above. It looks like a timing flake under load, in
code this PR does not touch.

## 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 (the maintainer brief
is the allowed Chinese channel).
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01JQwxbWaN9FFV8GYdeZHvuB

---------

Co-authored-by: Claude <noreply@anthropic.com>
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

Development

Successfully merging this pull request may close these issues.

2 participants