Skip to content

fix(console): show the platform-managed state on hosted storage and AI provider settings - #34327

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-q4ltjy
Nov 16, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-q4ltjy

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #34149

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:托管环境里直接打开 Setup →「文件存储」时,控制台显示「此项由平台托管」,不再是通用报错;「AI 与向量化」页顶部多一行「AI 提供商、模型与凭据由平台托管」,对话标题与可观测性设置照常可改。
  • 为什么改:托管环境的「系统设置」隐藏自托管才用得到的基础设施设置(文件存储适配器、AI 提供商与向量化、知识库后端) #33891 让服务端在托管环境拒绝存储设置、裁掉 AI 提供商键,控制台还不认这个拒绝,书签或手输网址会看到报错或缺了提供商的表单。
  • 风险与回滚:只改控制台设置页的读法与三条文案;自托管环境不受影响(对照用例钉住)。回滚即还原本 PR。
  • 先看:ui/apps/console/src/pages/settings/platformManaged.ts(拒绝与 AI 投影的判定)、SettingsView.tsx 的 error?.managed 分支与 aiProviderManaged 行、api.ts 的 runSettingsAction 新增一行。
  • 两分钟验证:在 ui/ 下跑 pnpm exec vitest run apps/console/src/pages/settings/__tests__/SettingsView.platformManaged-34149.test.tsx,预期 9 例全绿。
  • 需要你做的:无,席位落地。

What changes

The console half of #33891 (server contract landed in #34254).

  • Storage page, hosted. GET /api/settings/storage answers 409 RESOURCE_CONFLICT with error.details.managedBy: 'platform' on a cloud-managed environment. SettingsView now reads that refusal by its declared shape (status, code and details.managedBy, never the message, via isPlatformManagedRefusal in the new platformManaged.ts) and draws a "Managed by the platform" card: no form, no save bar, no retry. A 409 without managedBy: 'platform' keeps today's error card.
  • AI page, hosted (Ask 2). The page is served projected, so nothing errors. The console draws one line, "The AI provider, its model and credentials are managed by the platform.", only when two served facts agree: the auth config's features.cloudManaged === true (plugin-auth answers it from the same isCloudManaged() the settings projection reads, and FirstRunChecklist already reads it through getAuthConfig, which asks no new request) and the served ai manifest carries no provider key (the projection actually ran). No served field was added.
  • Stale page refusals. runSettingsAction now throws the managed refusal like a failed read (status + raw body on payload) instead of folding it into { ok: false, message }; onAction and onSave toast "Managed by the platform" for that shape. Read from the code before this change: such a refusal fell to the last branch of runSettingsAction and a stale ai.test click toasted the server's English sentence.
  • i18n. Three keys under console.settingsView in every pack (platformManagedTitle, platformManagedBody, aiProviderManaged); zh-Hant regenerated with node scripts/gen-zh-hant.mjs.
  • SettingsHub.tsx is untouched: it reads the list (GET /api/settings), which already leaves storage out on a hosted environment.

Tests

New: __tests__/SettingsView.platformManaged-34149.test.tsx (9 cases) and platformManaged.test.ts (5 cases).

  • hosted GET storage 409 + managedBy: 'platform' → managed card, no input, no retry, one read;
  • CONTROL: 409 RESOURCE_CONFLICT without managedBy → today's error card with the server's sentence;
  • CONTROL: self-hosted storage → form renders;
  • hosted AI (flag on, provider withheld) → one line, served keys still render;
  • CONTROLs: flag off with a projected manifest → no line; flag off with the full manifest → no line; flag on but provider served → no line;
  • stale action and stale save refused as platform-managed → the managed toast;
  • runSettingsAction: the managed 409 throws with status and raw body; another 409 stays { ok: false, message }.

No existing test was edited.

Ablations (each landed on disk through scripts/ablation-replace.mjs, restored to the HEAD blob)
  • A1 isPlatformManagedRefusal returns false → 5 red (storage managed state, stale action, stale save, the helper, the api throw).
  • A2 the features.cloudManaged check dropped → red: the helper case and the view CONTROL "a page served without a provider on a self-hosted environment draws no line".
  • A3 the runSettingsAction throw line deleted → red: "throws the refusal with its status and raw body".

Each run: ok mutation landed then ok restored: blob == HEAD and git diff HEAD is empty.

Acceptance notes

  • The console names the ai namespace and its provider key as constants (platformManaged.ts); the server's table is CLOUD_MANAGED_HIDDEN_SETTINGS. If a later server stops withholding the provider, the line disappears by itself (the manifest check); if it starts projecting another namespace partially, that page draws no line until the console learns it. A served marker on the projected manifest would remove the console constant, but it is a served field (Clause-②, server), so it was not added here.
  • onClearSaved (clear a value beneath an env pin) on a stale page still toasts the server's sentence for a managed refusal; on a hosted environment the managed keys are not served, so the row is not reachable without a stale page.

Verification

All on head febd90e8, run after the last commit.

  • pnpm --filter @object-ui/console type-check: exit 0.
  • cd ui && pnpm exec vitest run packages/i18n/ apps/console/src/pages/settings/: 145 files, 2313 passed, 13 skipped, exit 0 (includes the zh-Hant generated-pack pin and the settings-page bare-literal pin).
  • Derived gate set (node scripts/pm/dispatch-gates.mjs --commands): 40 commands, all exit 0; --ran reconciliation: 40 derived, 40 run, 0 NOT-MEASURED, 0 UNRUN.
  • pnpm check:new-line-citations (ui): 0 new citations.
  • eslint on the five changed console files: 0 errors.
  • Narrowing, declared: the console run covers apps/console/src/pages/settings/ and packages/i18n/, the modules that import the changed files; CI's Test UI shards run the whole tree. No dogfood battery: no ! in the title and no (narrowing) arm.

Generated by Claude Code

@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 16, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi

维护者速读

席位意见

按拒绝的结构而不是文字识别,并且 AI 行要求两个服务端事实同时成立,避免在仍显示提供商字段的页面上写「由平台托管」。开发提出的开放问题(控制台里保留 ai/provider 常量,还是等服务端将来给一个标记):席位同意先保留常量,等服务端真有标记时再换。同意落地。

席位核对 — ACCEPT · domain:ui#2 · head febd90e · 2026-11-16T07:26Z

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 16, 2026 07:27
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit 8436f67 Nov 16, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-q4ltjy branch November 16, 2026 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

托管环境里直接打开「文件存储」或 AI 提供商设置时,控制台显示「此项由平台托管」,而不是空白或报错

2 participants