Skip to content

feat(studio): every human editor saves live; an item's unpublished AI changes can be dropped on its page (#36511, PR 3 of 3) - #36652

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

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

Conversation

@os-warren

@os-warren os-warren commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Warren · project thread

Fixes #36511

Clause-②: no
Metadata-protocol: none

维护者速读

What changes

PR 3 of 3 for the card. PR 1 (#36597) moved an object's fields, validations, actions and settings to the Studio top-bar Cancel/Save; PR 2 (#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 #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 #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 #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 #36597, #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 #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 #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 #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 #36597, #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

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (Not touched.)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: n/a.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English (the maintainer brief is the allowed Chinese channel).
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JQwxbWaN9FFV8GYdeZHvuB

…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
… changes can be dropped on its page

- The Access pillar's record-sharing overview drops its own Save: the top
  bar's Save writes each changed object's draft and publishes it; Cancel puts
  the dials back; a refused object keeps its edit and is named.
- New object and new permission set are published as they are created, like a
  new flow; their dialogs, and the new flow's, say Create.
- An object or a flow holding the AI assistant's unpublished draft says Save
  makes it live too, and offers to discard that one item's draft.
- The field layout's Save and Cancel are pinned.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWaN9FFV8GYdeZHvuB
…udio-save-cancel-3

# Conflicts:
#	.changeset/36511-studio-save-cancel-2.md
#	ui/packages/app-shell/src/views/studio-design/AutomationsPillar.saveCancel-36511.test.tsx
… in the edited suites

check:test-source-alias asks every edited test file that reaches a lazy
@objectstack/lint or @objectstack/formula import to pay that load during
collection.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbWaN9FFV8GYdeZHvuB
@os-warren os-warren self-assigned this Nov 23, 2026
@github-actions github-actions Bot added size/xl documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 23, 2026

Copy link
Copy Markdown
Collaborator Author

DELIBERATE CORRECTION. This is a correction, not a filename collision. Check Changeset is red on f9e6bada7 by design and stays red until the dispatching seat's record confirms the correction.

The note corrected is .changeset/36511-studio-save-cancel.md. PR 1 of the same card (#36597) added it, and it is still pending. The edit is the last sentence only.

  • Base: "Other Studio editors (flows, hooks, list and form views, navigation, permissions) keep their draft autosave for now."
  • This PR: "Hooks, flows and permission sets moved to the same Save in later changes; list views and navigation keep their draft autosave for now."

The base sentence is no longer true. Hooks and flows moved to Save in #36634, and permission sets move in this PR. Restoring it from the base would publish that false sentence in the release notes. No other pending changeset is changed.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor

repo:objectstack#1 · os-warren · session_01JQwxbZeHNsF3RWcWpj7rGj

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: f9e6bada7dae37ef5ed98cf0b1576c297a0bcbfd
Local-runs: none
Scope: .changeset/36511-studio-save-cancel.md, .changeset/36511-studio-save-cancel-3.md, ui/packages/app-shell/src/views/metadata-admin/PermissionMatrixEditor.tsx, ui/packages/app-shell/src/views/studio-design/PackageOwdOverviewPanel.tsx, ui/packages/app-shell/src/views/studio-design/StudioAiDraftNotice.tsx, ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx, ui/packages/i18n/src/namespaces/studio/en.ts, ui/packages/i18n/src/namespaces/studio/zh.ts, the 29 changed test files (diff read for removed assertions) + ui/packages/app-shell/src/views/studio-design/studioSaveBar.tsx, ui/packages/data-objectstack/src/metadata-client.ts, packages/rest/src/rest-server.ts, packages/rest/src/meta-item-history-routes.ts, scripts/check-changeset-no-major.mjs, scripts/check-empty-changeset.mjs, .claude/skills/pm-dispatch/references/landing-operations.md, AGENTS.md, issues #36511 and #36510, PR comment 7096114323
Security-touching: yes
Rule-change-verified: none

Diff base: f590f3eb322a75259f55e7e604978fe94dd9a3fe (merge-base with origin/main). 37 files, all under .changeset/ and ui/packages/.

① Derived judgments

  • Clause-②: no is true. The diff touches no file under packages/, so nothing in packages/spec/src/** moves.
  • Metadata-protocol: none is true. No schema, no authorable baseline, no server route and no protocol code is in the diff.
  • Package exports: unchanged. No index.ts is in the diff. PermissionMatrixEditPage is the one exported component touched; it gains one optional prop, onSaved. PackageOwdOverviewPanel loses its onDraftSaved prop, and StudioAiDraftNotice is new; neither is exported from @object-ui/app-shell.
  • i18n: en and zh carry the same key set after the change. Six keys added (engine.studio.aiDraft.notice, .discard, .discardTitle, .discardConfirmUnsaved, .discardFailed, engine.studio.createLive), five values reworded, three keys removed (engine.studio.owd.save, .saveNone, .saved). No source file still reads the three removed keys.
  • The AI discard is per item. DataPillar.discardItemDraft calls client.reset('object', name, { state: 'draft', packageId }), where packageId is the address the object's draft was read at (current.addedIn ?? railPackageId). AutomationsPillar.discardFlowDraft calls client.reset('flow', name, { state: 'draft', packageId }) at the package the flow was read at. MetadataClient.reset sends DELETE /meta/:type/:name?state=draft&package=. Neither calls packages.discardDrafts.
  • The server accepts it. META_ITEM_RESET_PARAMS in packages/rest/src/rest-server.ts is ['state', 'dropStorage', 'package', member]. The route is not changed by this PR.

② Semver level

  • .changeset/36511-studio-save-cancel-3.md: @object-ui/app-shell patch and @object-ui/i18n patch. Correct for Metadata-protocol: none, which requires every entry to be patch. Both declaration lines are in the changeset body and in the PR body, and they agree.
  • The new note's claims were checked against the head and hold: object, flow and permission-set creates call publishSavedItem (StudioDesignSurface.tsx lines 6633, 8846, 10779); the app, page, dashboard, report and dataset dialogs still use engine.studio.createDraft; the OWD panel has no Save button of its own; a permission set in Studio blocks the autosave (saveByTopBar).

DELIBERATE CORRECTION confirmed: no — this record is FAIL, so it confirms nothing at this head. The sentence itself is judged true, and that judgment stands for a later head that leaves the sentence unchanged. Note corrected: .changeset/36511-studio-save-cancel.md, last sentence only; no other pending changeset is modified.

③ Boundary flags

  • should-fix 1 — OWD overview, controlled-by-parent confirm after an earlier row went live. PackageOwdOverviewPanel.doSave saves and publishes rows one by one. When a later row answers 409 DESTRUCTIVE_CHANGE, it opens the prerequisite dialog and returns declined from inside the loop, without the load() the normal partial path runs. Rows already published in that pass are live but still shown as "Unsaved". If the person closes the dialog and presses the top bar's Cancel, doCancel puts those dials back to the stale loaded value, so the page shows a record-visibility setting the server no longer holds. Before this PR the early return left only drafts behind; now it leaves live changes. Fix: reload and restore only the unsaved rows' edits before returning, or handle the prerequisite before any row is published. Pin it with a two-row test.
  • should-fix 2 — the OWD partial-refusal path has no test. The code reads correctly: a refused row keeps its edit, saved rows go live, the reason names each refused row, and a refused publish takes back the draft that pass wrote (publishSavedItem with row.hasDraft). But none of the nine OWD suites makes publish or a second row's save refuse; every fake publish resolves. The PR body claims this behaviour. It is new logic on a record-visibility surface and needs a pin.
  • Permission-set refused publish: correct and pinned. doSave calls publishSavedItem(..., hadDraftRef.current). On refusal it returns refused, does not reset the baseline (the grant stays dirty), and the draft the Save wrote is deleted when no draft was pending before. PermissionMatrixEditor.studioSave-36511 asserts PUT, POST, then DELETE ...?state=draft&package=, the box still checked, Save still drawn, and no success toast. A draft that was pending before the Save is kept, as designed.
  • AI discard asks first: yes. Both discards call window.confirm when the page is dirty (dirty for the object, autoDirty for the flow) and send nothing when declined. Pinned in DataPillar.aiDraftDiscard-36511.
  • Person-written draft shows no AI notice: yes. The object line needs agentDraftCount > 0 and the flow line needs a draftChanges entry whose by is copilot or mcp. Both have a CONTROL test.
  • Weakened tests: none found. Removed assertions were re-stated against the top bar: "Save disabled" became "no Save drawn"; layersUnsaved-11799 goes from 0 to 1 layer reads because the object is now published; changesCount-11787 moved to Create app, which still writes a draft; oneLabel-11787 gained a second control.
  • Server-side authority: unchanged. No server file is in the diff. The client uses three existing doors (draft PUT, POST /meta/:type/:name/publish, DELETE ...?state=draft), and each decides for itself who may act. A permission set now goes live through the per-item publish door instead of the package publish door. I did not compare the two doors' gates line by line.
  • note — the per-item discard asks nothing when the page is clean, and it cannot be undone. On an item the AI created and that was never published, the discard removes the item, while the button title says "go back to the live version". The Access pillar's own discard asks, with a separate sentence for a never-published set.
  • note — in the OWD partial path, when the only refused row kept a draft that was pending before, the reload shows the row as clean and the !isDirty effect clears the inline banner. The top bar's toast still carries the reason.
  • note — comment drift: StudioDesignSurface.tsx near line 11382 ("each writes a draft") above createLive; the studio prop doc in PermissionMatrixEditor.tsx ("Presentation only: every write, gate and autosave is the routed page's"), now untrue because studio selects the save path; the "package's atomic Publish promotes" comment above saveVersioned.

④ Design judgment

  • Nothing in the diff contradicts the ruling 「人改一项、点保存、立刻生效。草稿加整包发布只留给 AI」. Human edits to permission sets, the OWD overview and field layout are now buffered and go live on Save. Changes and Publish are left to drafts.
  • note — card item 6 is done for objects and flows only, and the PR body says so. A permission set, a hook, an added action or an OWD row that holds an AI draft publishes that draft with the person's Save and draws no AI line. For a permission set this means AI-written grants go live with an unrelated human grant. The page does open on the draft version, the Access pillar still offers "Discard draft", and the OWD row shows "Unpublished draft" until it is edited. This is a scope limit, not a contradiction of the ruling. The seat should decide whether it needs a follow-up card.
  • No design fork needs the maintainer.

Implemented-by: claude/issue-36511-studio-save-cancel-3
Reviewed-by: session_01JQwxbZeHNsF3RWcWpj7rGj

VERDICT: FAIL

… controlled-by-parent prerequisite

A Save walks the changed rows one by one, each published as it is saved.
When a later row answered 409 DESTRUCTIVE_CHANGE, the Save opened the
prerequisite dialog without reading back the rows it had already
published, so they still showed as unsaved and the top bar's Cancel put
their dials back to a value the server no longer held. The page now reads
the rows back before it asks, keeping only the unsaved rows' edits.

A new suite pins that, the confirm saving the remaining row alone, and the
partial refusal: the refused row keeps its edit and is named, the other
row is live, and the draft the Save wrote is taken back. Three comments
that still described a draft-only save are brought up to date.

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

Copy link
Copy Markdown
Contributor

repo:objectstack#1 · os-warren · session_01JQwxbZeHNsF3RWcWpj7rGj

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: a4ee300c4a52bd4dbf534029517ceeb7b80e6e72
Local-runs: none
Scope: git diff f9e6bada7..a4ee300c4 — ui/packages/app-shell/src/views/studio-design/PackageOwdOverviewPanel.tsx, ui/packages/app-shell/src/views/studio-design/PackageOwdOverviewPanel.partialSave-36511.test.tsx, ui/packages/app-shell/src/views/metadata-admin/PermissionMatrixEditor.tsx, ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx + .changeset/36511-studio-save-cancel.md, .changeset/36511-studio-save-cancel-3.md, the round-1 record for f9e6bada7dae37ef5ed98cf0b1576c297a0bcbfd and every file it cites
Security-touching: yes
Rule-change-verified: none

Round 2: one commit on top of the round-1 head, a4ee300c4a ("fix(studio): the OWD overview reads live rows back before it asks the controlled-by-parent prerequisite"). Four files, all under ui/packages/app-shell/. It changes PackageOwdOverviewPanel.doSave, adds one test suite, and rewords three comments. Nothing under .changeset/, packages/ or ui/packages/i18n/ moves. Both round-1 should-fix items are closed. The round-1 judgments not named below carry unchanged, because the code they rest on is not in this delta.

① Derived judgments

  • Carried from round 1, still true: Clause-②: no and Metadata-protocol: none; no package export moves; en and zh keys are in parity; the AI discard is per item (DELETE /meta/:type/:name?state=draft&package=) and the server accepts it (META_ITEM_RESET_PARAMS).
  • The delta adds no export, no i18n key and no route call that round 1 did not already cover. reloadKeeping is a local function inside doSave.

② Semver level

  • Carried: .changeset/36511-studio-save-cancel-3.md is @object-ui/app-shell patch and @object-ui/i18n patch, correct for Metadata-protocol: none. The file is unchanged in this delta, and the fix stays inside what it describes.

DELIBERATE CORRECTION confirmed: yes — .changeset/36511-studio-save-cancel.md, last sentence only. The file is byte-identical to the round-1 head (git diff f9e6bada7..a4ee300c4 -- .changeset is empty), and no other pending changeset is modified.

③ Boundary flags

  • Round-1 should-fix 1: closed. doSave now records each published row in savedNames. On a 409 DESTRUCTIVE_CHANGE after at least one row went live, it calls reloadKeeping before it opens the dialog. The rows read back from the server, and only rows not yet saved keep their edit. Cancel then restores from fresh rows, so it can no longer show a value the server does not hold.
  • Round-1 should-fix 2: closed. PackageOwdOverviewPanel.partialSave-36511 has three tests on a stateful server double: a refused publish (the other row live, the refused row still edited and named, the draft taken back at the package); the prerequisite after an earlier row went live, then Cancel; the confirm's second pass.
  • The tests bind the fix. On the old code, tests 2 and 3 fail at expect(queryByTestId('owd-dirty-a_alpha')).toBeNull(), because the early return did no reload. Test 3 would also see a second save and publish of a_alpha. Test 1 pins behaviour the old code already had; that is the pin round 1 asked for.
  • Second pass scope: correct. After the reload the saved rows are clean, so changed holds only the remaining rows. force is still sent only on rows with relations.length > 0. confirmPrereq reads the doSave of the latest render, so it sees the reloaded rowState.
  • Shared path: the final partial-refusal branch now calls the same reloadKeeping with changed minus savedNames. That is the same set as the old refused list, with the same edits.
  • note — the dials are not disabled while a Save is in flight. load() resets every edit, so a dial changed during the save or the reload is dropped. This was already true of the normal save path before this PR; the fix adds one more reload with the same window. Not introduced here.
  • note — a row refused earlier in the same pass loses its reason line when the prerequisite dialog opens (the pass returns declined). Its edit is kept, and the second pass sends it again.
  • Carried: permission-set refused publish is correct and pinned; both AI discards ask before dropping unsaved edits; a person-written draft draws no AI line; no test was weakened; server-side authority is unchanged (no server file in the PR; the per-item publish door's gates were not compared line by line with the package publish door's).
  • Carried note — the per-item discard asks nothing when the page is clean, and on a never-published AI item it removes the item while the title says "go back to the live version". The dev left this as is.
  • Round-1 comment-drift note: closed. The studio prop doc, the comment above saveVersioned, and the comment above the permission-set dialog's createLive now match the code.

④ Design judgment

  • Carried: nothing contradicts the ruling 「人改一项、点保存、立刻生效。草稿加整包发布只留给 AI」. The fix makes the OWD page say the truth about which rows are live.
  • Carried note — the AI line exists for objects and flows only. An AI draft on a permission set, a hook, an added action or an OWD row goes live with a person's Save and draws no AI line. This is a scope limit the PR body states, not a contradiction of the ruling. The seat decides whether it needs a follow-up card.
  • No design fork needs the maintainer.

Implemented-by: claude/issue-36511-studio-save-cancel-3
Reviewed-by: session_01JQwxbZeHNsF3RWcWpj7rGj

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor

repo:objectstack#1 · os-warren · session_01JQwxbZeHNsF3RWcWpj7rGj

维护者速读

「人改完点保存、立刻生效」这件事的最后一步:权限集、对象访问总览、字段布局也改成右上角「取消 / 保存」,保存即生效;新建对象、流程、权限集时按钮写「创建」,建好就生效。
AI 留下没发布的改动时,页面会提示「保存会一并生效」,也可以只放弃这一项 AI 的改动。人和 AI 同时改一项时,保存会被拦下并让人选「覆盖」或「重新载入」,不会悄悄丢改动。
复核两轮后通过;CI 除一项按规则预期的红灯外全绿,约 1500 行(多为测试),非受管面,席位落地。合并后这张卡关闭。
要你做的:无。

席位核对 — ACCEPT (L1) · repo:objectstack#1 · head a4ee300c · 2026-11-23T09:38Z

  • Shape: Fixes #36511, PR 3 of 3 (PR 1 feat(studio): the object page saves with Cancel and Save in the top bar, live at once #36597 and PR 2 feat(studio): hooks, an installed app's added actions and flows save with Cancel and Save, live at once #36634 merged). 37 files under ui/packages/app-shell/src/views/{studio-design,metadata-admin} and ui/packages/i18n/src/namespaces/studio/{en,zh}.ts; one new patch changeset plus a one-line edit to PR 1's. Tier S (check-governed-merges: 0 of 37 paths governed, +1228/−172 under the human-merge threshold). Clause-②: no, Metadata-protocol: none: no spec, server route or exported contract moves, so no L2 face.
  • Ruling held: epic 专题:Studio 的保存方式和用词(人工修改保存即生效,草稿加整包发布只留给 AI;设置页说业务话;页签和顶部导航重排) #36510, 「人改一项、点保存、立刻生效。草稿加整包发布只留给 AI」. Every human editor named on the card is now save-and-publish one item at a time; the batch publish stays for the AI. The full-metadata item page keeps its own buttons, as the card says.
  • Read: the AI discard sends DELETE /meta/:type/:name?state=draft&package= for that one item, the per-item draft reset the CLI already uses (packages/cli/src/commands/meta/delete-reset-carriers.test.ts), never the package batch discard; it asks first when the page has unsaved edits, and a person's own draft draws neither the notice nor the button. Concurrent person + AI edits stay version-pinned (If-Match / If-None-Match: *) and open the existing conflict dialog; nothing is written until the person picks overwrite or reload (draftVersionConflict-11773). A refused permission-set publish keeps the grant unsaved and takes back the draft it wrote. Live saves send the metadata-refresh pulse instead of a "draft saved" report, so the Changes count re-reads the ledger.
  • Tests: four suites added, every rewritten or label-only suite listed in the body, none retired, none skipped. The OWD suites' rewrites follow the button moving to the top bar (owd-save → studio-save, the fakes gain publish). Thread's local run at this head: 511 files / 5100 tests passed; check:i18n-drift, check:test-source-alias, type-check (105) and ESLint clean.
  • Branch: main merged in at f590f3eb (no rebase); split commit c496e8b7b8 is not an ancestor. K = 2 first-parent commits behind main (< 15), re-read at this ACCEPT.
  • DELIBERATE CORRECTION: Check Changeset is red by design: the PR rewrites the last sentence of PR 1's pending note .changeset/36511-studio-save-cancel.md (declared in 7096114323). The PR also changes code, so the confirmation is the same-head at-tier contract-review PASS 7096452455 at a4ee300c, which quotes the base and new sentence and judges the new one true of main plus this PR; this ACCEPT cites it and names the same note. Round 1 (7096256689, FAIL at f9e6bada) had two should-fix items on the OWD overview: rows already live left marked Unsaved when a later row asks the controlled-by-parent prerequisite, and no partial-refusal pin. Both closed in a4ee300c (reloadKeeping; new PackageOwdOverviewPanel.partialSave-36511, two of whose three tests fail on the old code). Open notes, non-blocking: the AI notice covers objects and flows only; the per-item discard asks nothing on a clean page.
  • Gates: 62 check-runs on a4ee300c: 45 success · 15 skipped · 2 failed, both Check Changeset (jobs 137592717355, 137593198887), the DELIBERATE CORRECTION red by design, confirmed above by the same-head PASS 7096452455. Every Test UI shard green.
  • Landing: ready + auto-merge now. On merge Studio 里人工修改改成「保存」「取消」,保存后这一项立刻生效;不再自动存草稿,不用整包发布 #36511 closes and the seat clears its pm:dispatched.

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.

Studio 里人工修改改成「保存」「取消」,保存后这一项立刻生效;不再自动存草稿,不用整包发布

2 participants