Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .changeset/7881-package-lookup-failure-is-not-an-empty-result.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
'@object-ui/app-shell': patch
---

Studio: a failed package lookup no longer opens the management sheet on nothing

`fetchFullPackage` — the helper behind the switcher's "Package info & settings" —
fetched `/api/v1/packages` and went straight to `res.json()`, never reading
`res.ok`. The platform answers a failed read in the ADR-0112 envelope
(`{ success: false, error: { code, message } }`), which parses cleanly through
that reader: the error object is neither an array nor carries `packages`, so the
list fell to `[]` and the lookup returned `null` without throwing. `openManage`'s
`catch` therefore never ran and the two lines after it still fired, opening the
management sheet over a null package — which renders nothing. During an outage
the author clicked the menu item and got silence: no sheet, no toast, no
explanation.

The read now refuses a non-2xx, carrying the server's own `error.message` and
`error.code` (in the 5xx band the platform withholds the producer's prose, so the
code is the discriminating word) and naming the status when the body is not JSON
at all. The failure is reported through this surface's existing posture —
`formatMetadataError` on the shared `studio-package-list` sonner id, so one outage
across this surface's four callers of that endpoint is one toast, not four.

And the sheet no longer opens on a `null` package at all: a successful list that
simply does not contain the package — deleted or uninstalled elsewhere — now says
so instead of opening over nothing.
5 changes: 5 additions & 0 deletions packages/app-shell/src/views/metadata-admin/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,10 @@ const ENGINE_STRINGS_EN: Record<string, string> = {
'engine.studio.access.nameLabel': 'Name',
'engine.studio.access.idLabel': 'Identifier',
'engine.studio.pkg.manage': 'Package info & settings',
// objectui#7881 — the read SUCCEEDED and the package is simply not in the
// list; the sheet is not opened, and this says so instead of nothing.
'engine.studio.pkg.manageMissing':
'Package {id} is not in the installed list — it may have been deleted or uninstalled elsewhere.',
'engine.studio.data.savedDraft': 'Object “{label}” saved as draft',
'engine.studio.data.lastSaved': 'Saved {time}',
'engine.studio.publish': 'Publish',
Expand Down Expand Up @@ -3385,6 +3389,7 @@ const ENGINE_STRINGS_ZH: Record<string, string> = {
'engine.studio.access.nameLabel': '名称',
'engine.studio.access.idLabel': '标识',
'engine.studio.pkg.manage': '软件包信息与设置',
'engine.studio.pkg.manageMissing': '软件包 {id} 不在已安装列表中 —— 可能已在别处被删除或卸载。',
'engine.studio.data.savedDraft': '对象「{label}」已存为草稿',
'engine.studio.data.lastSaved': '已于 {time} 保存',
'engine.studio.publish': '发布',
Expand Down
Loading
Loading