You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 49bc3be
Browse filesBrowse the repository at this point in the historyBrowse files
feat(ui): the hosted unmanaged install dialog shows and edits its target namespace (#32263)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBGU8m9WENyvoKLyxe2kUbYo)_Fixes#32040
Clause-②: yes (widening)
Metadata-protocol: none
## 维护者速读
- 改了什么:托管环境里以「非托管副本」安装应用时,安装对话框多了一个「目标命名空间」输入框,预填控制面给的默认值(经 #32182 的同源路由
`GET /api/v1/cloud-connection/install-namespace` 读取),可以修改,安装时作为
`target_namespace` 发出;托管安装不画输入框、不发这个键。
- 为什么改:#31482 之后服务端已能按命名空间复制,只差界面;之前对话框既不显示也不能改命名空间,冲突时也不能换名重试。
- 风险与回滚:只动界面和 11 种语言的 `marketplace` 懒加载文案,不动服务端和
`packages/spec`;读不到默认值(`503`/`502`)时输入框留空,手填仍可安装,空着则不发键、沿用控制面默认。回滚即
revert 本 PR。
- 先看:`MarketplacePackagePage.tsx` 的 `namespaceFieldShown` / `doInstall`
的 catch 分支,`marketplaceApi.ts` 的 `getInstallNamespace`,新文件
`targetNamespaceRefusal.ts`(三种拒绝怎么分)。
- 两分钟验证:`cd ui && pnpm exec vitest run
packages/app-shell/src/console/marketplace/__tests__/MarketplacePackagePage.installMode-12288.test.tsx`,预期
46 条全绿;截图在项目文件夹 `ui-orders/32040-shots/`。
- 需要你做的:无,席位落地。⚠️ 默认值读的是 `data.namespace`,这个键名取自路由测试的转发样例,云端 PR #4206
本会话读不到,请席位核一下。
## What changes
- **The namespace read.**
`marketplaceApi.getInstallNamespace(packageId)` calls `GET
/api/v1/cloud-connection/install-namespace?package_id=…` with the same
`withEnvAuth` + `credentials: 'include'` that `installPackage` uses, and
returns the trimmed string at `data.namespace`, else `null`. `null`
covers `503 CLOUD_UNCONFIGURED`, `502 EXTERNAL_SERVICE_ERROR`, any other
refusal, a network failure and a non-string value: the field is empty,
never a guessed name.
- **The install body.** `installPackage` takes an optional
`targetNamespace` and sends it as `target_namespace` on the hosted
same-origin route only, only beside `installMode: 'unmanaged'`, trimmed,
never blank. A managed install never carries the key, since the route
refuses it there.
- **The dialog.** For an unmanaged hosted install (never an update), the
dialog draws a "Target namespace" field: a skeleton while the read is in
flight (Install waits), then an editable input pre-filled with the
default, or empty with a "no default could be read" hint. `data-state`
on `install-target-namespace` is `loading`, `ready` or `refused`.
- **Refusals**, sorted by `targetNamespaceRefusal.ts` from the error's
`code` (read with `errorCodeIs`) and `details` (which `installPackage`
already carries on its thrown error):
- `409 RESOURCE_CONFLICT` with `details.namespace`: the dialog stays
open, the field says the name is taken (localized, naming it), focus
returns to the field, and Install is enabled for another name.
- `400 INVALID_REQUEST` with `details.targetNamespace`: the server's
sentence is shown beside the field.
- `409 RESOURCE_CONFLICT` with `details.targetPackageId` (a second
unmanaged copy): shown as a plain refusal in the dialog's result box,
with no re-ask, since no namespace clears it (card item 3, stated not
fixed).
- **Strings.** Five keys under `marketplace.install.targetNamespace.*`
in all 11 files of the `marketplace` lazy namespace (`zh-Hant` generated
by `gen:zh-hant`). ⛔ Nothing in `src/locales/en.ts`. The German `taken`
string adds one „…“ pair, so `de-quote-pairing-3876.test.ts` moves its
two pins by one, with a dated line in each comment as earlier additions
did.
- **Changeset** `.changeset/32040-hosted-install-target-namespace.md`:
`@object-ui/i18n` patch. `@object-ui/app-shell` is private and gets no
row.
`Clause-②: yes (widening)`: `@object-ui/i18n` gains five strings.
`marketplaceApi`'s exported surface does widen (the new
`getInstallNamespace` export and the optional `targetNamespace` input),
but it lives in the private `@object-ui/app-shell`, so nothing it adds
publishes.
## Why
#31482 lets the control plane copy a package under a chosen namespace,
and #32182 (#32083) added the same-origin read of its default. The
dialog was the missing piece: it sent no namespace and drew no field.
## Verification
- `MarketplacePackagePage.installMode-12288.test.tsx`: 46 / 46, 12 of
them new (two new describes in the existing harness; `marketplaceApi` is
not mocked, one stubbed `fetch` answers by path): default shown and
sent, edited value sent, `503` / `502` empty field still installs a
typed name, empty field sends no key, ownership `409` re-asks and
installs a new name, `400` sentence beside the field, `targetPackageId`
`409` gives no re-ask, managed install shows no field, reads no default
and sends no key, plus `installPackage` / `getInstallNamespace` unit
pins.
- **Ablation** (`scripts/ablation-replace.mjs`, delete
`...withNamespace,` from the hosted body): 6 tests go red (default sent,
edited sent, both `503`/`502` typed-name cases, the re-ask case, the
unit pin). Restored; `git diff HEAD` empty.
- `vitest run packages/app-shell/src/console/marketplace
packages/app-shell/src/__tests__ packages/i18n`: 183 files, all green
after the German pin move (that suite holds the ADR-0060
`product-neutral-renderer.ratchet` test).
- `type-check` of `@object-ui/app-shell` and `@object-ui/i18n`: clean.
ESLint on the changed files: 0 errors. `node
scripts/check-i18n-call-site-keys.mjs` (ui): clean.
- Full `turbo run build --filter='!@objectstack/docs'`: 119 / 119.
- Derived gates: every line of `dispatch-gates.mjs --commands`, plus
`pnpm --dir ui run check:eager-closure`, `node
scripts/check-sdui-manifest.mjs` and `pnpm --dir ui run
check:spec-symbols`; results in the `--ran` reading below.
- **Browser.** A hosted environment is not bootable in this container
(no control plane). Shot against a real CRM dev boot and the console on
Vite, with Playwright mocking the hosted routes (`runtime/config`
patched to a cloud base with `installLocal: false`, the catalog,
manifest, `install-namespace` and `install` answers). Seven dialog
states in the project folder `ui-orders/32040-shots/`: loading, default
shown, no default (`503`), name taken (`409`), malformed (`400`), second
copy (`409 targetPackageId`), managed (no field).
<details><summary><code>dispatch-gates --ran</code>: 39 derived, 39 run,
0 NOT-MEASURED; every exit 0</summary>
`check:eager-closure` and `check:spec-symbols` (ui) ran beside the 39
and exited 0; `check-sdui-manifest` is one of the 39. Gate scripts ran
on a shared box.
</details>
## Known limits
- The namespace key inside `data` is read as `namespace`, taken from the
relay pin in `cloud-connection-plugin.test.ts`, which #32182's own body
calls an illustrative fixture. Cloud PR #4206 is not readable from this
session. If the control plane sends another key, the field is simply
empty (a typed name still installs); it never sends a wrong value.
- A second unmanaged copy of the same package is still refused, as the
card says (item 3).
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(no spec change)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; lint passes on the changed files.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: n/a.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title and body are in English, except the maintainer brief.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01WGufzgQpfw8pDeXcPo2zvJ
<!-- signed: domain:ui#2 · os-support-ai ·
session_01WGufzgQpfw8pDeXcPo2zvJ -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
feat(ui): the hosted unmanaged install dialog shows and edits the namespace its copy takes
6
+
7
+
Clause-②: yes (widening) — `@object-ui/i18n` gains five `marketplace.install.targetNamespace.*` strings; `marketplaceApi`'s new `getInstallNamespace` export and optional `targetNamespace` input live in the private `@object-ui/app-shell`, so they publish nothing
8
+
Metadata-protocol: none
9
+
10
+
On a hosted environment, an unmanaged install now draws a "Target namespace" field in the install dialog, pre-filled with the default the control plane would use (read through `GET /api/v1/cloud-connection/install-namespace`), and sends the value as `target_namespace`. When no default can be read (the runtime is not connected, or the control plane did not answer) the field starts empty and a typed name still installs; an empty field sends nothing and the control plane's default stands. A managed install draws no field and sends no namespace.
11
+
12
+
If the namespace belongs to another package, the dialog stays open, says the name is taken and asks for another. A malformed or reserved namespace shows the server's sentence beside the field. A second unmanaged copy of the same package is still refused, and no new namespace is offered for it, since a different namespace does not clear that refusal.
13
+
14
+
The strings are in all eleven locales of the `marketplace` namespace.
0 commit comments