Skip to content

feat(studio): hooks, an installed app's added actions and flows save with Cancel and Save, live at once - #36634

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

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

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

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

This is the second PR for the card, on top of #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 #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 #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.
Local test readings

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.

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 feat(studio): the object page saves with Cancel and Save in the top bar, live at once #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.

Local gates at bf7dbf0

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.

🤖 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>
…ancel' into claude/issue-36511-studio-save-cancel-2
… pillar and saved by the top bar

Claude-Session: https://claude.ai/code/session_01ADHkmPsv99YG2tCHoSe8Nb
Co-authored-by: Claude <noreply@anthropic.com>
…on are live at once

Claude-Session: https://claude.ai/code/session_01ADHkmPsv99YG2tCHoSe8Nb
Co-authored-by: Claude <noreply@anthropic.com>
…d is live at once

The Access pillar's matrix no longer autosaves a draft: Save writes it and
publishes the set alone; Cancel puts back what the editor last read. The
inspector footers, the access banners and the landing lead say Save, not Publish.

Claude-Session: https://claude.ai/code/session_01ADHkmPsv99YG2tCHoSe8Nb
Co-authored-by: Claude <noreply@anthropic.com>
…ancel' into claude/issue-36511-studio-save-cancel-2
… bar's Save

The flow's saved badge retires with its autosave; a Save re-reads the flow's verdict.

Claude-Session: https://claude.ai/code/session_01ADHkmPsv99YG2tCHoSe8Nb
Co-authored-by: Claude <noreply@anthropic.com>
…udio-save-cancel-2

# Conflicts:
#	ui/packages/app-shell/src/views/studio-design/DataPillar.pairActions-30088.test.tsx
#	ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx
…budget)

The Access pillar's Save and Cancel stay on claude/issue-36511-studio-save-cancel-3.

Claude-Session: https://claude.ai/code/session_01ADHkmPsv99YG2tCHoSe8Nb
Co-authored-by: Claude <noreply@anthropic.com>
engine.studio.auto.enabledToast / disabledToast now say "Switched on, live now" /
"Switched off, live now" and zh followed in the same PR, so the designer
waivers that covered the old "publish to apply" text are stale.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWaN9FFV8GYdeZHvuB
The two Studio switch-toast waivers left the ledger; the ratchet pins the new count.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbZeHNsF3RWcWpj7rGj

维护者速读

Studio 里对象的钩子、安装来的应用新加的动作、流程,都改成在顶部点「保存」才写入,保存后立刻生效,不再停手 1.5 秒自动存草稿。流程的启用开关一拨就生效;新建的流程直接以关闭状态上线。
这是 #36511 的第 2 个 PR(共 3 个),按专题 #36510「人改一项、点保存、立刻生效」的规则做;权限集留到第 3 个 PR。
CI 全绿,2829 行(3000 行上限以内),非受管面,席位落地。
要你做的:无。

席位核对 — ACCEPT (L1) · repo:objectstack#1 · head 3cef83ce · 2026-11-23T07:55Z

  • Shape: Part of #36511 (PR 2 of 3). 32 files, +1806/−1023. Changes: hooks get a buffer lifted into objectHooksBuffer.ts; an installed app's added actions move to pairObjectActions.ts; flows change in StudioDesignSurface.tsx; plus the i18n en/zh catalogues and the drift baseline and ratchet. One patch changeset (app-shell, i18n) with Clause-②: no and Metadata-protocol: none. Tier S (check-governed-merges: not governed, 2829 ≤ 3000). No L2 face.
  • Provenance: built by seat 2 (os-dev-report 7091844606), then handed to this seat by the maintainer's word (Steve, 06:21Z) and released in 7093287856. Since the hand-over, this seat's card thread added three commits: 5185e0eb drops the two stale designerWaivers rows, since zh followed the new en text in the same PR; 5501d15e lowers the designer-waiver ratchet from 7 to 5, a tightening; and 3cef83ce is a merge of origin/main only, with no conflicts and no other change.
  • Read: Save follows PR 1's pattern (feat(studio): the object page saves with Cancel and Save in the top bar, live at once #36597, L1 7089990378): write the item's draft, then publishSavedItem for that one item at its own package. When the publish fails, draftDiscarded decides hasDraft and the verdict is re-read. A flow's switch writes and publishes on its own, and any unsaved canvas edit stays on the page for Save. A new hook or added action is written only by Save. A removed added action is deleted by Save. pageDirty now includes the hooks and pair-action buffers, so leaving the object asks first. ObjectHooksPanel.autosave-11787.test.tsx is deleted because the behaviour it pinned (1.5 s autosave) is removed by the epic ruling. The new saveCancel-36511 suites for hooks and automations pin what replaces it. This is not a narrowing of a kept contract.
  • Gates: 58 checks on 3cef83ce: 45 success · 13 skipped · 0 failed. Merge-base is current main (K = 0). The thread re-ran check:i18n-drift and the affected UI type-check (105/105) after the merge.
  • Landing: ready + auto-merge now. Then PR 3 (Fixes #36511) follows from claude/issue-36511-studio-save-cancel-3. Split commit c496e8b7b8 is never merged into it.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 23, 2026 07:56
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit f590f3e Nov 23, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-36511-studio-save-cancel-2 branch November 23, 2026 08:29
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
… write Field change values (objectstack-ai#36290 part 1) (objectstack-ai#36641)

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

Part of objectstack-ai#36290

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

## 维护者速读

- 管理员在 Studio 的字段设置和字段设计器里,原来的「记录历史」开关换成「字段修改值」三选一(默认 / 开 /
关),对象设置的「功能开关」里新增「字段修改值」;普通用户无感。
- 属于记录页「字段修改前后值」专题,落实「默认显示、对象或单个字段可关」的裁决:以前 Studio
写的是不再起作用的旧开关,管理员在界面上关不掉前后值。
- 若出错,管理员可能看到「默认」标成开而动态里实际不显示前后值(或相反),或关掉后回不到默认;改动只在设置界面,可直接撤回。
- 要你做的:无。

## What changes

Card objectstack-ai#36290 part ① (PR 3 of 4; ruling 7076513167 point 1: "Old → new is
shown by default on every object's record page; an object, or a single
field, can turn it off."). PR 1 (objectstack-ai#36399) gave the runtime `fieldHistory`
(field) and `enable.fieldHistory` (object); objectstack-ai#36580 gave the metadata
form a three-way `field-history` widget. The Studio's own producers
still wrote the old key. This PR moves all three named in the release
comment.

**Field inspector** (`ObjectFieldInspector.tsx`, Advanced section)
- The "Track history" box (`value={!!def.trackHistory}`, `patchDef({
trackHistory: v || undefined })`) is gone. Measured reason: since PR 1 a
field's `trackHistory: false` reads like absent and `true` does only
what `fieldHistory: true` does for a media or JSON type (spec describe
of `FieldSchema.trackHistory`), so a second box beside Field change
values could only mislead. A stored `trackHistory` is never written or
removed here; it is still read, because `resolveFieldHistory` reads it.
- New row "Field change values": Default / On / Off over the field's
`fieldHistory`. Default removes the key (`unsetDefKey`, not a patch to
`undefined`); On / Off write `true` / `false`.
- Default names what it resolves to through `resolveFieldHistory` from
`@objectstack/spec/data`, the predicate the activity writer uses. Unlike
the form widget, this rail holds the object document, so it passes the
object: an object with `enable.fieldHistory: false` makes every field's
Default read "Default (Off)", and a note under the row says the object's
off wins.
- The row sits inside the existing `DisplayPatchLock`, so on a read-only
base field it is locked with the same reason as its neighbours
(`fieldHistory` is not on `BASE_FIELD_DISPLAY_WHITELIST`).

**Object settings** (`ObjectSettingsPanel.tsx`, Features card)
- New row "Field change values" (`enable.fieldHistory`), next to "Field
change history" (`enable.trackHistory`). Ticked unless the stored value
is a literal `false`. Unticking writes `false`; ticking again REMOVES
the key (unset already means on, so no `true` the author did not need).
Sibling `enable` keys are kept, as for every other row.
- The Field change history description no longer says "pair with
per-field history tracking to pick which field diffs are summarized" (no
longer true); it points to Field change values.

**Field designer** (`plugin-designer` `FieldDesigner.tsx`, the drawer
behind `MetadataFieldsPage` and the `field-designer` SDUI type)
- The Advanced section's Track History switch wrote `trackHistory:
data.trackHistory === true` on every save, create and edit. It is
replaced by Field Change Values with the same three choices. The update
path no longer names `trackHistory`: a stored value rides the
`...editingField` spread, and a created field carries neither key at
Default.
- Default's label depends on the type, which the author can change in
the same drawer, and a drawer select's options are static. So the choice
is drawn as two rows under form-local names, one per resolved default,
each shown by a `visibleWhen` built from `resolveFieldHistory` over
`DESIGNER_FIELD_TYPES` (with the field's stored `trackHistory`). The
save reads the row shown for the saved type, which is the one on screen
at the click. Neither form-local name reaches the model.
- `DesignerFieldDefinition` (`@object-ui/types`) and its zod mirror gain
an optional `fieldHistory`. Both save paths carry it:
`MetadataFieldsPage` (`toDesignerField` / `fromDesignerField`) and
`MetadataService.toFieldPayload`. Default writes `fieldHistory:
undefined`, which overrides the carried value and is dropped on the
wire, so a stored key is removed. That is the converters' existing
clear-by-absence rule.
- It cannot import `fieldHistoryChoice.ts`, because app-shell depends on
plugin-designer. What it shares is the rule (`resolveFieldHistory` from
`@objectstack/spec/data`). Its own copy of the choice-to-value mapping
is two lines. Its strings are the language-pack keys
`appDesigner.fieldDesigner.fieldHistory`, `fieldHistoryDefault`,
`fieldHistoryOn` and `fieldHistoryOff`, in all 11 locales and the
designer's defaults table. They replace
`appDesigner.fieldDesigner.trackHistory`.

**Shared logic** (`metadata-admin/fieldHistoryChoice.ts`, new): the
three choices, the value each writes and their wording, used by both the
inspector row and the objectstack-ai#36580 `field-history` widget (refactored onto it;
its behaviour and its 10 pins unchanged). The controls stay separate on
purpose: the widget is a `WidgetProps` renderer that sees one form row
and no object; the inspector row is an `InspectorSelectField` with the
inspector's label and lock semantics and the whole object in hand.

**Strings** (studio namespace, en + zh; the other locales fall back to
en by that namespace's design): `designer.field.fieldHistory`,
`designer.field.fieldHistoryObjectOff`,
`engine.studio.settings.capFieldHistory`,
`engine.studio.settings.capFieldHistoryDesc`;
`engine.studio.settings.capTrackHistoryDesc` reworded;
`designer.field.trackHistory` removed with its box.

Not in this PR: record-page rows (part ②, landed as objectstack-ai#36613), the
per-field history card (part ③).

## Tests

- New `ObjectFieldInspector.fieldHistory-36290.test.tsx` (7): Default
(On) for a one-line type; Default (Off) for image / json / password and
Default (On) once `trackHistory: true`; Off writes `false`, On writes
`true`; Default after Off removes the key; no Track history box, no
`trackHistory` written, a stored one kept; the object's off makes
Default (Off) and shows the note; control: no note otherwise.
- New describe in `ObjectSettingsPanel.test.tsx` (4): checked for unset
and `true`, unchecked only for `false`; untick writes `false` with
siblings kept; re-tick removes the key with siblings kept; labelled by
its own title.
- New `FieldDesigner.fieldHistory-36290.test.tsx` (9), on the real
`FieldDesigner` with a drawer double that captures its schema and calls
its own `onSuccess`. The cases: two rows and no Track History row, with
the labels; for every designer type exactly one row's `visibleWhen`
evaluates true (through `evalFieldPredicate`, the form's own evaluator),
and it is the one `resolveFieldHistory` names; a stored `trackHistory:
true` moves a media type to the Default (On) row; an untouched edit
writes neither key; Off writes `false`, On on a media type writes
`true`; a stored `false` opens as Off and Default removes it; a stored
`trackHistory` is kept; a type changed in the drawer saves what is on
screen; a created field at Default carries neither key.
- New `MetadataFieldsPage.fieldHistory-36290.test.tsx` (4), on PUT bytes
through the real page and a real `MetadataClient`. A stored
`fieldHistory: false` survives and no `trackHistory` is written; a
stored `trackHistory: true` survives and gains no `fieldHistory`; a
field with neither key gains neither; every PUT field parses through
`FieldSchema`.
- Extended: `MetadataService.fieldKeyCarryOver.test.ts` adds
`fieldHistory` to its populated entry and its clearable keys;
`designer-zod-arms-10859.test.ts` adds `fieldHistory` to the fully
populated `field-designer` document.
- Forced test changes:
`ObjectFieldInspector.displayPatchReason-28986.test.tsx` names the Field
change values combobox instead of the removed Track history checkbox
among the locked controls;
`ObjectSettingsPanel.businessWording-36512.test.tsx` lists
`enable.fieldHistory` among the keys the tab writes.
`ObjectFieldInspector.externalIdNotOffered-26674.test.tsx` and
`ObjectFieldInspector.retiredIndexed.test.tsx` listed Track history
among the Advanced siblings that still render; they name Field change
values, and (being edited) now pay the formula and lint loads at module
top, as `check:test-source-alias` requires.
`FieldDesigner.externalIdNotOffered-26674.test.tsx` and
`MetadataFieldsPage.externalIdRoundTrip-26674.test.tsx` used the Track
History row as their positive control; they now use the Field Change
Values row.


## Acceptance notes

- The field designer's Default label follows the drawer's type and the
object is not in hand, so an object with `enable.fieldHistory: false` is
not reflected there, the same accepted bound as objectstack-ai#36580's widget. Neither
`FieldDesigner` nor `MetadataFieldsPage` is mounted by the Console
today; both are published exports, and `field-designer` is a registered
SDUI type.
- A stored field `trackHistory: true` on a media or JSON type makes
Default read "Default (On)"; such a field can still be turned off with
Off, but not returned to the type's off-by-default without editing the
key in the form. That is the resolver's answer, not a UI choice.
- `ui/AGENTS.md` objectstack-ai#2 (package README and `content/docs/frontend/` page)
not edited: outside this part's file surface.
- Screenshots NOT MEASURED (no Console build or backend run here).

## Verification

Read first, by risk:
1. `ui/packages/plugin-designer/src/FieldDesigner.tsx`: the
`fieldHistoryRows` memo (two rows, `visibleWhen` built from
`resolveFieldHistory`) and `fieldHistoryFromForm`, which picks the row
for the SAVED type on both save paths.
2.
`ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.tsx`:
`patchEnable` with `unsetWhenOn` (re-ticking removes
`enable.fieldHistory`, keeps siblings).
3.
`ui/packages/app-shell/src/views/metadata-admin/inspectors/ObjectFieldInspector.tsx`:
the Field change values row and the object-off note inside
`DisplayPatchLock`.

Two-minute check: open Studio, an object, Settings, Features: "Field
change values" is ticked. Untick, save, and reopen the object JSON: it
shows `enable.fieldHistory: false`. Tick again: the key is gone. Then
open a field's Advanced section: "Field change values" reads "Default
(Off)" with the note under it.

<details><summary>Runs (local, head 3b5b130 after merging origin/main
9e2a4ac)</summary>

- Builds under the verify lock: the
`@objectstack/{spec,formula,lint,client,sdui-parser}` closure, and
`@object-ui/app-shell^...` again after the merge (VERDICT command-exit 0
each).
- `type-check` (tsc plus `tsconfig.test.json`) of
`@object-ui/app-shell`, `@object-ui/i18n`, `@object-ui/types` and
`@object-ui/plugin-designer`: all four Done, exit 0 (after the merge;
plugin-designer again at 3b5b130).
- Post-merge union at ffa608d: `vitest run
packages/app-shell/src/views/metadata-admin/inspectors/
packages/app-shell/src/views/studio-design/ObjectSettingsPanel
packages/app-shell/src/views/metadata-admin/FieldHistoryWidget-36482.test.tsx
packages/app-shell/src/views/metadata-admin/SchemaForm
packages/plugin-designer/ packages/types/
packages/app-shell/src/services/ packages/i18n/
packages/app-shell/src/__tests__/defaults-maps-mirror-en-pack.test.tsx`
gave Test Files 851 passed (851) and Tests 16838 passed, 14 skipped.
3b5b130 changes only the designer pin's types; that file re-run: 9/9.
- Pre-merge union at 3fa510b (`metadata-admin/`, `studio-design/`,
`i18n/`) gave Test Files 1232 passed and 2 failed (1234). The 2 were
sibling pins still naming Track history, fixed in 58cef60.
- Ablations, each through `scripts/ablation-replace.mjs` (anchor 1 to
0), restored with blob equal to HEAD and `git diff HEAD` empty:
- The inspector writes `trackHistory` again: 2 of 7 new inspector pins
red.
- The settings switch writes `true` instead of removing the key: 1 of 14
red.
- The designer's update path writes `trackHistory: data.trackHistory ===
true` in place of `fieldHistory`: 7 of 13 red across the two new
designer files.
- `dispatch-gates --commands` at 3b5b130 derived 42 families; all 42
ran locally with exit 0; `--ran` reconciliation gives "42 derived, 42
run, 0 NOT-MEASURED, 0 UNRUN".
- `overlap-check` at 3b5b130: VERDICT clean exit 0 against origin/main
d7411fa (three commits past the merged 9e2a4ac; `git merge-tree` is
also clean) and objectstack-ai#36634, objectstack-ai#36629, objectstack-ai#36606, objectstack-ai#36587, objectstack-ai#36525.
- ui extras: `check:new-line-citations` 0, `check:i18n-keys` 0,
`check:i18n-drift` 0, `check:i18n-dead-keys` 0. eslint on the changed
source and test files: 0 errors, and no warnings on added lines.

</details>

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

https://claude.ai/code/session_01ADHkmPq6z7KER4Sr6Uu7Ht

---------

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