Repository navigation
Commit b7a0be7
fix(app-shell): Installed Apps shows the engine's reason for a register-refused app (#31662)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbGpSrzUPSqJztUEqtbhr58C)_
Fixes #31651
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:控制台的 `LocalInstallNotLoaded` 类型改成和服务端一样的两种形态(协议不兼容 `{ code,
requiredRange }`、注册被拒 `{ code, message }`);新增一个共用的原因组件
`MarketplaceNotLoadedReason`,Setup → Packages
的行和应用详情页头部都用它。注册被拒的应用现在在“未加载(代码)”后面显示引擎给的原句。
- 为什么改:#31566(PR
#31650)之后服务端会给被引擎拒绝注册的安装记录带上原因原句,但控制台只认协议那一种,只显示代码,管理员看不出该卸载还是修包。
- 风险与回滚:只动控制台三个文件;协议不兼容那种的显示逐字不变(DOM
也不变),没有原句或原句为空时和以前一样只显示代码;不加语言包键。回滚即撤销本 PR。
- 先看:`MarketplaceRowActions.tsx` 里新增的
`MarketplaceNotLoadedReason`(原句以文本节点渲染);再看 `marketplaceApi.ts` 的联合类型。
- 两分钟验证:在 `ui/` 下跑 `pnpm exec vitest run
packages/app-shell/src/console/marketplace/__tests__/MarketplaceRowActions.installedAppsPins.test.tsx
-t 31566`,预期新增用例全绿。
- 需要你做的:无,席位落地。
## What changes
- **`marketplaceApi.ts`**: `LocalInstallNotLoaded` is now the server's
closed union (`NotLoadedMarker` in `@objectstack/cloud-connection`, PR
#31650): `LocalInstallNotLoadedProtocol` `{ code:
'OS_PROTOCOL_INCOMPATIBLE', requiredRange }` or
`LocalInstallNotLoadedRefused` `{ code, message }`. Mirrored member by
member, never widened to a record.
- **`MarketplaceRowActions.tsx`**: one reader,
`MarketplaceNotLoadedReason`, replaces the two copies of the reason
ternary.
- The protocol arm is told by its code, as before, and draws
`marketplace.notLoaded.protocolIncompatible` in the same single span.
- Any other code draws `marketplace.notLoaded.otherReason` with the
code. When the marker carries a non-blank `message`, the engine's
sentence follows it in its own block span, as a React text node, never
as markup.
- A marker with no `message`, an empty one or a blank one reads with the
code alone, exactly as today. So does any other unknown shape.
- **`MarketplacePackagePage.tsx`**: the header's `notLoadedReason`
closure is gone; both header placements draw
`MarketplaceNotLoadedReason`.
- **Locale call (step 0): no new key.** The register-refusal arm reuses
`otherReason` (which already names the code) and appends the engine's
sentence as separate text, so `Clause-②: no` holds. No language pack
changes. None of these names is exported from `@object-ui/app-shell`'s
`.` entry, so its public surface is byte-unchanged.
- Changeset: `.changeset/31651-not-loaded-engine-reason.md`
(`@object-ui/app-shell` patch).
## Tests
New pins go into the two existing harness files as top-level
`describe`s:
- `MarketplacePackagePage.notLoadedHeader-11760.test.tsx` (package page
header, en and zh, catalog view and offline local view): a `{ code,
message }` marker shows the badge, the code's sentence and the engine's
sentence, and not "Installed · vX". A markup-shaped sentence is drawn as
literal text with no element. A marker with no, empty or blank `message`
reads `otherReason` alone, with no engine-sentence node.
- `MarketplaceRowActions.installedAppsPins.test.tsx` (Setup → Packages
row, en and zh-Hans): the same message, markup and fallback cases on the
row, plus a CONTROL: a protocol marker beside a register-refused one
reads the protocol sentence exactly, with no engine sentence.
- CONTROL: the existing 11760 and 11645 pins are unedited and green,
including the unknown-code case (`OS_SOME_LATER_REFUSAL` with a stray
`requiredRange`), which still reads `otherReason` and never shows the
range.
## Acceptance notes
- The engine's sentence is English server text and is drawn after the
localized sentence in every language. Translating it would need a
sentence per refusal code, which the server does not serve.
- Not changed, per the server PR's own notes: the sample-data doors
(reseed, purge) refuse only a protocol-incompatible entry. On the
console side neither door is offered for any `notLoaded` entry, both
arms included.
## Verification
Head `d91784fe`: the fix `a5de5906` and changeset `c0121833`, with
origin/main merged (`8c9260f7`; the three incoming commits touch
`plugin-auth`, `metadata` and `metadata-protocol`, none of this diff's
files, so the ui readings below carry over). Branch cut from
`532230f32`.
<details><summary>Tests (ui vitest, under the verify lock)</summary>
`pnpm exec vitest run` from `ui/` on the four `notLoaded` files
(`MarketplacePackagePage.notLoadedHeader-11760`,
`MarketplaceRowActions.installedAppsPins`,
`MarketplacePage.notLoadedBadge-11760`,
`MarketplacePackagePage.notLoadedMenu-11645`): `Test Files 4 passed
(4)`, `Tests 164 passed (164)`.
`pnpm exec turbo run type-check --filter=@object-ui/app-shell
--concurrency=2`: `Tasks: 69 successful, 69 total` (app-shell's own
type-check covers its test files). `eslint` on the five touched files: 0
errors (53 warnings, all `no-explicit-any` in untouched lines).
</details>
<details><summary>Ablation (scripts/ablation-replace.mjs, anchor x1 ->
x0, restored blob == HEAD 3e32477 and git diff HEAD empty)</summary>
The message arm removed: `if (!engineMessage) return ...` replaced by an
unconditional return of the code's sentence. The two harness files:
`Tests 8 failed | 142 passed (150)`. The 8 are every new message pin:
the header case in en/zh x two views, the row case in en/zh-Hans, and
both markup cases. The fallback cases and the protocol CONTROL stay
green, as they should. The component is imported from `src` by a
relative path (no dist leg).
</details>
<details><summary>Gates</summary>
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack`: 37 derived commands, each run at `c0121833`
with exit 0 (`check:type-check-debt` under the verify lock); `--ran`
reconciliation: `37 derived, 37 run, 0 NOT-MEASURED, 0 UNRUN`. `--tier`:
no path-derived mandate. Examples census (`git grep` of each touched
source path in `ui/examples/**/test/**` and `ui/e2e/**`): no hits.
Changed lines 235 (+209 / -26). The body gates
(`check-changeset-no-major`, `check-adr-0087-registration`,
`check-closing-keyword-parity`) and `check-sdui-manifest` were re-run on
`d91784fe` with this body.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jTQrsZdgRYLfQjYo6u)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent df91a35 commit b7a0be7
6 files changed
Lines changed: 209 additions & 26 deletions
File tree
- .changeset
- ui/packages/app-shell/src/console/marketplace
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| |||
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
89 | | - | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
1035 | 1035 | | |
1036 | 1036 | | |
1037 | 1037 | | |
1038 | | - | |
1039 | | - | |
1040 | | - | |
1041 | | - | |
1042 | | - | |
1043 | | - | |
| 1038 | + | |
| 1039 | + | |
1044 | 1040 | | |
1045 | 1041 | | |
1046 | 1042 | | |
1047 | | - | |
| 1043 | + | |
1048 | 1044 | | |
1049 | 1045 | | |
1050 | 1046 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
41 | 54 | | |
42 | 55 | | |
43 | | - | |
44 | | - | |
45 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
46 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
47 | 85 | | |
48 | 86 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 87 | | |
54 | 88 | | |
55 | 89 | | |
56 | 90 | | |
57 | 91 | | |
58 | | - | |
| 92 | + | |
59 | 93 | | |
60 | 94 | | |
61 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
783 | 783 | | |
784 | 784 | | |
785 | 785 | | |
786 | | - | |
787 | | - | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
788 | 789 | | |
789 | | - | |
790 | | - | |
791 | | - | |
792 | | - | |
793 | | - | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
794 | 799 | | |
795 | | - | |
796 | | - | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
797 | 805 | | |
798 | 806 | | |
799 | 807 | | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
800 | 818 | | |
801 | 819 | | |
802 | 820 | | |
| |||
0 commit comments