Repository navigation
Commit 119d5db
fix(app-shell): permission matrix keeps a roll-up acknowledgement only while Read is on (#34954)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBLW6dHPW6sSheA32XPKZzPV)_
Fixes #34786
Clause-②: no
Metadata-protocol: none
repo:objectstack#3 · os-support-ai · session_01WGufziunkXbDT7wUWqfmWz
## 维护者速读
- 改了什么:控制台权限矩阵里,字段行关掉 Read 时,同一次编辑会删掉
`rollupSourceUnreadableReason`;批量快捷键(只读全部/可写全部)改写字段行时保留这条说明。
- 为什么改:spec 拒收 `readable: false` 旁边的说明,原来关 Read
会留下被拒的形状且无法清除;批量快捷键则会悄悄丢掉管理员写下的说明。
- 风险与回滚:仅限私有包 `@object-ui/app-shell` 的两个函数,无 spec 或接口变化;回滚即 revert 本 PR。
- 先看:`permission-slice.ts`(`withFieldBits` 的 `readable &&`
条件)、`PermissionMatrixEditor.tsx`(`updateFieldPerm` 的 Read off
级联)、`permission-slice.fieldRule-26597.test.ts`。
- 两分钟验证:`cd ui && pnpm exec vitest run
packages/app-shell/src/views/metadata-admin/permission-slice.fieldRule-26597.test.ts`,预期全绿,含
3 条 `withFieldBits` 新用例。
- 需要你做的:无,席位落地。
## What changes
- `FieldPerm` (`permission-slice.ts`) declares the optional
`rollupSourceUnreadableReason` key, documented against
`FieldPermissionSchema`.
- `updateFieldPerm` (`PermissionMatrixEditor.tsx`): Read off now deletes
the reason beside `when` (the objectstack#25866 cascade), so the editor
never authors the shape `FIELD_PERMISSION_ROLLUP_REASON_ON_HIDDEN`
refuses.
- `withFieldBits` keeps the reason while `readable` stays true and drops
it only when `readable` goes false. Its one caller, `applyFieldBulk`,
always passes `readable: true`, so the bulk shortcuts now keep the
reason instead of dropping it silently.
- Changeset: `@object-ui/app-shell` patch.
## Tests
- `permission-slice.fieldRule-26597.test.ts`: a new top-level `describe`
for `withFieldBits`. It keeps the reason on a readable rewrite and drops
it on `readable: false`, and `applyFieldBulk` Read-only all keeps it.
Each resulting entry is parsed with the real `FieldPermissionSchema`
from `@objectstack/spec/security`, and a control parse proves the
refused shape really is refused (the issue path is
`rollupSourceUnreadableReason`).
- `PermissionMatrixEditor.fieldWhen-25866.test.tsx`: a new top-level
`describe` in the existing field-cascade harness. Read off on a stored
acknowledged entry saves `{ readable: false, editable: false }`, Write
all saves the entry with the reason kept, and both saved entries parse
with `FieldPermissionSchema`.
## Acceptance notes
- `withFieldBits(cur, false, …)` still keeps `when`. The refused `when`
beside `readable: false` shape is reachable only if a caller passes
`readable: false`, and no caller does (`applyFieldBulk` passes `true`).
I left it alone because it is outside this card.
## Verification
<details><summary>Pinned tests, head 5d561af</summary>
`os-verify-lock` running `vitest run --maxWorkers=2` on the two files:
`Test Files 2 passed (2)`, `Tests 27 passed (27)`, `VERDICT command-exit
0`.
</details>
<details><summary>Ablations (scripts/ablation-replace.mjs, each restored
to blob == HEAD)</summary>
- A, delete `delete next.rollupSourceUnreadableReason;` in
`updateFieldPerm`: `Read off removes the reason, so the saved entry is
one the spec accepts` fails (1 failed). Restored to blob 27768b9,
which equals HEAD.
- B, `readable && ` guard removed in `withFieldBits`: `drops the reason
when the entry goes readable:false` fails (1 failed). Restored to blob
5206a29, which equals HEAD.
- C, keep branch disabled in `withFieldBits` (the pre-fix behaviour): 3
failed, namely the slice keep case, bulk Read-only all, and editor Write
all. Restored to blob 5206a29, which equals HEAD.
- After the script: `git diff HEAD` empty.
</details>
<details><summary>Type check and gates</summary>
- `pnpm --filter @object-ui/app-shell run type-check` (both `tsc`
programs): `VERDICT command-exit 0`.
- `dispatch-gates --commands`: 38 derived commands. 36 exited 0. Two
were NOT MEASURED on the first pass: `pnpm --dir ui exec vitest run
scripts/` (the files failed with `Cannot find package
'@objectstack/spec/ui'` because the run started before the spec dist
existed, an environment fault) and `pnpm check:type-check-debt` (exit 3,
its closure build never got a lock turn). The seat report records the
re-run result. `dispatch-gates --ran`: 38 derived, 38 run.
- `overlap-check` against origin/main c81f498 and open PR #34914:
`VERDICT clean exit 0`.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz)_
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufziunkXbDT7wUWqfmWz -->
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>1 parent bb169c3 commit 119d5db
5 files changed
Lines changed: 103 additions & 3 deletions
File tree
- .changeset
- 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
201 | 203 | | |
202 | 204 | | |
203 | 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1493 | 1493 | | |
1494 | 1494 | | |
1495 | 1495 | | |
1496 | | - | |
1497 | | - | |
1498 | | - | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
1499 | 1500 | | |
1500 | 1501 | | |
1501 | 1502 | | |
| 1503 | + | |
1502 | 1504 | | |
1503 | 1505 | | |
1504 | 1506 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
146 | 148 | | |
147 | 149 | | |
148 | 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
191 | 201 | | |
192 | 202 | | |
193 | 203 | | |
| |||
259 | 269 | | |
260 | 270 | | |
261 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
262 | 277 | | |
263 | 278 | | |
264 | 279 | | |
265 | 280 | | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
266 | 284 | | |
267 | 285 | | |
268 | 286 | | |
| |||
0 commit comments