Skip to content

fix(app-shell): the metadata editor's save-status chip reads "Not saved" while a refused auto-save is held - #29974

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-2vnf9r
Nov 3, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-2vnf9r

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread

Fixes #29901

维护者速读

  • 改了什么: 元数据编辑页(Studio「全部元数据」条目页、Setup 元数据页)工具栏上 Save 旁的保存状态提示,新增「未保存」状态:服务端以 422 拒收草稿、或检查器挡着一个错误(如 CEL 解析失败)时,显示红色「未保存 — 修正错误后才能保存」,悬停给出与 Save 按钮相同的原因;不再显示琥珀色「自动保存中…」。
  • 为什么改: 被拒后自动保存其实已停(不会再发 PUT),提示却一直说「自动保存中…」,作者只看提示会以为已保存,离开页面就丢了修改(p2)。
  • 风险与回滚: 只改提示的显示,何时保存、何时挡住完全不变;读的就是已经挡住自动保存和 Save 按钮的两个信号,不重算。新增一条中英文文案。@object-ui/app-shell、@object-ui/i18n patch。回滚 = revert 本 PR。
  • 先看: ResourceEditPage.tsx 的 SaveStatusIndicator(新的 held 分支)及其渲染处传入的 held={inspectorBlocking > 0 || refusalBlocking > 0};测试 ResourceEditPage.serverRefusalGate.test.tsx 末尾的 (#29901) describe。
  • 两分钟验证: pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/ResourceEditPage.serverRefusalGate.test.tsx packages/app-shell/src/views/metadata-admin/ResourceEditPage.celGate.test.tsx,预期 18 passed。
  • 需要你做的: 无,席位落地。

Clause-②: no
Metadata-protocol: none

What changes

  • @object-ui/app-shell, ResourceEditPage.tsx → SaveStatusIndicator. The chip gains a sixth state, held. While the page is dirty and a save door is shut on the draft, it reads engine.edit.notSavedHeld ("Not saved — fix the errors to save") in the destructive tone, with the Save button's own explanation (saveTitle) as its title. It outranks the auto-save promise and the plain "Unsaved" state; saving still outranks it, and create mode still hides the chip.
  • The signal is passed down, not recomputed: the render site passes held={inspectorBlocking > 0 || refusalBlocking > 0}, the same two terms that return the auto-save effect early and disable the Save button and the shortcut. When either term lifts, the chip falls back to "Auto-saving…" / "Unsaved" / "Saved HH:MM" as before.
  • Every chip state now carries data-testid="save-status" and a data-state (saving, held, autosave-pending, unsaved, saved), so tests read the kind, not the copy.
  • @object-ui/i18n, studio namespace: engine.edit.notSavedHeld in en.ts and zh.ts, beside engine.edit.autoSavingShortly. Nothing under packages/spec/** moved.
  • Nothing about when a save is sent or held changes.

Why

Card #29901: after the server refuses an auto-saved draft with 422 INVALID_METADATA, the auto-save effect returns early on refusalBlocking > 0, so no further PUT is sent, but the chip kept reading "Auto-saving…" for as long as the page stayed dirty, beside the red banners. An author who reads the chip believes the edit is stored and loses it on the next navigation.

Which holds are covered, and why (measured on origin/main 8a608d87): the auto-save effect has two validation returns, inspectorBlocking > 0 (an author-time fault the inspector reports, e.g. a CEL predicate that does not parse, kept with the draft slice it judged) and refusalBlocking > 0 (the server's 422, document-scoped). Both hold the auto-save the same way, so the chip must not promise a save under either; both are covered. The client's live Zod pass is not a term: per the boundary written in the page (9073cf018), a predicted verdict stays advisory, and the chip follows the save doors rather than gating anything.

Acceptance notes

  • A refusal that localises to no slice (held: []) is not a hold, and the chip does not call it one. By design that refusal gates nothing and Save stays enabled. The auto-save does not re-send the identical snapshot either (lastAutoSaveSnapshotRef), so until the author's next edit the chip still reads "Auto-saving…" while nothing is sent; the next edit of any kind does send. Left as it is: the order scopes this card to the two terms that hold the auto-save, and showing "Not saved" for an unheld refusal would be wrong again the moment an edit re-arms the timer. Noted, not filed.
  • With auto-save off, a held draft now reads "Not saved" instead of "Unsaved": the same two terms disable Save, so the stronger state is the accurate one there too.
  • Studio: an expression the engine refuses (RLS USING on a formula field, a null-unsafe validation predicate) keeps autosaving — the server verdict is shown on the field but never holds the save #27482 (whether an expression refusal holds the save) is untouched.

Verification

Head 4c50f374, worktree off origin/main 8a608d87 (after #29897's 04cbdf78b).

  • New pins, in the existing shared harnesses as top-level describes:
    • ResourceEditPage.serverRefusalGate.test.tsx → the save-status chip while a refusal holds auto-save (#29901):
      • CONTROL: an ordinary dirty edit with auto-save on reads autosave-pending, saves once, then reads saved.
      • The card's path: the auto-saved client.save(…, { mode: 'draft' }) (the PUT …?mode=draft door) answers 422 INVALID_METADATA through the real MetadataClient parser; the chip reads held with the server-refused title, still held past the debounce and after an unrelated edit, and client.save stays at one call.
      • Recovery: editing the slice the server named lifts the hold, the second save is accepted, the chip reads saved.
    • ResourceEditPage.celGate.test.tsx → the save-status chip while the inspector holds auto-save (#29901): a good predicate reads autosave-pending, a dangling operator reads held with the inspector title, a parseable one reads autosave-pending again.
  • Both files: Test Files 2 passed (2) · Tests 18 passed (18).
  • Ablation (scripts/ablation-replace.mjs, anchor if (held) { → if (false && held) {, x1 → x0, restored to the HEAD blob 57cd4216ded4 with git diff HEAD empty): 3 failed | 15 passed (18), all three new held/recovery tests with expected 'autosave-pending' to be 'held'; both CONTROLs stayed green.
  • @object-ui/app-shell... closure build (turbo, 68 tasks): exit 0.
  • Every test file that imports ResourceEditPage (106 files): Test Files 106 passed · Tests 962 passed. The full app-shell suite is CI's Test UI.
  • @object-ui/i18n suite (pnpm --dir ui exec vitest run packages/i18n/, includes all-locales-key-parity): 95 passed · 1443 passed / 13 skipped.
  • type-check (pnpm --dir ui --filter @object-ui/i18n --filter @object-ui/app-shell run type-check): exit 0 for both.
  • eslint as the package lint script runs it, on the three app-shell files: 0 errors; no warning on a changed line.
  • node scripts/check-sdui-manifest.mjs: exit 0 (sdui.manifest.json is present and intact; no registry change). node scripts/pm/dispatch-gates.mjs --commands on head 4c50f374: 35 derived commands, all 35 exit 0 (check:type-check-debt ran its own full-packages build under the lock). dispatch-gates --ran: 35 derived famil(ies) accounted for — 35 run, 0 NOT-MEASURED.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (spec untouched)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes (package lint run on the touched files; the repo-wide run is CI's).
  • 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 维护者速读 section is the Chinese summary for the maintainer).
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WGufzhoSygNDE4TgkcqHdD

The auto-save effect returns early while a server refusal (refusalBlocking)
or an inspector fault (inspectorBlocking) holds the draft, yet the chip kept
its "Auto-saving…" state for as long as the page stayed dirty. The chip now
reads those same two terms and shows a destructive "Not saved" state with the
Save button's explanation as its title, returning to the usual states once
the hold lifts.

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

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-support-ai · session_01WGufzjDyeFwq6AuFu3vwTd

维护者速读(席位终稿)

  • 改了什么:元数据编辑页(Studio「全部元数据」条目页、Setup 元数据页)Save 旁的保存状态提示新增「未保存」状态。服务端 422 拒收草稿,或检查器挡着一个错误(如 CEL 解析失败)时,显示红色「未保存 — 修正错误后才能保存」,悬停给出与 Save 按钮相同的原因,不再显示琥珀色「自动保存中…」。
  • 为什么改:被拒后自动保存其实已经停了,不会再发请求,提示却一直说「自动保存中…」。作者只看提示会以为已保存,离开页面就丢了修改。
  • 风险与回滚:低。只改提示显示,何时保存、何时挡住完全不变;读的是已经挡住自动保存和 Save 按钮的两个信号,不重算。新增一条中英文文案。回滚即还原本 PR。
  • 先看:ResourceEditPage.tsx 的 SaveStatusIndicator 新 held 分支,及渲染处 held={inspectorBlocking > 0 || refusalBlocking > 0}。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/ResourceEditPage.serverRefusalGate.test.tsx packages/app-shell/src/views/metadata-admin/ResourceEditPage.celGate.test.tsx,18 个用例全过。
  • 需要你做的:无,非受管面,CI 全绿后席位落地。
  • 席位意见:ACCEPT。照派发令把信号往下传而不是重算,两种挡住自动保存的情况都覆盖,恢复路径也有测试。

席位核对 · ACCEPT · head 4c50f37425a356b90c81076ce961c0e0fab7a2ab · 2026-11-03T20:44Z

  1. Shape: draft, base main, attribution block then Fixes #29901 (whole card lands). One changeset (@object-ui/app-shell + @object-ui/i18n patch) with Clause-②: no / Metadata-protocol: none; no content/docs/releases/; 6 files, +152/−9. check-governed-merges --pr 29974: NOT governed (0 of 6 paths), 161 lines ≤ 3000. No contract face; this seat's read is the review of record.
  2. Premise, measured: at origin/main the autosave effect returns early on inspectorBlocking > 0 and on refusalBlocking > 0 (~L2458), Save's disabled reads the same two terms (~L2899), and saveTitle (~L2665) is the button's explanation. The diff passes exactly those terms and that title to SaveStatusIndicator; no hold logic moved. The studio namespace has only en and zh; both carry the new key. Branch is 1 behind main.
  3. Gates: dev's local union at 4c50f374: 2 pinned files 18/18; every test importing ResourceEditPage (106 files, 962 passed); @object-ui/i18n suite green; type-check i18n + app-shell exit 0; turbo build 68 tasks exit 0; check-sdui-manifest exit 0; dispatch-gates --commands 35/35 exit 0, --ran 0 NOT-MEASURED. Ablation (if (held) disabled): the 3 new held/recovery cases red, CONTROLs green, blob restored. CI on this head was in progress at this reading; landing waits for every check green or expected-skip.
  4. Accepted deviation: every chip state now carries data-testid="save-status" + data-state, so tests read the kind rather than the copy. Additive markup, no visual change. Accepted.
  5. Out of scope: Studio: an expression the engine refuses (RLS USING on a formula field, a null-unsafe validation predicate) keeps autosaving — the server verdict is shown on the field but never holds the save #27482 (whether an expression refusal holds the save) untouched; no packages/spec/**. Skills-docs: not owed. mcp_calls: reads only, no write tool.
  6. Landing: ordinary queue. When every check on this head is green or expected-skip: relay pr_ready + automerge_enable, follow to MERGED, record the landing on Studio metadata editor: after the server refuses an autosave 422, the status chip keeps reading "Auto-saving…" although no further save is attempted #29901.

@github-actions github-actions Bot added 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 3, 2026
@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 3, 2026 21:19
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 3, 2026 21:19
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit b379262 Nov 3, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-2vnf9r branch November 3, 2026 22:19
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 metadata editor: after the server refuses an autosave 422, the status chip keeps reading "Auto-saving…" although no further save is attempted

1 participant