Skip to content

fix(app-shell): a landed Studio draft autosave names what it saved - #29310

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-l6odko
Nov 2, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-l6odko

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Fixes #28984

Clause-②: no
Metadata-protocol: none

The two lines are copied from the claim (comment 6574193432).

维护者速读

  • 改了什么:Studio 里草稿自动保存落地后,现在弹出一条点名的提示「Draft saved: 对象/页面/流程名」(中文界面为「已保存 X 的草稿」),覆盖 Data(对象及其定制扩展)、Interfaces(页面、仪表板、报表、应用导航)和 Automations(流程)三个支柱;顶栏的「Saved 时:分」保留不动。
  • 为什么改:[Decision] wave-3 checklist: five held items need a ruling before their ledger edits (#27377) #28345 裁决 ② 定了顶栏「已保存」不算写入反馈,只有点名条目的反馈才算;此前自动保存落地后界面上没有任何点名,ux-conventions.write-feedback 的 Studio 自动保存一行一直判红。
  • 风险与回滚:每个条目只用一个固定的提示 id,连续输入多次保存只会原地更新同一条提示,不会堆叠;保存被拒时仍走原有的拒绝条,不会说「已保存」。新增一个 studio 命名空间文案键,不改任何元数据或接口。回滚即撤销本 PR。
  • 先看:StudioDesignSurface.tsx 里新增的 announceDraftSaved 及其五处调用(只在保存成功之后调用);新测试 DataPillar.draftSavedNamed-28984.test.tsx。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/DataPillar.draftSavedNamed-28984.test.tsx,预期 3 个用例全部通过。
  • 需要你做的:无,席位落地。

What changes

  • ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx: one module helper, announceDraftSaved, shows toast.success("Draft saved: LABEL", { id }) with one sonner id per item (studio-draft-saved:TYPE:NAME). It is called in the five draft autosave saves of this file, right after the save has landed and before onDraftSaved:
    • Data pillar, the object save: named by the label the save stored (an edit of the object's own label names the new label), else the rail's label.
    • Data pillar, an object extension save (a package that customizes a base object): named by the open object's label.
    • Interfaces pillar, a leaf save (page, dashboard, report, and the other leaf types): named as the rail names the leaf.
    • Interfaces pillar, the app navigation save: named by the app's label.
    • Automations pillar, the flow save: named as the rail names the flow.
  • The old comment "No success toast: … the quiet last-saved hint is the affordance" is replaced: ruling 6545938831 ② on [Decision] wave-3 checklist: five held items need a ruling before their ledger edits (#27377) #28345 says that hint is not write feedback.
  • ui/packages/i18n/src/namespaces/studio/en.ts and zh.ts: one new key, engine.studio.draftSaved, "Draft saved: {item}" / 「已保存 {item} 的草稿」, in the voice of the discard row's engine.edit.draftDiscarded ("Draft discarded: {item}").
  • Root changeset .changeset/28984-studio-draft-saved-named.md, patch for @object-ui/app-shell and @object-ui/i18n.

Why

  • A toast, not inline status text, because Studio's other write rows are toasts: publish ("Published 1 item in this package"), discard ("Draft discarded: QA Widget"), the app and automation create rows (engine.studio.app.savedDraft, engine.studio.auto.savedDraft). One Studio voice. Sonner's toaster is an aria-live region, so the sentence is announced.
  • One id per item, not one per save, because the autosave fires 1.5 s after every editing pause. Sonner updates a toast that already carries the id instead of stacking a new one (the pattern PACKAGE_LIST_TOAST_ID already uses in this file). Typing a label gives one live toast; a second item saved meanwhile gets its own.
  • Called only after the save has landed. A refused or failed save keeps today's path (the refusal strip) and says nothing about saving; a conflict the author settled by reloading the saved version (outcome === 'reloaded') saved nothing and announces nothing.
  • The top bar's "Saved HH:MM", the Draft chip and the Changes counter are unchanged. Nothing is removed.
  • StudioRefusalStrip (changed by fix(studio): a refusal in a Studio strip is announced to screen readers #29224, now on main) is not touched; the five call sites and the helper are hunk-disjoint from it.

Tests

  • New DataPillar.draftSavedNamed-28984.test.tsx: the Data pillar's real autosave, a real MetadataClient over a fetch double, and sonner's real Toaster mounted, so the assertions read the toasts on screen.
    • a landed save shows one toast "Draft saved: Task" (called with { id: 'studio-draft-saved:object:showcase_task' }), and the top bar's data-saved-at hint is there;
    • a refused save (422) shows studio-refusal, no draft-saved toast and no call under that id;
    • Add field, then the field's label typed in its inspector (the card's own edit): at least two landed saves, two announcements, one toast on screen, every announcement under the one id. The toaster's duration is 60 s here, so the first toast is still up when the second save lands.
  • Ablation, two legs, each through scripts/ablation-replace.mjs on the committed fix (anchor 1 to 0, blob changed, restore proven equal to HEAD with an empty git diff HEAD):
    • the object save's announceDraftSaved( call replaced by a no-op function call: the landed and the repeated cases went red (expected [] to have a length of 1 but got +0), the refused case stayed green. A first attempt (void (…)) did not parse, so no test ran; it is not counted.
    • the toast id given a per-save random suffix: the repeated case went red at the on-screen count (one toast, updated in place, not a pile: expected [ …(2) ] to have a length of 1 but got 2), and the landed case at the id.
  • Related files: every app-shell test file naming StudioDesignSurface, DataPillar, InterfacesPillar or AutomationsPillar (221), plus the studio namespace tests in @object-ui/i18n and the studio catalogue pins in metadata-admin (zh-base-term.i18n-13131, studioAutomationCopy.plainLanguage-11659, inspectorStrings.studioNamespace-25922): 226 files, 1887 tests, green in five locked batches at c5511bd; after merging main, the same selection (230 files, 1910 tests, the new test included) green again at f9f3982.

Acceptance notes

Out of scope

Two observations, not measured as defects and not filed. They are listed for the next card on these editors.

  • Draft saves in five editors outside this card's file surface still name nothing (not measured live). useObjectListViewDraft (an Interfaces list-view leaf), ObjectHooksPanel, PermissionMatrixEditor and StudioBundleItemEditor run the same draft autosave, and the Data pillar's column drag-reorder (doReorderFields) saves a draft directly. None of them calls announceDraftSaved.
  • The toast sits over the top bar's Draft chip and "Saved" hint while it shows. The Console's toaster is anchored top-centre (its own pin, ConsoleToaster.autoDismiss-7482). At 1440 px the toast covers the header's Draft chip and saved hint for its 4 s. Publish and discard toasts already show in the same place, so this placement is shared and is not specific to this card.

Verification

  • Live, the card's reproduction, before and after (head c5511bd, full pnpm build 12m31s locked): objectstack dev --seed-admin --fresh for the showcase on a private port, the Console served from source by Vite with DEV_PROXY_TARGET, signed in as the seeded admin. As in the card: POST /api/v1/packages (com.qa.r6wf, namespace qrsix), then PUT /api/v1/meta/object/OBJECT?package=com.qa.r6wf with label "QA Widget", sharingModel: "private" and text fields name and note. Studio › Data › the object › Form › "Note" › Label cleared and typed "QA Remark" in three bursts with editing pauses, then Tab, sampled every 100 ms to 6 s after the last keystroke.
    • This branch: three PUT …?mode=draft&package=com.qa.r6wf&surface=studio, all 200. At most one toast on screen at any sample, its text "Draft saved: QA Widget" throughout; the top bar still read "Saved 10:18 AM".
    • origin/main's StudioDesignSurface.tsx (swapped in under a restarted vite --force, the served module checked to carry no announceDraftSaved against a positive control on the restored file, then restored, blob equal to HEAD and git diff HEAD empty): the same three PUTs, all 200; zero toasts over the window, no status or alert text; only the top bar's "Saved 10:20 AM".
  • Built types (Clause-②): ui/packages/i18n/dist/namespaces/studio/en.d.ts declares STUDIO_EN as a Record from string to string after the build; the new key is in en.js and in no .d.ts. It widens no published type.
  • Gates: node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 34 commands; all 34 ran at c5511bd and again at f9f3982 (after merging main; the same 34 derived), each exit 0, including node scripts/check-sdui-manifest.mjs and its --self-test, pnpm check:type-check-debt (locked) and pnpm --dir ui exec vitest run scripts/ (locked, 169 files, 4900 tests). --ran reconciliation at f9f3982: 34 derived, 34 run, 0 NOT-MEASURED.
  • Type-check: turbo run type-check --filter=@object-ui/app-shell --filter=@object-ui/i18n, 66 tasks green at c5511bd and at f9f3982.
  • Head f9f3982 merges origin/main at 8a8a03d (with fix(studio): a refusal in a Studio strip is announced to screen readers #29224) into the fix; the merge was clean, pnpm install --frozen-lockfile and pnpm build (13m20s locked) were rerun before the re-runs above, and the delta to main is the five files of this PR. The live probe ran at c5511bd; the merge touched StudioDesignSurface.tsx only in the refusal strip, which the probe's landed saves never draw.
  • Lint: eslint on the four touched ui files, 0 errors; its 43 warnings are all on existing lines of StudioDesignSurface.tsx, none on a changed line. The repo-wide run is CI's Lint UI.

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. (Measured on the touched files only; see Verification.)
  • 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: its generated artifacts are regenerated and committed. (Not touched.)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QsR2jQxMrtgg1LCjc1NmLf


Generated by Claude Code

A draft autosave in the Data, Interfaces and Automations pillars now toasts
"Draft saved: LABEL" once the save lands, under one sonner id per item, so
repeated saves of one item update one toast instead of stacking. The top
bar's saved hint stays; a refused save keeps its refusal and says nothing.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jQxMrtgg1LCjc1NmLf
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 2, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · zhuangjianguo · session_01QsR2jRFuJz9QBZqPVHYVhJ

维护者速读

  • 改了什么:Studio 草稿自动保存落地后,弹出一条点名的提示「Draft saved: 条目名」(中文「已保存 X 的草稿」),覆盖 Data(对象及其定制扩展)、Interfaces(页面、仪表板、报表、应用导航)和 Automations(流程);顶栏「Saved 时:分」保留。
  • 为什么改:[Decision] wave-3 checklist: five held items need a ruling before their ledger edits (#27377) #28345 裁决 ② 定了顶栏「已保存」不算写入反馈,只有点名条目的反馈才算;此前自动保存落地后没有任何点名,ux-conventions.write-feedback 的 Studio 自动保存一行一直判红。
  • 风险与回滚:每个条目一个固定提示 id,连续输入多次保存只原地更新同一条提示,不堆叠;保存被拒仍走原拒绝条,不说「已保存」。只新增一个 studio 命名空间文案键(类型为 Record<string, string>,不扩公开面)。回滚即撤销本 PR。
  • 先看:StudioDesignSurface.tsx 的 announceDraftSaved 及其五处调用(均在保存成功之后)。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/DataPillar.draftSavedNamed-28984.test.tsx,预期全绿。
  • 需要你做的:无,席位验收后进合并队列。

席位意见: 复用 Studio 现有点名提示的口吻和固定 id 写法,五处调用都只在落地之后。实测改前 0 条提示、改后最多 1 条「Draft saved: QA Widget」。无公开面变化,Clause-②: no 成立。

席位核对 — ACCEPT · domain:ui#2 · head f9f3982b · 2026-11-02T11:56Z

  • 形态: draft PR on main, Fixes #28984 on its own line and no other card number beside a closing keyword. 5 files, +247/−4, Tier S (not governed; under 3000 lines). All inside claim 6574193432's surface; StudioRefusalStrip untouched. Opened after PR fix(studio): a refusal in a Studio strip is announced to screen readers #29224 landed (8a8a03d) with main merged, as the claim's serial line required.
  • 前提实测: at origin/main the draft-autosave paths showed only data-saved-at (the DataPillar comment said "No success toast … the quiet last-saved hint is the affordance"). The dev's live showcase run with the card's repro (three label bursts, 6 s windows): main 0 toasts; this head at most 1 toast on screen, "Draft saved: QA Widget", 3 draft PUTs 200. Seat read: each of the five announceDraftSaved calls sits after the awaited save and before onDraftSaved, inside the try, so a refused save (the catch) announces nothing.
  • 门禁 check-runs (pinned to head f9f3982b3ada33b13dc8fe45f02a5e2a87dd0863): 44 success, 11 skipped, 0 failed, 0 pending, including Lint & Repo Gates, TypeScript Type Check, Type Check UI, Lint UI, Check Changeset and Test UI. Dev local gates: 34/34 derived families exit 0, --ran 0 NOT-MEASURED; 230 related files / 1910 tests green after the merge. Built dist/namespaces/studio/en.d.ts is Record<string, string>.
  • 接受的偏差: none beyond the card. The toast form was chosen over inline status because Studio's publish and discard already speak in toasts.
  • 范围外去向: two unmeasured observations, carried here for the next card on those surfaces and not filed (the filing gate needs one measured wrong result): (1) autosaves outside this surface still name nothing: useObjectListViewDraft, ObjectHooksPanel, PermissionMatrixEditor, StudioBundleItemEditor, Data column reorder; (2) the top-centre toast covers the header's Draft chip and Saved hint for its 4 s, the placement publish/discard toasts already use. Seat 5's Studio Interfaces pillar: a leaf edit whose save was refused (422) is seen by no unsaved-changes guard, so a reload drops it silently #29113 / Studio editors still read a refused (403) draft as "no draft" and can save the published body over it: Interfaces app nav, ResourceEditPage, list view inspector, bundle item, permission matrix, hooks #29148 edit the same file later and merge main first.
  • 落地条款: Clause-②: no, so no contract review is owed. mergeable_state is clean. Land by pr_ready + automerge_enable.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 2, 2026 11:57
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 2, 2026 11:57
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit bbfccbd Nov 2, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-l6odko branch November 2, 2026 12:40
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/m 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: a draft autosave names nothing — only the top bar's "Saved HH:MM" shows, which the write-feedback convention does not count (ruling on #28345)

1 participant