Skip to content

Commit 42e557a

Browse files
os-zhuangclaude
andauthored
fix(app-shell): org-package Install routes by deployment shape (install-local vs control plane) (#1663)
Self-hosted/single-env runtimes (features.installLocal) own their desired state — installing an org package merges it into THEIR kernel via /marketplace/install-local, with the bound oscc_ credential fetching the org manifest (ADR-0008). The control-plane /cloud-connection/install path (previously always used) 401s there and is the wrong semantics; cloud-managed environments keep it. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 0ca2040 commit 42e557a

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@object-ui/app-shell": patch
3+
---
4+
5+
"Your organization" Install routes by deployment shape: install-local runtimes (runtime-config `features.installLocal`) install via `/marketplace/install-local` into their OWN kernel (the bound oscc_ credential fetches the org manifest — ADR-0008); cloud-managed environments keep the control-plane `/cloud-connection/install` path. Previously the org Install button always called the control-plane path, which 401s on self-hosted runtimes.

packages/app-shell/src/console/marketplace/MarketplacePage.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ import {
3131
listOrgPackages,
3232
listInstalledPackages,
3333
installPackage,
34+
installLocal,
3435
type MarketplacePackageSummary,
3536
type LocalInstallEntry,
3637
type OrgPackageSummary,
3738
} from './marketplaceApi';
39+
import { getRuntimeConfig } from '../../runtime-config';
3840

3941
/**
4042
* Format a published-at timestamp as a localized relative string.
@@ -118,13 +120,25 @@ export function MarketplacePage() {
118120
useEffect(() => { void load(); }, []);
119121

120122
// Install an org package into the current environment (ADR-0007 step ②).
121-
// The same-origin /cloud-connection/install route resolves the env by
122-
// hostname, so we only need the package id.
123+
//
124+
// Two deployment shapes, two semantically-correct routes:
125+
// - install-local runtimes (single-env / self-hosted, runtime-config
126+
// features.installLocal=true): the runtime OWNS its desired state —
127+
// install merges into ITS kernel via /marketplace/install-local; the
128+
// bound oscc_ credential lets it fetch the org manifest (ADR-0008).
129+
// The control-plane /cloud-connection/install path would 401 here
130+
// (no env→cloud service key) and is the wrong semantics anyway.
131+
// - cloud-managed environments: desired state lives in the control
132+
// plane — /cloud-connection/install resolves the env by hostname.
123133
const doOrgInstall = async (pkg: OrgPackageSummary) => {
124134
setOrgInstalling(pkg.id);
125135
setOrgMsg(null);
126136
try {
127-
await installPackage({ packageId: pkg.id, environmentId: '', seedSampleData: true });
137+
if (getRuntimeConfig().features.installLocal) {
138+
await installLocal({ packageId: pkg.manifest_id || pkg.id, versionId: 'latest' });
139+
} else {
140+
await installPackage({ packageId: pkg.id, environmentId: '', seedSampleData: true });
141+
}
128142
setOrgMsg({ ok: true, text: t('marketplace.org.installed', { defaultValue: `Installed ${pkg.display_name}`, name: pkg.display_name }) });
129143
await load();
130144
} catch (e: any) {

0 commit comments

Comments
 (0)