Repository navigation
Commit 77e993e
fix(app-shell): a member Setup refuses gets the app's no-access page on Setup's settings and marketplace routes (#27590)
domain:ui#2 · os-bill · session_01Utp6CY2n1JmZZKrHgtp9jC
<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgHGZA9M9n8sPRHZcTX4oAiQ)_
Fixes #27507
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:没有 Setup 权限的普通成员打开 Setup
的设置页(`system/settings`、`system/settings/NAMESPACE`)和应用市场(`system/marketplace`、`system/marketplace/PACKAGE`)时,不再落进默认应用(如
Showcase)的外壳里看「No settings registered」或原始权限报错,而是和打开 Setup 根路由一样,看到「You
don't have access to this app … Back to home」。
- **为什么改**:这些路由带 `system` 段,属于伪路由,过去不等待 Setup
的访问裁决,直接回落到默认应用;三处页面各自解读服务端的拒绝,出了三种说法。分诊裁定:一律走应用根已有的无权限页,不新增文案。
-
**风险与回滚**:只改前端外壳的路由判断(一个谓词),服务端拒绝逻辑不变;管理员和能打开该应用的用户行为不变;审批收件箱及其记录页(objectui#12706
留下的开放路由)不受影响。回滚即 revert 本 PR。
- **先看**:`ui/packages/app-shell/src/console/AppContent.tsx` 中
`isSettingsOrMarketplaceRoute` 与 `appSurfaceAwaitsVerdict` 两行;然后是新测试
`AppContent.settingsMarketplaceVerdict-27507.test.tsx`。
- **两分钟验证**:`pnpm --dir ui exec vitest run
packages/app-shell/src/console/__tests__/AppContent.settingsMarketplaceVerdict-27507.test.tsx`,预期
11 个用例全绿。
- **需要你做的**:无,席位落地。
## What changes
`AppContent` (app-shell) already waits on the access verdict for the app
the URL names on two pseudo-route families, Setup's root and the
metadata-admin routes (objectui#12706), and draws
`renderAppAccessDenied` on `denied`. This adds a third family to
`appSurfaceAwaitsVerdict`: a route whose sub-path is
`system/settings...` or `system/marketplace...`
(`isSettingsOrMarketplaceRoute`). Nothing else moves:
- The gate still applies only when the URL names an app the loaded list
does not carry (`!matchedApp`), so an admin, and any caller under an app
they may open, render the pages exactly as before, unprobed.
- Every verdict other than `denied` (`not_found`, `unreachable`,
`unknown`, `granted`) falls through to the pseudo-route rendering,
unchanged.
- The routes objectui#12706 deliberately left open stay open: the
approvals inbox (`system/approvals`, where the server's approval links
forward) and the record pages it opens (`OBJECT/record/ID`). Their pins
in `AppContent.setupItemRoutesVerdict-12706.test.tsx` are untouched and
green.
- The bare `system` landing is not in the set: it forwards onto
`system/settings` (the console host's `SystemLandingRedirect`), which is
refused. A pin holds that chain.
- No inner component changed. The settings hub's empty state,
`SettingsView`'s error text and `MarketplaceAccessDenied` are
unreachable for a caller Setup refuses, and stay as they were for a
caller Setup admits.
- No server change. The server already refuses each read; this is
presentation only.
Changeset: `@object-ui/app-shell` patch.
## Tests
New
`ui/packages/app-shell/src/console/__tests__/AppContent.settingsMarketplaceVerdict-27507.test.tsx`,
on the 12706 file's harness (a real `ObjectStackAdapter` over a stubbed
`fetch`, so the verdict comes from the real probe reading a real 403
envelope; page stubs count their mounts):
- A refused member on the three settings routes the card names (the hub,
`settings/auth`, `settings/localization`), on the marketplace it names,
and on a marketplace package page: `app-access-denied`, no
`ConsoleLayout`, zero page mounts, exactly one probe and it is Setup's,
URL unchanged, the Back-to-home button present.
- Setup's package-id address
(`/apps/com.objectstack.setup/system/settings/auth`): same verdict,
probed by that address.
- `/apps/setup/system`: forwards to the hub and is refused there.
- Controls: an admitted caller gets the settings page and the
marketplace under Setup, unprobed; a server with no such app (404) keeps
the old fallback rendering; the settings route under the caller's own
app renders the page, unprobed.
Ablation (the predicate disabled via `scripts/ablation-replace.mjs`,
anchor hit 1 to 0, restored to the HEAD blob with `git diff HEAD`
empty): 7 of 11 cases red, the 4 controls green.
## Acceptance notes
- Not filed, observation only: a caller Setup admits but who lacks
`manage_platform_settings` can still type
`/apps/setup/system/settings/auth` and see `SettingsView` print the
server's error message verbatim. The hub does not list that namespace
for them, so it is reachable only by URL; not reproduced in a browser
here.
- Not in scope and left as they were: the other Setup `system/*` routes
the card does not name (`system/apps`, `system/audit-log`,
`system/ai-approvals`, `system/profile`). Whether they wait on Setup's
verdict is the same product question objectui#12706 left open for the
approvals routes.
- Home's marketplace shortcuts already show only to admins, so a member
reaches the marketplace route only by URL or an old link.
## Verification
<details><summary>Targeted tests and typecheck (head after the main
merge)</summary>
- `pnpm --dir ui exec vitest run --maxWorkers=2
packages/app-shell/src/console/__tests__/
apps/console/src/__tests__/AppContent.systemHubRoutes.test.tsx`: Test
Files 58 passed (58), Tests 408 passed (408).
- `pnpm --filter @object-ui/app-shell run type-check`: exit 0; the new
test file is in `tsconfig.test.json`'s program (`--listFilesOnly` count
1).
- `eslint` on the two touched source files: 0 errors; no warning on a
touched line.
</details>
<details><summary>Derived gates</summary>
At head `244ec6aa`, `node scripts/pm/dispatch-gates.mjs --commands
--repo objectstack-ai/objectstack`: 34 derived; each run and recorded,
reconciled with `--ran`: "34 derived famil(ies) accounted for — 34 run,
0 NOT-MEASURED". Plus `check:new-line-citations` (0 new citations) and
`check-nul-bytes` (exit 0).
```text
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 --dir ui exec vitest run scripts/ :: 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
```
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6CZ9nhZe8YouxkXECUs)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent a4e7014 commit 77e993e
3 files changed
Lines changed: 352 additions & 1 deletion
File tree
- .changeset
- ui/packages/app-shell/src/console
- __tests__
| 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 | |
|---|---|---|---|
| |||
505 | 505 | | |
506 | 506 | | |
507 | 507 | | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
508 | 517 | | |
509 | | - | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
510 | 523 | | |
511 | 524 | | |
512 | 525 | | |
| |||
| 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 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 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 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
0 commit comments