Skip to content

Commit a43fc25

Browse files
committed
test(metadata): a stored row naming the host by the legacy package key is still unregistered with it; state the mark's limit
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgThzreKNjha83MypKs
1 parent 426f47c commit a43fc25

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

‎.changeset/32986-host-unregister-keeps-environment-rows.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
fix(metadata): unregistering the host package keeps the environment's own object, view, app, hook and dashboard rows
66

7-
Clause-②: no — no released answer moves: `unregisterPackage` reads the `_packageId` stamp since #32198, which has not shipped, and with this change it leaves the environment's own rows as the released version does. The boot pass's stamp, and every reader of it, answer as before.
7+
Clause-②: no — no released answer moves: `unregisterPackage` reads the `_packageId` stamp since #32198, which has not shipped, and with this change it leaves the environment's own rows the boot pass marked, as the released version does. The boot pass's stamp, and every reader of it, answer as before.
88
Metadata-protocol: none
99

1010
On a host that declares its package and stores metadata in a database, the boot pass stamps each stored row that names no package with the host's package. For a type not stored per `(package, name)` — `object`, `view`, `app`, `hook`, `dashboard` and the rest — that stamp stays, so ObjectQL still registers such an object as the host package's contribution. But `MetadataManager.unregisterPackage(host)` took the stamp as membership and deleted those rows, from memory and from the database: the environment's own items were lost when the host package was unregistered.
1111

12-
`unregisterPackage` now leaves an item that a stored-row loader handed on naming no package and that names the package only by the stamp. The host's own items (a row whose stored body carries the host's stamp, an item registered for the host in memory or from files) are removed as before. Types stored per `(package, name)` are unchanged here.
12+
`unregisterPackage` now leaves an item that a stored-row loader handed on naming no package and that names the package only by the stamp. The host's own items (a row whose stored body carries the host's stamp or names it under the legacy `package` key, an item registered for the host in memory or from files) are removed as before. Types stored per `(package, name)` are unchanged here.
13+
14+
The limit: a row is kept when the boot pass marked it and nothing has rewritten it since. The mark is on the item the pass registered. A later write that replaces that item with a copy still stamped with the host (ObjectQL's late-manifest bridge, `publishPackage` and `revertPackage` of the host) drops the mark and stores the stamp in the row, and `unregisterPackage(host)` then deletes that row again. #33003 closes that before the release that ships #32198.

‎packages/metadata/src/loaders/database-loader.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3004,6 +3004,19 @@ describe('[#32986] unregisterPackage of the host package keeps the environment\'
30043004
expect(await state(m)).toEqual(ITEMS.map(([type]) => [type, null, null, 0]));
30053005
});
30063006

3007+
/**
3008+
* [#32986, review S2] The legacy `package` key is the item's own claim, as
3009+
* 18.3.0's `unregisterPackage` read it: the row is the host's, though its
3010+
* stored body names no package the store's reads index (`_packageId`).
3011+
*/
3012+
it('CONTROL the host\'s own rows naming it through the legacy `package` key in their stored bodies: unregisterPackage(host) still removes each, from the registry and storage', async () => {
3013+
for (const [type, name] of ITEMS) await seed(type, name, null, { package: HOST });
3014+
const m = await bootPass(HOST);
3015+
expect(await state(m)).toEqual(ITEMS.map(([type]) => [type, HOST, 'env', 1]));
3016+
await m.unregisterPackage(HOST);
3017+
expect(await state(m)).toEqual(ITEMS.map(([type]) => [type, null, null, 0]));
3018+
});
3019+
30073020
it('an item registered in memory for the host (code) beside the environment\'s rows: unregisterPackage(host) removes the host\'s item and keeps the environment\'s (BEFORE: both removed)', async () => {
30083021
for (const [type, name] of ITEMS) await seed(type, name, null);
30093022
const m = await bootPass(HOST);

0 commit comments

Comments
 (0)