Repository navigation
Commit e5ae93d
fix(console): the loose-items banner counts only items its links can move into a package (#38818)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwB7Un8hgmYaC4XFXQuvaosiq)_
Fixes #38776
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
用户能看到什么变化:管理员在设置的软件包页上,不再看到「数据源(1)」这类散落项提示;横幅只数能移入软件包的项,每个链接打开的列表都能直接移入。
- 为什么做:散落项移入软件包的入口这周刚上线,横幅把平台自带的默认数据源也算进去了,点进去却没法移,这次让横幅和移入入口说同一句话。
- 出错会怎样:最坏是横幅少数或多数几项,不影响任何数据和保存;撤回这次改动即恢复原样。
- 要你做什么:无。
## What changes
The Packages page banner ("N items belong to no package") read every
metadata type that takes a runtime write and counted every row with no
`_packageId`. On a fresh showcase that counted the platform's `default`
datasource: `DefaultDatasourcePlugin.registerVisibility` registers it in
memory with no package, and its "Datasources (1)" link
(`/studio/~all/metadata/datasource?source=loose`) is routed by the
Studio area to Setup's Datasources page, which has no Loose list and no
move.
- `LooseItemsBanner.tsx`: `looseCountTypes` keeps only a type whose
Studio list offers the "Loose" value. Not `SETUP_KEPT_METADATA_TYPE`
(the datasource: every Studio address of it opens Setup's Datasources
page, ADR-0146 D1, and ADR-0084 as amended 2026-11-26, decision 12,
keeps connections in Setup as environment configuration), and not a type
that registers its own `ListPage`, which replaces the default list that
draws the Loose value. The datasource is not read at all any more.
- `looseMove.ts`: `isLooseRow`, the one predicate the banner and the
list's Loose value share, also leaves out a package-less record stamped
`_provenance: 'platform'`. That is the move door's own judgement
(`protocol-package-move-in.ts`: loose rows are package-less and not
`isPlatformRecordRow`), so neither surface offers a move the door
answers `NOT_LOOSE`. Same defect class as the datasource count, same
predicate, so it is fixed in place.
- `ResourceListPage.tsx` is not edited: it already reads `isLooseRow`.
- `.changeset/38776-loose-banner-movable-items.md`:
`@object-ui/app-shell` patch.
Ruling kept: a selection of loose items still moves into a package
(ruling 7184753035, question 3). Every package-less row of a listable
type with no platform mark is still counted and still offers the move.
Files to read first, riskiest first:
1. `ui/packages/app-shell/src/views/metadata-admin/looseMove.ts`: the
`isLooseRow` hunk; it changes the list's Loose filter too.
2.
`ui/packages/app-shell/src/views/metadata-admin/LooseItemsBanner.tsx`:
`offersLooseList` and `looseCountTypes`.
3.
`ui/packages/app-shell/src/views/metadata-admin/LooseItemsBanner-38150.test.tsx`:
the new describe block for this card.
## Tests
New top-level describe blocks in the two existing harness files
(AGENTS.md: a new pin for a component with a shared harness file goes
into that file):
- `LooseItemsBanner-38150.test.tsx`: the fixture now declares
`datasource` as the registry does (`allowRuntimeCreate: true`) and
serves the `default` row as `GET /meta/datasource` does. Pinned: the
datasource type is neither read nor linked; a platform record is not
counted; control: a package-less row with no platform mark is still
counted.
- `looseMove-38150.test.ts`: `isLooseRow` is false for a package-less
platform record; control: true for a package-less row without the mark,
false for a packaged row; the Loose list (`applyListState`) keeps no
platform record.
Red on the source at the base, green on the fix: see Verification.
## Acceptance notes
- The link half of the card holds structurally: every type the banner
still links has a Studio list that draws the Loose value, because the
only type with its own `ListPage` on main is the datasource.
- A runtime datasource created in Setup with no package is no longer
counted either. Its only home is Setup's Datasources page, which offers
no move, and ADR-0084 decision 12 manages connections there alone. If
datasources should ever be moved into packages from Setup, that is a new
door, not this banner.
- The platform-record exclusion has no producer in this repository (only
`MetadataManager.register` with `origin: 'platform'` stamps it; the
hosted runtime registers its AI skills, agents and tools that way). It
is pinned at unit level only.
- No real-app reading was taken; the reproduction is the unit fixture of
the served `default` row.
## Verification
Two-minute check: boot showcase, open Setup, Packages. Expected: no
"Datasources" entry in the loose-items banner (and no banner at all when
nothing else is loose); a loose flow, if one exists, still shows with a
link to the Loose list of flows, where it can be selected and moved.
Readings at `c3634143` (the branch head: the fix commits merged with
origin/main `d97aaaea`, which touched no file under `ui/`). Vitest from
`ui/`, `--maxWorkers=2`, through the shared verify lock.
<details><summary>Red at the base, green on the fix</summary>
- Red: the two harness files with `LooseItemsBanner.tsx` and
`looseMove.ts` restored from base `0fc9eab9` (working tree only, put
back from HEAD afterwards): `Tests 7 failed | 12 passed (19)`. Failing:
the two new `isLooseRow` pins, both new banner pins, and three existing
banner tests that now see the datasource read (`counts the loose rows…`
total 4, the not-read control, the nothing-loose control). The two new
controls passed on the base.
- Green: the same two files plus `studioOrgScopeRetired.test.ts`
(imports `looseListPath`): `Test Files 3 passed (3)`, `Tests 30 passed
(30)`.
- The loose surfaces' consumer tests
(`ResourceListPage.looseMove-38150`,
`ResourceListPage.authoredPackageSource-38150`, `LooseMoveDialog-38150`,
`LooseItemsBanner-38150`, `looseMove-38150`, `studioOrgScopeRetired`,
`studioScope`, `PackagesPage.moduleDisable-28118`): `Test Files 8 passed
(8)`, `Tests 80 passed (80)`.
- `pnpm --filter @object-ui/app-shell type-check` (both programs,
`tsconfig.json` and `tsconfig.test.json`): exit 0, 0 errors.
- NOT MEASURED: app-shell's whole `metadata-admin/` and `studio-design/`
test directories (timed out at 530 s under the lock on a shared box).
That is `Test UI`'s, in CI.
</details>
<details><summary>Targeted gates (dispatch-gates --commands on this
diff)</summary>
- 38 families derived from tree `c3634143`; `dispatch-gates --ran`: 38
run, 0 NOT-MEASURED, every line carrying its exit code.
- 37 exited 0 on the first run. `pnpm --dir ui exec vitest run scripts/`
was killed (SIGKILL) when it ran unlocked beside other work. Re-run
through the lock with `--maxWorkers=2`: exit 0, `Test Files 172 passed |
2 skipped (174)`, `Tests 5159 passed | 2 skipped (5161)`.
- `check:nul-bytes`: exit 0. `overlap-check`: clean against origin/main.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzfcCk7a8bQdgyaxzu7)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 8456562 commit e5ae93d
5 files changed
Lines changed: 130 additions & 8 deletions
File tree
- .changeset
- ui/packages/app-shell/src/views/metadata-admin
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
64 | 70 | | |
65 | 71 | | |
66 | 72 | | |
| |||
111 | 117 | | |
112 | 118 | | |
113 | 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 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
16 | 24 | | |
17 | 25 | | |
18 | 26 | | |
| |||
22 | 30 | | |
23 | 31 | | |
24 | 32 | | |
25 | | - | |
| 33 | + | |
26 | 34 | | |
27 | 35 | | |
28 | 36 | | |
29 | 37 | | |
| 38 | + | |
30 | 39 | | |
31 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
32 | 53 | | |
33 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
34 | 57 | | |
35 | 58 | | |
36 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
14 | 20 | | |
15 | 21 | | |
16 | 22 | | |
| |||
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
38 | | - | |
39 | | - | |
40 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
41 | 58 | | |
42 | 59 | | |
43 | 60 | | |
| |||
0 commit comments