Repository navigation
Commit 192c15c
fix(app-shell): four Studio editors open no buffer over a draft the server refuses to read (#29275)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9Ubb6XXaS1k5WoFSG9mHkAJSe5)_
Part of #29148 (PR 1 of 2, the split the claim amendment 6574316242
records; PR 2 takes the Interfaces app nav, object, object-extension and
flow loads in `StudioDesignSurface.tsx` and `ResourceEditPage.tsx`, and
is the one that completes the card).
Clause-②: no
Metadata-protocol: none
The two lines are copied from the claim (comment 6574269114) and its
amendment (comment 6574316242).
## 维护者速读
- 改了什么:列表视图检查器、邮件模板/翻译表单编辑器、权限矩阵(包草稿入口)、钩子面板这四个 Studio 编辑器,读草稿遇到服务器
403(草稿带受众门
`requiredPermissions`,作者无权读)时,不再当成"没有草稿"去打开已发布版本,而是显示同一条拒绝说明,服务器原话放在"详情"里,自动保存没有内容可发。
-
为什么改:之前这几个编辑器会把已发布版本当作编辑起点,下一次自动保存把它写成草稿,悄悄抹掉草稿里的权限门和其他未发布改动,发布后该项对所有人可见。#29015
只修了 Interfaces 的叶子项,本 PR 修其中四个编辑器,其余在 PR 2。
- 风险与回滚:只影响草稿读取返回 403
的项;无草稿、可读草稿、其他读取失败的路径不变。钩子面板只拦被拒的那个钩子,其余钩子照常。回滚即撤销本 PR。
- 先看:`ObjectHooksPanel.tsx`(部分拒绝的处理);`PermissionMatrixEditor.tsx` 加载处的
`'refused' in pendingRead` 分支与两处渲染;`StudioBundleItemEditor.tsx`
错误条新增的"详情"。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/app-shell/src/views/studio-design/ObjectHooksPanel.draftUnreadable-29148.test.tsx`,预期
3 个用例通过。
- 需要你做的:无,席位落地。
## What changes
`readDraftForSave` has handed a draft read refused `403` back as
`refused` since #29132. These four editors now act on it the way the
Interfaces leaf load does: no buffer is installed, the
`engine.studio.refusal.draftUnreadable` sentence shows with the server's
own sentence (`formatMetadataError`) behind Details, and the autosave
has nothing to send. No new i18n key.
- `studio-design/ObjectListViewInspector.tsx`
(`useObjectListViewDraft`): a refused view draft read leaves the buffer
unloaded (`for: ''`, `row: null`) and sets `failure` to the new
`draftUnreadable` arm, which the panel's existing refusal host renders.
The published layer is not read.
- `studio-design/StudioBundleItemEditor.tsx`: a refused read installs no
draft, clears the guard's pins (`forget`), and shows neither the form
nor the preview. The editor's error host now renders a Details
disclosure when a refusal carries one (only this refusal does today).
- `metadata-admin/PermissionMatrixEditor.tsx` (package door, load only):
a refused read installs no matrix; the strip replaces it in both
presentations (routed page and the Studio Access pillar), and the
autosave is blocked. The pre-save re-read (it already refuses the save
when the draft read answers nothing) and the post-save verdict re-read
(installs nothing) are unchanged, per the claim amendment.
- `studio-design/ObjectHooksPanel.tsx`: the list load keeps the refused
hooks by name. A refused hook stays listed by its published row, pins
nothing, and opens no buffer: selecting it shows the strip in the detail
pane. A partial refusal holds only that hook; the other hooks load, edit
and save as before. A hook known only by its refused draft is not
listed, as today: nothing says it fires on this object.
## Tests
One new file per editor, each with a refused case, a control (no pending
draft: the published body opens and the first save is pinned
`If-None-Match: *`), and for the hooks panel a partial-refusal case.
- `ObjectListViewInspector.draftUnreadable-29148.test.tsx` (2): the real
hook and panel over a real `MetadataClient` and an in-memory server
whose `?state=draft` read answers 403.
- `StudioBundleItemEditor.draftUnreadable-29148.test.tsx` (2)
- `PermissionMatrixEditor.draftUnreadable-29148.test.tsx` (3): routed
page, Studio presentation, control.
- `ObjectHooksPanel.draftUnreadable-29148.test.tsx` (3): refused,
partial refusal, control.
Ablation, one per editor (`scripts/ablation-replace.mjs`, guard turned
into `false && …`, restore proven blob == HEAD): each refused case goes
red and each control stays green.
## Acceptance notes
- Each editor renders the strip in its own refusal host, in the Studio
refusal strip's look. Moving `StudioRefusalStrip` into a shared module,
so every editor draws the one component, is PR 2's (it edits
`StudioDesignSurface.tsx`, which open PR #29224 also edits).
- Changed lines 843: 162 in the four editors, 669 in the four new test
files, 12 in the changeset.
## Verification
Head `fc165c69` (main `47ee57fe` merged in), branched from `10bfd70e`.
The new tests and app-shell type-check were re-run on the merged head;
the sweep, the ui scripts suite and the gates ran on `b944048d`, before
the merge.
<details><summary>New tests and ablations</summary>
```
vitest run (4 new files): Test Files 4 passed (4), Tests 10 passed (10)
ablation bundle : 1 failed | 1 passed (refused case red, control green), restored blob == HEAD
ablation listview : 1 failed | 1 passed, restored
ablation perm : 2 failed | 1 passed, restored
ablation hooks : 1 failed | 2 passed, restored
```
</details>
<details><summary>Type-check and nearby suites</summary>
```
turbo run type-check --filter=@object-ui/app-shell: 65/65 tasks, exit 0 (tsc --noEmit and tsconfig.test.json)
vitest, the 80 test files naming the four editors (2 batches of 40): 40/40 (279 tests) and 40/40 (236 tests)
pnpm --dir ui exec vitest run scripts/: 169 passed | 2 skipped files, 4900 passed | 2 skipped tests
```
</details>
<details><summary>Derived gates</summary>
34 derived families run on b944048 (before the merge of main; main's
incoming commits touch none of the four editors), every one exit 0.
dispatch-gates --ran: 34 derived, 34 run, 0 NOT-MEASURED, 0 UNRUN.
```
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-sdui-manifest.mjs :: exit 0
node scripts/check-sdui-manifest.mjs --self-test :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:dispatcher-error-vocabulary :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:engine-double-contract :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:pm-changeset-deadline-census :: exit 0
pnpm check:published-files :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0
pnpm --dir ui exec vitest run scripts/ :: exit 0
```
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jTCMoEXh1SQzWaNp2v)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 32b9c6b commit 192c15c
9 files changed
Lines changed: 826 additions & 17 deletions
File tree
- .changeset
- ui/packages/app-shell/src/views
- metadata-admin
- 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
846 | 846 | | |
847 | 847 | | |
848 | 848 | | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
849 | 855 | | |
850 | 856 | | |
851 | 857 | | |
| |||
921 | 927 | | |
922 | 928 | | |
923 | 929 | | |
| 930 | + | |
924 | 931 | | |
925 | 932 | | |
926 | 933 | | |
| |||
978 | 985 | | |
979 | 986 | | |
980 | 987 | | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
981 | 994 | | |
982 | 995 | | |
983 | 996 | | |
| |||
1634 | 1647 | | |
1635 | 1648 | | |
1636 | 1649 | | |
1637 | | - | |
| 1650 | + | |
1638 | 1651 | | |
1639 | | - | |
| 1652 | + | |
1640 | 1653 | | |
1641 | 1654 | | |
1642 | 1655 | | |
| |||
1806 | 1819 | | |
1807 | 1820 | | |
1808 | 1821 | | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
1809 | 1838 | | |
1810 | 1839 | | |
1811 | 1840 | | |
| |||
2240 | 2269 | | |
2241 | 2270 | | |
2242 | 2271 | | |
| 2272 | + | |
| 2273 | + | |
2243 | 2274 | | |
2244 | 2275 | | |
2245 | 2276 | | |
| |||
2337 | 2368 | | |
2338 | 2369 | | |
2339 | 2370 | | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
| 2377 | + | |
| 2378 | + | |
2340 | 2379 | | |
2341 | 2380 | | |
2342 | 2381 | | |
| |||
0 commit comments