Repository navigation
Commit e728d7a
feat(app-shell): the marketplace install dialog and the local-install confirm show which existing objects a package changes, platform objects flagged and acknowledged (#33017)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoBAnEyxhTeomXorDRe5XRUC)_
Fixes #31542
Clause-②: yes (widening)
Metadata-protocol: none
## 维护者速读
-
改了什么:应用市场的托管安装对话框和本地安装确认框,现在会列出软件包要修改的已有对象(字段、显示补丁、校验规则、索引、标签),平台对象(`sys_*`)排在最前并醒目标出;只要涉及平台对象,必须勾选确认才能安装。
- 为什么改:之前管理员同意安装时完全看不到软件包会改哪些已有对象,而扩展 `sys_user`、`sys_session`
这类平台对象可能影响登录和用户资料。
- 风险与回滚:只改安装前的展示和一个确认勾选,安装请求本身不变;目录不给出该信息时退回读取已读的清单,读不到就明说"无法读取"。回滚即
revert 本 PR。
-
先看:`ui/packages/app-shell/src/console/marketplace/MarketplacePackagePage.tsx`(`objectExtensions`
的取值顺序和安装按钮的禁用条件)、`ObjectExtensionDisclosure.tsx`、`installPreview.ts` 的
`objectExtensionsIn`。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/app-shell/src/console/marketplace/__tests__/MarketplacePackagePage.installPreview-30325.test.tsx
packages/app-shell/src/console/marketplace/__tests__/MarketplacePackagePage.installMode-12288.test.tsx`,预期全绿。
- 需要你做的:无,席位落地。
- 席位意见:席位(domain:ui#4)审过,并已写声明面的契约复审记录(6843621467,PASS)。新增文案键都在按需加载的
marketplace 命名空间里,11 种语言齐全,没有改动或删除已有键;只改安装前的展示和一个确认勾选,不碰服务端和 cloud
仓库。目录给 `null` 时明说"无法读取"而不是"没有修改"。已知取舍:清单还在读取或读不到时不拦安装,这与卡上"null
只需明说"的约定一致。CI 全绿后按队列落地。
## What changes
**The catalog field (`marketplaceApi.ts`).**
`MarketplacePackageVersion.object_extensions` is typed as the card
states it (`readonly MarketplaceObjectExtension[] | null`, absent on a
catalog that does not serve it). `MarketplaceObjectExtension` carries
`object`, `platform`, `fields`, `field_patches`, `validations`,
`indexes` and `relabels`.
**One disclosure component (`ObjectExtensionDisclosure.tsx`, new, beside
`PluginDisclosure`).** It draws what each value says:
- a list: each target object with the fields it adds or replaces, the
fields whose display it patches, the rules it adds or replaces, how many
indexes it adds, and whether it overrides the label. A platform target
gets a "Platform object" badge, an amber edge and a warning line. The
component draws the order it is given; the producer serves platform
targets first.
- `[]`: nothing is drawn.
- `null`: an amber note that what the package changes could not be read.
It is never drawn as "changes nothing".
- `undefined`: a muted "reading" line.
When any target is a platform object and the surface passes
`onAcknowledgedChange`, the component draws an acknowledgment checkbox.
`needsPlatformAcknowledgment()` is the one rule both surfaces use to
hold Install.
**Both surfaces (`MarketplacePackagePage.tsx`).**
- The hosted install dialog draws the disclosure for every package, not
only for code plugins. Its Install is disabled while a platform target
is unacknowledged.
- The local-install confirm (`install-preview-dialog`) draws it below
the counts. Its Install (`install-preview-confirm`) is disabled under
the same rule.
- The acknowledgment holds for one opening. An effect clears it once
both surfaces are closed, because the dialog's own Close button calls
`setInstallOpen(false)` and bypasses `onOpenChange`.
- Where the list comes from, in order: the catalog's `object_extensions`
on `latest_version` (the version both doors install). On a catalog
without the key, it comes from the manifest the page already reads once
before install (`getServedPackageBody`, the read the card's step 3
names). That read exists and returns `data.manifest` of `GET
/packages/:id/versions/latest/manifest`. If this runtime has no manifest
read (no install-local route and no cloud base) or the manifest cannot
be read, the value is `null`.
**The manifest reading (`installPreview.ts`).** `InstallPreview` gains
`objectExtensions`. It is read from every package body the preview
already walks (top level with a nested `manifest:` lifted, and each
`packages[]` body), and from each body's `metadata.objectExtensions`.
That is the set of surfaces the card names. There is one entry per
target object, platform targets first. `fields` and `fieldPatches`
contribute their keys. A validation contributes its `name`, or
`(unnamed)` when it has none. `indexes` contributes a count. `label`,
`pluralLabel` and `description` set `relabels`.
**i18n.** The new `marketplace.objectExtensions.*` keys go in the lazy
`marketplace` namespace
(`ui/packages/i18n/src/namespaces/marketplace/*`) in all ten
hand-written locales. `zh-Hant` is generated by `gen:zh-hant`. The
claim's file surface first named `src/locales/*`; the seat amended it
(6839906996) after I measured that every existing
`marketplace.install.preview.*` and `marketplace.disclosure.*` key lives
in the namespace. The eager English pack and its gz ceiling are
untouched. The index count is an i18next count family in every pack
(`count-families-11445` requires one), with each language's CLDR slots.
**Changeset:** `.changeset/31542-install-object-extensions.md`,
`@object-ui/app-shell` patch and `@object-ui/i18n` patch, both
declaration lines. Clause-② is `yes (widening)` because
`./namespaces/marketplace` is an exported subpath of `@object-ui/i18n`,
so its new keys are published.
## Tests
Final head `11d28d49`. The pins are top-level `describe`s in the
existing shared harness files.
- `__tests__/installPreview-30325.test.ts`: a new `describe` pins the
manifest reading. A business target and a `sys_user` target come back
platform first, with each field, patch, named and unnamed rule, index
count and relabel. `metadata` and `packages[]` bodies are read and
merged per object. A body that extends nothing reads `[]`, never `null`.
The three existing `toEqual` cases gain `objectExtensions: []`.
- `__tests__/MarketplacePackagePage.installPreview-30325.test.tsx`
(local confirm), five cases:
- business plus platform: both listed with the platform one first and
flagged. Install is disabled, a click posts nothing, and after the
acknowledgment one install posts.
- `[]`: no section, and Install is enabled.
- `null`: "could not read", and Install is enabled.
- CONTROL: a catalog without the key reads the served manifest, and the
same rule holds Install.
- CONTROL: a catalog without the key plus an unreadable manifest gives
"could not read".
- `__tests__/MarketplacePackagePage.installMode-12288.test.tsx` (hosted
dialog, metadata package with no `contains_code`), six cases: business
plus platform; closing the dialog drops the acknowledgment; business
only (not held); `[]`; `null`; CONTROL catalog without the key. The
harness `Wire` gains `catalogVersion`, merged into `latest_version`.
- Runs (all under `scripts/pm/os-verify-lock.sh`):
- the three files: 72/72.
- `pnpm --dir ui exec vitest run
packages/app-shell/src/console/marketplace/ packages/i18n/` after the
merge of `origin/main` and a fresh `@objectstack/spec` build: Test Files
160/160, Tests 2465 passed, 13 skipped.
- `@object-ui/app-shell` and `@object-ui/i18n` `type-check` (src and
test programs) after a full build of `@object-ui/app-shell^...`: exit 0.
- eslint `--no-inline-config` over the changed ui files: 0 errors. The
warnings are existing `no-explicit-any` hits in the touched files.
<details><summary>Ablation: drop the platform-acknowledgment
requirement</summary>
`node scripts/ablation-replace.mjs` replaced `const
extensionsUnacknowledged = needsPlatformAcknowledgment(objectExtensions)
&& !extensionsAcknowledged;` with `const extensionsUnacknowledged =
false; /* ABLATION-31542 */` in `MarketplacePackagePage.tsx`. It
reported anchor 1 → 0, marker 0 → 1, blob `adcf60f3358e` →
`56992a90d3e9`. The two page harness files then went red: Tests 5 failed
/ 58 passed. The red pins were both "Install waits for the
acknowledgment" cases, both CONTROL manifest cases, and "closing the
dialog drops the acknowledgment". The tool restored the file: blob after
restore `adcf60f3358e` equals the HEAD blob, and `git diff HEAD` is
empty. The test subject is imported from source
(`../MarketplacePackagePage`), so no dist was involved.
</details>
## Acceptance notes
- **Reading state does not hold Install.** While the manifest read is in
flight on a catalog without the key, the dialog shows "reading" and
Install is not held. Only a known platform target holds it, and `null`
does not either. The card asks for the acknowledgment when a target is a
platform object. Holding on "unknown" would block every install on a
runtime with no manifest read.
- **Merging per object in the fallback is my reading.** I could not read
cloud's `package-object-extensions.ts` from this container. If the
producer lists two extensions of one object separately, the catalog path
draws them as served. Only the fallback merges.
- **The code-consent checkbox keeps a pre-existing leak.** The dialog's
Close button bypasses `onOpenChange`, so the existing code
acknowledgment (`acknowledged`) and `installResult` survive a Close and
reopen. I fixed it for the new acknowledgment only. The existing one is
reported in the dev report, not changed here.
- **Docs: deviation.** `ui/AGENTS.md` #2 (docs-driven) is not done in
this PR: the claim's file surface does not include
`content/docs/frontend/` or a README.
- **Assignees: deviation.** The dispatch order asked for `pr_create`
without assignees, so the PR has none. `.claude/agents/os-dev.md` rule 2
has the create carry the claim's `Account:`. The conflict is reported to
the seat.
<details><summary>Derived gates (dispatch-gates --commands, final
head)</summary>
All 39 derived families exit 0. `dispatch-gates --ran` reconciles them:
39 derived, 39 run, 0 NOT-MEASURED, and the zero is derived from the
recorded exit codes. Thirty-eight ran on `11d28d49`. `pnpm --dir ui exec
vitest run scripts/` ran on `c4ec26ca`, the pre-merge parent: Test Files
171 passed / 2 skipped, Tests 5062 passed / 2 skipped. The merge of
`origin/main` brought in no file of this diff.
```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/ci/snapshot-next.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 --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm --filter @objectstack/spec run check:error-code-provenance :: 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:merge-driver :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:published-files :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:role-word :: 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
pnpm --dir ui exec vitest run scripts/ :: exit 0
```
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L9qibxGdEFi5dqU21THfm1)_
<!-- signed: domain:ui#4 · os-tesla · session_01L9qibvZYR36KAJUv44oXZw
-->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 994c7d6 commit e728d7a
19 files changed
Lines changed: 697 additions & 14 deletions
File tree
- .changeset
- ui/packages
- app-shell/src/console/marketplace
- __tests__
- i18n/src/namespaces/marketplace
| 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 | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
275 | 276 | | |
276 | 277 | | |
277 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
278 | 282 | | |
279 | 283 | | |
280 | 284 | | |
| |||
345 | 349 | | |
346 | 350 | | |
347 | 351 | | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
348 | 358 | | |
349 | 359 | | |
350 | 360 | | |
| |||
1474 | 1484 | | |
1475 | 1485 | | |
1476 | 1486 | | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
1477 | 1500 | | |
1478 | 1501 | | |
1479 | 1502 | | |
| |||
1841 | 1864 | | |
1842 | 1865 | | |
1843 | 1866 | | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
1844 | 1873 | | |
1845 | 1874 | | |
1846 | 1875 | | |
1847 | 1876 | | |
| 1877 | + | |
1848 | 1878 | | |
1849 | 1879 | | |
1850 | 1880 | | |
| |||
2040 | 2070 | | |
2041 | 2071 | | |
2042 | 2072 | | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
2043 | 2084 | | |
2044 | 2085 | | |
2045 | 2086 | | |
| |||
2091 | 2132 | | |
2092 | 2133 | | |
2093 | 2134 | | |
2094 | | - | |
| 2135 | + | |
2095 | 2136 | | |
2096 | 2137 | | |
2097 | 2138 | | |
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
131 | 133 | | |
132 | 134 | | |
133 | 135 | | |
| |||
185 | 187 | | |
186 | 188 | | |
187 | 189 | | |
188 | | - | |
| 190 | + | |
| 191 | + | |
189 | 192 | | |
190 | 193 | | |
191 | 194 | | |
| |||
797 | 800 | | |
798 | 801 | | |
799 | 802 | | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
0 commit comments