Repository navigation
Commit 444dce6
fix(console): the record edit dialog opens locked with the closed sentence on a closed record (ADR-0162) (#39019)
Fixes #38997
Clause-②: yes (widening)
Metadata-protocol: none
The widening (L1 7333040997): the exported `lockedBy` prop of
`RecordFieldAccessScopeProps` (`@object-ui/permissions`) and of
`ModalFormProps` (`@object-ui/plugin-form`) accepts `'closed'` beside
`'approval'`. Level stays `patch`.
## 维护者速读
-
控制台里打开已关闭记录(如已付款发票)的完整编辑弹窗时,弹窗直接只读,提示“此记录已关闭,无法更改”,不再提供保存;以前弹窗可编辑,点保存才被服务器拒绝。审批中的记录与今天一样。
- 属于“记录关闭态锁”这一组工作,让编辑弹窗与记录页对已关闭记录给出同一个答案。
- 出错时,已关闭记录的弹窗可能仍可编辑(服务器照旧拒绝保存),或审批中的记录显示成“已关闭”;改动只在控制台,可直接撤回。
- 无
## What changes
Item 2 of the card: the console's full-record edit dialog locks on a
closed record. Item 1 (the edit-state save order) landed in #39007.
- **Dialog** (`ui/packages/app-shell/src/console/AppContent.tsx`): reads
`recordClosedByLock` from the `useRecordApprovals` hook the dialog
already uses for its approval lock, and hands `ModalForm` `lockedBy:
'closed'`. Precedence: **closed wins** over an approval hold, as on the
record page (`recordClosedByLock` is true for a record both closed and
held). An approval-held record that is not closed keeps `lockedBy:
'approval'`, unchanged.
- **Scope** (`ui/packages/permissions/src/RecordFieldAccessScope.tsx`):
`lockedBy` accepts `'closed'` beside `'approval'`. The row's update is
refused with the new reason `record-closed`, and every field of it is
not writable, exactly as for `'approval'`. A projection answering
`writable: false` keeps its own reason, as it already does over
`'approval'`.
- **Form gate** (`ui/packages/plugin-form/src/fieldWriteGate.ts`):
`record-closed` maps to a new `'closed'` affordance, and
`closedForRecord` treats it like `'approval'`, so the dialog (and the
drawer) offer no Save.
- **Notice** (`closedAffordanceNotice.tsx`): `'closed'` says the record
page's closed sentence, `detail.lockedClosedTooltip` ("This record is
closed, so it can't be changed."). No new locale key; the provider-less
defaults row repeats the en value (`check:i18n-keys` green).
- `ModalForm.tsx` and `recordFieldAccess.tsx` widen `lockedBy` to the
scope's own prop type.
- Changeset: `.changeset/38997-edit-dialog-closed-lock.md` (permissions,
plugin-form, app-shell; patch).
## Tests
Written first and run red (6 red, 23 existing green), then green after
the fix.
- `AppContent.editDialogApprovalLock-27138.test.tsx`, new describe: a
closed record hands `lockedBy: 'closed'`; a closed record a pending
approval also holds hands `'closed'`; a closed record sends exactly the
three lock reads an open one sends. The approval-held cases above it are
the control and are unchanged (`'approval'`).
- `recordFieldAccess.rowWritable-27138.test.tsx`, new describe:
`ModalForm` with `lockedBy="closed"`, on a writable row and on a data
source without the projection, draws every field read-only, the notice
with `data-affordance="closed"` and the closed sentence, and no Save.
- `RecordFieldAccessScope.rowWritable-27138.test.tsx`: `lockedBy:
'closed'` refuses the update with `record-closed` before any answer and
over `writable: true`; read stays allowed.
<details><summary>Ablation (restored, blob equal to HEAD)</summary>
- `AppContent.tsx`: the closed test replaced by `false` turns the 3 new
dialog cases red; the 6 approval and control cases stay green.
</details>
## Acceptance notes
- Requests: none added. The dialog reads the hook it already mounted.
Over a list it sends the same three lock reads as before (pinned for a
closed record too); on a record page the hook joins the page's payload
answer. The record page's one-request pins (27627, 28470, 12701, 13010,
28737) pass unedited.
- Precedence chosen: closed over approval, the record page's rule;
stated in the code comment and the changeset.
- The drawer form (`DrawerForm`) shares the gate and would draw the
`'closed'` affordance too, but no host passes it a `lockedBy` today; not
changed here.
## Verification
Two-minute check, from `ui/`: `pnpm exec vitest run
packages/app-shell/src/console/__tests__/AppContent.editDialogApprovalLock-27138.test.tsx`:
9 passed, including the three closed cases.
Read first: `AppContent.tsx` (the precedence line), then
`RecordFieldAccessScope.tsx` (the refusal reason), then
`fieldWriteGate.ts`.
<details><summary>Local readings, head c564f48</summary>
- plugin-form and permissions suites: 272 files, 3,028 passed, 1
skipped.
- app-shell: all 55 `AppContent*` files plus the five one-request
record-open pin files: 60 files, 626 passed.
- `type-check`: permissions, plugin-form and app-shell exit 0 (after
rebuilding the permissions and plugin-form dist the downstream tsc
reads).
- eslint on the nine touched files (package config): 0 errors. With
`--no-inline-config` one error stands in `ModalForm.tsx` ("Cannot create
components during render"), present at the same place on main.
- `dispatch-gates --ran` at c564f48: 38 derived, 38 run, 0
NOT-MEASURED. ui `check:i18n-keys`: exit 0.
</details>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ
<!-- signed: repo:objectstack@os-support-ai · os-support-ai ·
session_01WGufzhKEbEnW8pwZRgK2gJ -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f28c39f commit 444dce6
10 files changed
Lines changed: 144 additions & 27 deletions
File tree
- .changeset
- ui/packages
- app-shell/src/console
- __tests__
- permissions/src
- __tests__
- plugin-form/src
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
1079 | 1079 | | |
1080 | 1080 | | |
1081 | 1081 | | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
1082 | 1091 | | |
1083 | 1092 | | |
1084 | 1093 | | |
| |||
1774 | 1783 | | |
1775 | 1784 | | |
1776 | 1785 | | |
1777 | | - | |
| 1786 | + | |
1778 | 1787 | | |
1779 | 1788 | | |
1780 | 1789 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
26 | 31 | | |
27 | 32 | | |
28 | 33 | | |
| |||
131 | 136 | | |
132 | 137 | | |
133 | 138 | | |
134 | | - | |
| 139 | + | |
135 | 140 | | |
136 | 141 | | |
137 | 142 | | |
| |||
143 | 148 | | |
144 | 149 | | |
145 | 150 | | |
146 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
147 | 157 | | |
148 | 158 | | |
149 | 159 | | |
| |||
238 | 248 | | |
239 | 249 | | |
240 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | | - | |
| 43 | + | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
| |||
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
65 | | - | |
66 | | - | |
67 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
68 | 74 | | |
69 | | - | |
| 75 | + | |
70 | 76 | | |
71 | 77 | | |
72 | 78 | | |
| |||
168 | 174 | | |
169 | 175 | | |
170 | 176 | | |
171 | | - | |
| 177 | + | |
| 178 | + | |
172 | 179 | | |
173 | 180 | | |
174 | 181 | | |
| |||
238 | 245 | | |
239 | 246 | | |
240 | 247 | | |
241 | | - | |
| 248 | + | |
| 249 | + | |
242 | 250 | | |
243 | 251 | | |
244 | 252 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
140 | 154 | | |
141 | 155 | | |
142 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
320 | | - | |
| 320 | + | |
| 321 | + | |
321 | 322 | | |
322 | 323 | | |
323 | 324 | | |
324 | | - | |
| 325 | + | |
325 | 326 | | |
326 | 327 | | |
327 | 328 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| 59 | + | |
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
| |||
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
90 | | - | |
91 | | - | |
92 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
93 | 98 | | |
94 | 99 | | |
95 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
284 | | - | |
| 284 | + | |
| 285 | + | |
285 | 286 | | |
286 | | - | |
| 287 | + | |
287 | 288 | | |
288 | 289 | | |
289 | 290 | | |
| |||
294 | 295 | | |
295 | 296 | | |
296 | 297 | | |
| 298 | + | |
297 | 299 | | |
298 | 300 | | |
299 | 301 | | |
| |||
302 | 304 | | |
303 | 305 | | |
304 | 306 | | |
305 | | - | |
| 307 | + | |
306 | 308 | | |
307 | 309 | | |
308 | 310 | | |
| |||
313 | 315 | | |
314 | 316 | | |
315 | 317 | | |
316 | | - | |
| 318 | + | |
317 | 319 | | |
318 | 320 | | |
319 | 321 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
163 | 166 | | |
164 | 167 | | |
165 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
51 | | - | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| |||
0 commit comments