Repository navigation
Commit 34fe96f
fix(studio): removing a field that holds data asks before the Data pillar saves it (#35617)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuFHC3CpgeSgxYniLbe7jSsx)_
Fixes #34931
Clause-②: no
Metadata-protocol: none
Signature: repo:objectstack#1 · os-sales ·
session_01L6bhgUgZpbKcVYFC7iXgMu
## 维护者速读
- 用户能看到什么变化:平台管理员在 Studio
数据栏删除一个已发布且存有数据的字段时,不再只看到「更改未保存」,而是弹出确认框列出会丢失的数据,可选择强制保存或取消并找回该字段。
- 为什么做:属于「控制台核心业务操作体验」专题中的应用与 Studio 往返一项,让管理员能在 Studio 里把删字段这件事做完。
- 出错会怎样:最坏情况是确认框里强制保存把该字段的数据列变为不可访问(与其他编辑器的强制保存相同);改动只在界面层,可直接撤回。
- 要你做什么:无
## What changes
The Data pillar's object draft save (`DataPillar` in
`StudioDesignSurface.tsx`) now tells the door's `409 DESTRUCTIVE_CHANGE`
apart from every other refusal, by status and code
(`destructiveFindings` in `metadataError.ts`, which reads the client's
parsed `issues`).
- **The refusal opens a confirmation** instead of the generic strip. It
lists the refusal's findings in the server's own words, under the
existing `engine.edit.destructiveTitle` / `engine.edit.destructiveDesc`
strings, with **Force save** (`engine.edit.forceSave`) and **Cancel**
(`engine.cancel`). No locale key is added.
- **Force save re-sends the refused save whole**: the same body, to the
same object name and the same `packageId` the refused save wrote, with
`force: true` (`?force=true` on the draft door). The address is held
with the refusal, never re-derived, per the in-tree rule "The pair a
write names is the door's answer". It goes through the same
draft-version guard, so the `If-Match` pin still applies, and lands
through the same success path as an ordinary autosave (dirty cleared
only if the buffer did not move, verdict re-read, draft-saved toast).
- **Cancel keeps the field**: each field a finding names goes back into
the buffer as the server holds it (as loaded, or as last saved), at its
old position. If the buffer is then what the server stores, it is clean
and nothing is sent. If other edits are still pending, the autosave
sends those edits, without the removal.
- **While the confirmation is open the autosave is blocked**
(`destructive !== null` in its `blocked` guard), so a refused removal is
never re-sent behind another edit. The confirm cannot loop: the hook
never re-sends a snapshot it already attempted, a forced save that is
refused again goes to the strip, and a load of another object clears the
held refusal.
- The column-reorder save, which sends the same buffer, routes the same
refusal to the same confirmation.
Every other refusal goes through `objectSaveRefusal` exactly as before.
## Tests
New `DataPillar.destructiveChange-34931.test.tsx`, on a real
`MetadataClient` over a fetch double, so the URL each PUT left with is
the one the door reads. The field is removed through the field
inspector's header menu and its confirm, the way an author removes it.
- the 409 opens the confirm listing the finding's text, and no refusal
strip; Force save sends a second PUT with the same path, `force=true`,
`package=com.example.showcase`, `mode=draft` and a byte-equal body, and
the field stays removed;
- Cancel puts the field back on the Form canvas and sends nothing more
(2.3 s past the debounce, still one PUT);
- a 422 `INVALID_METADATA` refusal still shows the refusal strip and no
confirm.
<details><summary>Readings at 52a0afb</summary>
- `pnpm --dir ui exec vitest run
packages/app-shell/src/views/studio-design/DataPillar.destructiveChange-34931.test.tsx`:
Test Files 1 passed (1), Tests 3 passed (3).
- Ablation (the two source files restored to `e35cf035`, test kept,
restored afterwards byte-identical by blob hash): Tests 2 failed, 1
passed (3). The Force save and Cancel cases go red; the other-refusal
case stays green, as it pins unchanged behaviour.
- Neighbouring suites (`DataPillar.*`, `metadataError.*`,
`StudioDesignSurface.*` under `ui/`, at 887bbda, before the test-only
lint import): Test Files 177 passed (177), Tests 1307 passed (1307).
- `pnpm --filter @object-ui/app-shell type-check` (both tsconfigs): exit
0.
- `node scripts/pm/dispatch-gates.mjs --commands`: 39 derived commands,
all run locally, all exit 0; `--ran` reconciliation: 39 run, 0
NOT-MEASURED. `check:test-source-alias` first went red on the new test
(it reaches a dynamic `@objectstack/lint` import), and is green after a
module-top import in the test.
- `ui` `check:new-line-citations`: 0 new citations. `overlap-check`:
merges cleanly with `origin/main`, 0 open PR heads share a file.
</details>
## Acceptance notes
- The finding list shows the server's English prose in every locale, as
`ResourceEditPage` and `PermissionMatrixEditor` already do.
- Not extracted: the destructive confirm now exists in four places
(`ResourceEditPage`, `PermissionMatrixEditor`,
`PackageOwdOverviewPanel`, here). A shared dialog was out of scope for
this card.
- Browser verification in a booted example app is recorded in the dev
report comment on the card, not here: the pull request opens before that
run.
- Line budget: the diff is about 290 changed lines including the test,
above the 200-line target. The extra lines are the dialog markup and the
Cancel restore.
## Verification
Read first, by risk:
1. `StudioDesignSurface.tsx`, `keepDestructive`: the Cancel restore and
its dirty judgement.
2. `StudioDesignSurface.tsx`, `doSave`: the `forced` argument, which
must address exactly what the refused save did.
3. `metadataError.ts`, `destructiveFindings`.
Two-minute check: run the new test file (command above). Expect 3
passed.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgUgZpbKcVYFC7iXgMu)_
<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgUgZpbKcVYFC7iXgMu -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent ae2a67d commit 34fe96f
4 files changed
Lines changed: 286 additions & 11 deletions
File tree
- .changeset
- ui/packages/app-shell/src/views/studio-design
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
172 | 178 | | |
173 | 179 | | |
174 | 180 | | |
| |||
316 | 322 | | |
317 | 323 | | |
318 | 324 | | |
| 325 | + | |
319 | 326 | | |
320 | 327 | | |
321 | 328 | | |
| |||
397 | 404 | | |
398 | 405 | | |
399 | 406 | | |
400 | | - | |
| 407 | + | |
401 | 408 | | |
402 | 409 | | |
403 | 410 | | |
| |||
5494 | 5501 | | |
5495 | 5502 | | |
5496 | 5503 | | |
| 5504 | + | |
| 5505 | + | |
| 5506 | + | |
| 5507 | + | |
| 5508 | + | |
| 5509 | + | |
| 5510 | + | |
| 5511 | + | |
5497 | 5512 | | |
5498 | 5513 | | |
5499 | 5514 | | |
| |||
6187 | 6202 | | |
6188 | 6203 | | |
6189 | 6204 | | |
| 6205 | + | |
| 6206 | + | |
6190 | 6207 | | |
6191 | 6208 | | |
6192 | 6209 | | |
| |||
6597 | 6614 | | |
6598 | 6615 | | |
6599 | 6616 | | |
6600 | | - | |
| 6617 | + | |
| 6618 | + | |
| 6619 | + | |
| 6620 | + | |
| 6621 | + | |
| 6622 | + | |
| 6623 | + | |
| 6624 | + | |
| 6625 | + | |
| 6626 | + | |
| 6627 | + | |
| 6628 | + | |
6601 | 6629 | | |
6602 | 6630 | | |
6603 | 6631 | | |
6604 | 6632 | | |
6605 | 6633 | | |
6606 | 6634 | | |
6607 | 6635 | | |
6608 | | - | |
| 6636 | + | |
| 6637 | + | |
| 6638 | + | |
| 6639 | + | |
6609 | 6640 | | |
6610 | | - | |
| 6641 | + | |
| 6642 | + | |
| 6643 | + | |
| 6644 | + | |
| 6645 | + | |
| 6646 | + | |
6611 | 6647 | | |
6612 | 6648 | | |
| 6649 | + | |
6613 | 6650 | | |
6614 | 6651 | | |
6615 | 6652 | | |
6616 | 6653 | | |
6617 | 6654 | | |
6618 | 6655 | | |
6619 | 6656 | | |
6620 | | - | |
| 6657 | + | |
6621 | 6658 | | |
6622 | 6659 | | |
6623 | 6660 | | |
6624 | 6661 | | |
6625 | 6662 | | |
6626 | 6663 | | |
6627 | 6664 | | |
6628 | | - | |
| 6665 | + | |
6629 | 6666 | | |
6630 | 6667 | | |
6631 | 6668 | | |
6632 | | - | |
| 6669 | + | |
6633 | 6670 | | |
6634 | | - | |
| 6671 | + | |
| 6672 | + | |
| 6673 | + | |
| 6674 | + | |
| 6675 | + | |
6635 | 6676 | | |
6636 | 6677 | | |
6637 | 6678 | | |
6638 | 6679 | | |
6639 | 6680 | | |
| 6681 | + | |
| 6682 | + | |
| 6683 | + | |
| 6684 | + | |
| 6685 | + | |
| 6686 | + | |
| 6687 | + | |
| 6688 | + | |
| 6689 | + | |
| 6690 | + | |
| 6691 | + | |
| 6692 | + | |
| 6693 | + | |
| 6694 | + | |
| 6695 | + | |
| 6696 | + | |
| 6697 | + | |
| 6698 | + | |
| 6699 | + | |
| 6700 | + | |
| 6701 | + | |
| 6702 | + | |
6640 | 6703 | | |
6641 | 6704 | | |
6642 | 6705 | | |
| |||
6654 | 6717 | | |
6655 | 6718 | | |
6656 | 6719 | | |
6657 | | - | |
| 6720 | + | |
6658 | 6721 | | |
6659 | 6722 | | |
6660 | 6723 | | |
| |||
7014 | 7077 | | |
7015 | 7078 | | |
7016 | 7079 | | |
| 7080 | + | |
7017 | 7081 | | |
7018 | 7082 | | |
7019 | 7083 | | |
7020 | 7084 | | |
7021 | 7085 | | |
7022 | | - | |
| 7086 | + | |
| 7087 | + | |
| 7088 | + | |
7023 | 7089 | | |
7024 | 7090 | | |
7025 | 7091 | | |
| |||
7301 | 7367 | | |
7302 | 7368 | | |
7303 | 7369 | | |
| 7370 | + | |
| 7371 | + | |
| 7372 | + | |
| 7373 | + | |
| 7374 | + | |
| 7375 | + | |
| 7376 | + | |
| 7377 | + | |
| 7378 | + | |
| 7379 | + | |
| 7380 | + | |
| 7381 | + | |
| 7382 | + | |
| 7383 | + | |
| 7384 | + | |
| 7385 | + | |
| 7386 | + | |
| 7387 | + | |
| 7388 | + | |
| 7389 | + | |
| 7390 | + | |
| 7391 | + | |
| 7392 | + | |
| 7393 | + | |
| 7394 | + | |
| 7395 | + | |
| 7396 | + | |
| 7397 | + | |
| 7398 | + | |
| 7399 | + | |
| 7400 | + | |
| 7401 | + | |
7304 | 7402 | | |
7305 | 7403 | | |
7306 | 7404 | | |
| |||
0 commit comments