Repository navigation
Commit e14d9ce
Fixes #26191
Clause-②: no
Metadata-protocol: none
Part of the #26059 ruling (6416233738, Q3 child 5, item 2). UI and docs
only: no server change, no spec key.
## What changes
**The Delegated Admin Scope block lists the companion grants a delegate
needs.** A scope says what its holder may administer; it does not let
the holder in. Once the scope names a business unit (the block's
existing gate for its dependent controls), the block lists:
- `setup.access`: enter Setup
- `sys_user`, `sys_business_unit`, `sys_business_unit_member`: read, so
the lookups can pick people and units
- `sys_user_position`: create, read, edit and delete, for the assignment
rows
Each row is marked "On this set" or "Not on this set", read from the
draft being edited (`systemPermissions` and `objects`). A row counts as
granted only when every flag it needs is `true`; nothing is inferred.
**"Grant the missing ones" adds only what is missing, as one draft
edit.** It is one `setDraft` call, and the set's normal Save persists
it. `setup.access` is appended to `systemPermissions`. Each companion
object row gains only the flags it lacks. An existing row keeps every
key it already has (an extra Edit, a View All), and a row that already
covers its grant is left as the same object. Nothing is removed or
narrowed, and no new key is written: both keys already exist on
`PermissionSetSchema`. The button shows only when the set is writable
and something is missing.
**Under a package binding, the hint is shown without the action.** The
package door's draft holds, and its Save writes, only the package's own
objects (`scopePermissionSet` / `mergePermissionSlice`, ADR-0086 P0).
There, the `sys_*` rows would not survive Save, and their absence from
the draft says nothing about the stored set. So under a package the
block lists the five grants without a granted/missing mark and without
the button, plus a note: grant these in Setup, on an environment
permission set the delegate holds.
**How the facet knows it is package-bound.** `PermissionAdvancedFacets`
gains an optional `packageBound` prop. When the prop is omitted, it is
read from `only`. The Studio Access pillar is the one host that sets
`only`, and it always edits under a `packageId` (`AccessPillar`'s
`packageId` is required). Setup's permission page sets neither.
`PermissionMatrixEditor.tsx` is outside this card's claimed file
surface, so this PR does not wire `packageBound={!!packageId}` there.
See Acceptance notes.
**Docs.** `content/docs/permissions/delegated-administration.mdx`: the
authoring example now carries `systemPermissions: ['setup.access']`. A
new paragraph names the five companion grants and why each is needed,
and says the Setup editor lists them and grants the missing ones.
**Strings.** Nine new `perm.admin.companions.*` keys in
`metadata-admin/i18n.ts`, in both locales the block's existing strings
use (en, zh).
## Tests
`PermissionAdvancedFacets.companionGrants-26191.test.tsx` drives the
facet with the draft held as the host holds it. It has 10 cases:
- the five grants are listed and marked missing on an empty set
- grants the set already carries are marked granted, and read alone is
not CRUD
- the block is hidden until the scope names a business unit
- one click is one draft write, adds only the missing grants, and leaves
existing rows and an unrelated object untouched
- the written set parses under `PermissionSetSchema` and carries no new
key
- there is no action when nothing is missing
- read-only: the hint shows and the action does not
- `packageBound`: the hint shows unmarked, there is no action, and the
note shows
- the Studio mount (`only`) is package-bound by default
- an explicit `packageBound={false}` keeps the action
Red first, at `c3066c2b` (the test committed, the component not yet
changed): 9 failed, 1 passed. The one that passed is the "hidden until a
business unit is named" case, which holds both before and after the
change. The failures were `Unable to find
[data-testid="admin-companions"]` and the like, not errors.
Green, all at head `8ecd7344` (this branch with `main` merged after
#26284 landed), from cwd `ui/` under `scripts/pm/os-verify-lock.sh`:
- `pnpm exec vitest run FILES --maxWorkers=2` over 254 files: every
app-shell test file that imports `PermissionAdvancedFacets` or
`views/metadata-admin/i18n`, the new file included. `Test Files 254
passed (254)`, `Tests 2578 passed (2578)`. The lock's verdict was
`command-exit 0`. The full app-shell suite was not run locally; CI runs
it.
- `eslint` on the three changed source files: 0 errors and 5 warnings.
Two warnings are new, both `no-explicit-any` in the test harness, where
the updater's `prev` is typed `any`, as the prop itself types it. The
other three are on existing lines.
- `pnpm --filter @object-ui/app-shell type-check`: **NOT MEASURED**
locally. It ran without the `@object-ui/*` dependency closure built, so
it answered only unresolved-module cascades (TS2307 / TS7006). None of
them is on a line this PR adds. CI's `Type Check UI` is the reading.
- `node scripts/pm/dispatch-gates.mjs --commands`: 68 derived commands,
reconciled with `--ran` as 66 run (all exit 0) and 2 NOT MEASURED. Both
of those are exit-3 prerequisite refusals: `check:skill-examples`
(`packages/client-react` was not built; this page's example block
carries no type-check marker) and `check:type-check-debt` (it needs the
shared lock for its closure build and timed out in the queue). CI's
`Lint & Repo Gates` runs both.
- `node scripts/check-sdui-manifest.mjs`: exit 0. app-shell has no sdui
record, so there was nothing to re-record.
## Acceptance notes
- **Package binding wiring.** The package-bound default is read from
`only`, not from `packageId`, because `PermissionMatrixEditor.tsx` is
outside this card's file surface (#26284 held it). Once that file is
open to a card, passing `packageBound={!!packageId}` at both facet
mounts makes the binding explicit, and the `only` fallback can go. Until
then the two coincide by construction: `packageId` is passed only by
`AccessPillar`, always together with `studio` chrome, and that chrome is
what sets `only`.
- **Marks are exact, not inferred.** A set that reaches Setup through
some broader grant is still shown as "Not on this set" for
`setup.access`. Clicking then adds the exact capability, which is an
addition and narrows nothing.
- `PermissionMatrixEditor.tsx`, `permission-slice.ts`, the server,
`packages/spec` and `ui/packages/i18n` are untouched. app-shell has no
sdui record (`node scripts/check-sdui-manifest.mjs` exits 0).
- The docs path (`content/docs/**`) is not a governed surface: `node
scripts/pm/check-governed-merges.mjs --test` over the five files exits
0.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01SMps7wq7rBTk53e8KTSEup)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0489214 commit e14d9ce
5 files changed
Lines changed: 469 additions & 1 deletion
File tree
- .changeset
- content/docs/permissions
- ui/packages/app-shell/src/views/metadata-admin
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
46 | 59 | | |
47 | 60 | | |
48 | 61 | | |
| |||
| 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 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
0 commit comments