Repository navigation
Commit 9324232
fix(console): a packaged action switched off for this deployment is no longer offered as a live button (#28115)
<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgDFH4S5pR1C8YvYCWWsZfXx)_
## 维护者速读
- 改了什么:管理员在 Setup › Packaged automation
关掉的打包动作,控制台不再给出可点的按钮;记录页标题栏、操作栏、快捷动作、列表/关联列表工具栏、行动作和批量动作一律不显示,重新打开后按钮回来。
- 为什么改:以前按钮照样亮着,点了只会弹出写给工程师的报错(表名、ADR 编号)。服务端已由 #27842(PR
#27964)在对象读的信封里下发 `disabledActions`,本 PR 是读它并隐藏的 ui 半边。
- 风险与回滚:只在服务端给出名字时才隐藏,缺键(旧后端、内联 schema)一律照旧显示;标记用 symbol 挂在动作对象上,不进
JSON,不会被存回元数据。回滚即 revert 本 PR。
-
先看:`ui/packages/core/src/utils/action-activation.ts`(标记与判定)、`ui/packages/app-shell/src/providers/MetadataProvider.tsx`(`cloneServedObject`
与
`ingestObjectList`,按名读的副本保留标记)、`ui/packages/components/src/renderers/layout/containers.tsx`(标题栏闸门)。
- 两分钟验证:showcase 里把 Mark Done 关掉,打开任一未完成的 Task,标题栏和下方操作栏都没有 Mark Done;在
Setup 里重新打开,刷新后两处都回来。
- 需要你做的:无,席位落地。
Fixes #27504
Consumer-of: #27842
Clause-②: yes (widening) — four new `@object-ui/core` exports:
`ACTION_SWITCHED_OFF_KEY`, `markSwitchedOffActions`,
`markSwitchedOffActionsByObject`, `isActionSwitchedOff`
Metadata-protocol: none
## What changes
The object reads serve, beside the document, the names of the actions
this deployment switched off (`disabledActions`, #27842: a `string[]` on
`GET /meta/object/NAME`, a map keyed by object name on `GET
/meta/object`). The console reads it and stops offering those actions.
- `@object-ui/core`: `utils/action-activation.ts` stamps a switched-off
action entry under a symbol key (`markSwitchedOffActions`,
`markSwitchedOffActionsByObject`) and answers `isActionSwitchedOff`. A
symbol rides through a spread (localization, a promoted bulk def) and
never reaches `JSON.stringify` or `Object.keys`, so an action handed
back to a metadata write never carries it.
`ActionEngine.getActionsForLocation` and `getBulkActions` leave such an
action out.
- `@object-ui/data-objectstack`: the single-object read stamps from its
envelope before unwrapping `item`, beside the existing `sortability`
carry.
- `@object-ui/app-shell`: `MetadataProvider` stamps the whole list and a
package-scoped list through one ingestion (`ingestObjectList`). Its
by-name read hands out a `structuredClone` of the adapter's schema,
which drops symbol keys; `cloneServedObject` carries the stamps onto the
copy. Found live: without it the record header kept the button.
- Every action gate that already hides an action whose
`requiredPermissions` the caller lacks asks `isActionSwitchedOff` beside
it: `page:header` (`containers.tsx`), `action:bar`, the data table's row
action defs, `RowActionMenu`, `BulkActionBar`, the grid actions column,
`RelatedList` toolbar, `DeclaredActionsBar`, and the managed-by empty
state's list toolbar check.
- No `packages/**` file: the server half, including the plain refusal
sentence, landed with #27842.
## What to look at (preview)
`examples/app-showcase`, signed in as the seeded admin, viewport
1440×900.
1. Switch **Mark Done** (`showcase_mark_done`, object `showcase_task`)
off under Setup › Packaged automation › Packaged actions.
2. Open any task that is not done: the record header and the action bar
under the path show **Log Time** and **Archive** but no **Mark Done**.
3. Switch it back on and reload the task: **Mark Done** is back in both
places.
## Tests
- New: `core/src/utils/__tests__/action-activation.test.ts` (stamp,
spread, JSON, list form, engine location and bulk sets),
`components/src/__tests__/page-header-switched-off-27504.test.tsx`
(`page:header` and `action:bar`, hidden then offered again),
`data-objectstack/src/getObjectSchema.disabledActions-27504.test.ts`
(envelope carried, absent key stamps nothing),
`app-shell/src/providers/__tests__/MetadataProvider.disabledActions-27504.test.tsx`
(list envelope, absent key, by-name copy keeps the stamp).
- 128 test files that name the touched modules, 1056 tests, all passed
on c700e99. `type-check` passed for core, components, data-objectstack,
plugin-detail, plugin-grid and app-shell.
## Acceptance notes
- Hidden rather than disabled with a reason: it mirrors the capability
gate the same surfaces already apply, and it needs no new i18n key.
- Absence of `disabledActions` hides nothing, and `[]` hides nothing:
only a served name hides an action.
- The refusal toast a click that still reaches the door shows is the
server's sentence, which #27842 made plain ("This action is turned off
for this deployment. …").
## Verification
<details><summary>Repro on main 561b764 (before)</summary>
With Mark Done switched off, the record header and the
`record:quick_actions` bar both offered a live Mark Done, and a click
toasted "Action 'showcase_mark_done' is disabled — it is switched off
for this installation in the packaged-metadata activation ledger
(sys_metadata_activation, ADR-0126 §8). …". `GET
/meta/object/showcase_task` served `type`, `name`, `sortability`, `item`
and no activation state.
</details>
<details><summary>Live check against #27842's branch plus this change
(after)</summary>
Switched off: Mark Done buttons 0, Log Time 2. Re-enabled and reloaded:
Mark Done 2, Log Time 2. `GET /meta/object/showcase_task` served
`disabledActions: ["showcase_mark_done"]`; the list served
`showcase_task: ["showcase_mark_done"]`.
</details>
<details><summary>Ablations (each red, each restored to HEAD)</summary>
The `page:header` gate, the `action:bar` gate, the engine's location
filter, the adapter's stamp, the provider's list stamp and the by-name
copy's stamp carry were each disabled through
`scripts/ablation-replace.mjs`; the matching new test failed every time
and the restore matched HEAD's blob.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6CZny6X72Dx4kxxzLm7)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Utp6CZny6X72Dx4kxxzLm7
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent cdbf08d commit 9324232
19 files changed
Lines changed: 489 additions & 20 deletions
File tree
- .changeset
- ui/packages
- app-shell/src
- providers
- __tests__
- utils
- views
- components/src
- __tests__
- renderers
- action
- complex
- layout
- core/src
- actions
- utils
- __tests__
- data-objectstack/src
- plugin-detail/src
- plugin-grid/src
- components
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
363 | 394 | | |
364 | 395 | | |
365 | 396 | | |
| |||
783 | 814 | | |
784 | 815 | | |
785 | 816 | | |
786 | | - | |
| 817 | + | |
787 | 818 | | |
788 | 819 | | |
789 | 820 | | |
| |||
896 | 927 | | |
897 | 928 | | |
898 | 929 | | |
899 | | - | |
900 | | - | |
901 | | - | |
902 | | - | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
903 | 933 | | |
904 | 934 | | |
905 | 935 | | |
| |||
1047 | 1077 | | |
1048 | 1078 | | |
1049 | 1079 | | |
1050 | | - | |
| 1080 | + | |
1051 | 1081 | | |
1052 | 1082 | | |
1053 | 1083 | | |
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
832 | 832 | | |
833 | 833 | | |
834 | 834 | | |
835 | | - | |
| 835 | + | |
836 | 836 | | |
837 | 837 | | |
838 | 838 | | |
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
151 | 153 | | |
152 | 154 | | |
153 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
754 | 754 | | |
755 | 755 | | |
756 | 756 | | |
757 | | - | |
| 757 | + | |
758 | 758 | | |
759 | 759 | | |
760 | 760 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
2045 | 2045 | | |
2046 | 2046 | | |
2047 | 2047 | | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
2048 | 2051 | | |
2049 | 2052 | | |
2050 | 2053 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
228 | 229 | | |
229 | 230 | | |
230 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
231 | 235 | | |
232 | 236 | | |
233 | 237 | | |
| |||
304 | 308 | | |
305 | 309 | | |
306 | 310 | | |
307 | | - | |
| 311 | + | |
308 | 312 | | |
309 | 313 | | |
310 | 314 | | |
| |||
0 commit comments