Skip to content

Commit 4f93696

Browse files
fix(metadata-protocol,runtime,app-shell)!: refuse a save or draft publish naming a package that is not installed (#26920)
Fixes #26708 Clause-②: yes (narrowing) Metadata-protocol: none Skills-docs: updated here — content/docs/concepts/metadata-lifecycle.mdx (no `skills/**` page teaches saving into a named package: `skills/objectstack-api` names `?package=` only as a read parameter) ## 维护者速读 - 改了什么:`/meta` 保存时若 `?package=` 指向本部署未安装的包,所有类型(不只 flow)的草稿和直接保存都会被拒(422 `WRITABLE_PACKAGE_REQUIRED`,什么都不写);`publish-drafts` 对未知包 id 先回 404;Studio 打开不存在的包显示"未找到包",未知栏目显示"页面不存在"。 - 为什么改:之前拼错包 id 也能保存成功,生成挂在"幽灵包"下的对象/仪表盘/页面,没有命名空间、无法卸载或导出,`publish-drafts` 还会把它们发布上线。 - 风险与回滚:只收紧请求,不改存储形状;已存在的幽灵行照常可读,可用 `discard-drafts` 清理。回滚即还原本 PR,无数据迁移。夹具改动量大(约 50 个测试文件改为先安装包),是规则收紧的直接后果。 - 先看:`packages/metadata-protocol/src/protocol.ts`(`uninstalledNamedBaseRefusal` 与 `saveMetaItem` 的调用点)、`packages/runtime/src/domains/packages.ts`(publish-drafts 的 404 位置)、`ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx`(`pkgMissing` 判定)。 - 两分钟验证:`pnpm dev -- --fresh -p 4417` 后登录,`PUT /api/v1/meta/dashboard/x?mode=draft&package=com.example.nosuch` 应回 422 `WRITABLE_PACKAGE_REQUIRED`;再打开 `/_console/studio/com.example.nosuch/data` 应看到"未找到包"。 - 需要你做的:无,席位落地。 ## What changes - **`@objectstack/metadata-protocol`** — the flow-only named-base rule (#20863) is now one private helper, `uninstalledNamedBaseRefusal`, and `saveMetaItem` asks it for every type, draft and active, on authoring saves (not on the `migrate-stored` and `package-duplicate` rewrites of stored rows). A save naming a package id the registry does not hold is refused `422 WRITABLE_PACKAGE_REQUIRED` with `packageId` and the ADR-0070 docs link, before anything is written or registered. The flow arm (`tenantAuthoredWriteRefusal`) calls the same helper, so its sentence is unchanged byte for byte and other types get the same sentence with their type name. The `sys_metadata` sentinel, a save naming no package and a save naming an installed package are unchanged. - **`@objectstack/runtime`** — `POST /packages/:id/publish-drafts` on an id the registry does not hold answers `404 RESOURCE_NOT_FOUND` (the `GET /packages/:id` answer, the existing unknown-id code) before the protocol is asked, even when drafts are stored under that id. The check sits after the capability probe, like `discard-drafts` and the commit trail, so a host that cannot publish still answers 501. No error code was added. Stored rows under such an id are not migrated or deleted. - **`@object-ui/app-shell`** — `/studio/ID/…` for an id the package list does not hold renders "Package not found" (no pillars, no Changes / Publish / create-app, one button back to the Studio landing). A pillar segment Studio has no pillar for renders a not-found state instead of falling through to Interfaces. It reads the existing `GET /api/v1/packages` (no new endpoint, still one request): a switcher entry counts as installed; otherwise the id is looked up among every listed id, so kernel packages the switcher hides still open. A list that failed to load leaves the builder as it was. - Docs: one paragraph in `content/docs/concepts/metadata-lifecycle.mdx`; changeset `26708-named-base-every-type.md` (patch on the three packages, BREAKING banner, both declaration lines). ## Why `PUT /api/v1/meta/:type/:name?package=ID` stored the item bound to `ID` even when no installed package had that id, as a draft or live, and with no manifest the object namespace rule was skipped too. `publish-drafts` on that id then put the drafts live, owned by a package that cannot be uninstalled or exported. Only `flow` refused it. ## Tests - New `packages/metadata-protocol/src/protocol.named-base-every-type.test.ts` (13 tests): object, dashboard and page, draft and active, refused with the envelope (`code`, `status`, `packageId`, message first sentence) and nothing inserted or registered; the flow arm's exact sentence; a plural type spelling; controls for an installed package, the sentinel / null / no package, and the two server-side rewrites. - `packages/runtime/src/domains/packages-draft-doors-unknown-package.test.ts`: drafts stored under an unknown id are not published (404, the protocol is not asked, no visibility flip); controls that a known package still publishes and an unknown id's drafts are still discarded. - New `ui/…/StudioDesignSurface.notFound-26708.test.tsx` (10 tests): not-found on all four pillars with no pillar links or package actions and one list request, the way back, controls for a listed package, a kernel package and a failed list, and the unknown pillar segment. - Red first: on the base tree the protocol pins fail 7 of 13 (the 6 controls pass), the runtime pin fails, and the Studio pins fail 6 of 10 (the 4 controls pass). - Fixtures: about 50 test files across metadata-protocol, objectql, runtime and rest saved into package ids that were never installed. Each now installs the package it names, as a boot or `POST /packages` does (`authored`, or `code` where the file's premise is a shipped package). Where the package's closure now judges a view's object (`list-view-object-outside-closure`), the fixture registers the bound object under the package or declares the owner as a dependency. None of these widened the rule. - Dogfood: three files saved into package ids no boot installs (`package-first-authoring`, `package-uninstall-revokes-named-grants`, `flow-shipped-name-published-door`). Each now creates its base package first through `protocol.installPackage` (as `POST /api/v1/packages` does) under a valid reverse-domain id with its own namespace; the old ids used underscores, which the install door refuses as invalid package ids. - `StudioDesignSurface.flowCanvasChip-11665.test.tsx`: the zh tooltip assertion now waits for the lazily fetched `studio` catalogue it reads (it answers `en` until the zh catalogue lands and re-renders the pillar). It passed before only because of module load order; adding two keys to `i18n.ts` changed that order. - Package suites on the final head (`48af4d05fc`, after merging `main` at `96e7a4335c`, which holds #26853's draft-door query refusal in the same handler): `@objectstack/runtime` 7468 passed / 19 skipped, `@objectstack/metadata-protocol` 21679 passed / 26 skipped, `@objectstack/objectql` 8843 passed, `@objectstack/rest` 6513 passed / 326 skipped; `typecheck` exit 0 on all four. UI `packages/app-shell/src/views/studio-design` + `metadata-admin`: 835 files, 8321 passed / 1 skipped; `@object-ui/app-shell` `type-check` exit 0. - `scripts/engine-double-contract.pinned.json`: the new protocol test's engine double answers `delete`, `findOne` and `update` it never reads; recorded with `pnpm check:engine-double-contract --write`. ## Acceptance notes - How rows already stored under an uninstalled id surface (live, on one dev DB written by `main`, then booted on this branch): the active row still reads (`GET /meta/dashboard/NAME` 200) and still lists under `?package=ID`; its draft still reads; a save naming the id is refused 422; `publish-drafts` answers 404; `discard-drafts` answers 200 and removes the drafts; the id is not in `GET /api/v1/packages`, so Studio shows "Package not found" for it. - Two doors still write or publish under such an id, both outside this card's ruling: a save naming NO package for an item whose active row is bound to the phantom id inherits that binding (#11087), and the per-item `POST /meta/:type/:name/publish?package=ID` publishes a phantom-bound draft (200). Both only reach rows written before this change. - Studio's recent-packages list can still hold an id that later reads "Package not found"; the not-found page offers the way back. ## Verification - Live red/green on `pnpm dev -- --fresh`, signed in as the dev admin, same probe on both trees. Base (`4f05de4`): six `PUT /api/v1/meta/{object,dashboard,page}/NAME[?mode=draft]&package=com.example.nosuch` all answered 200 and stored the rows bound to that id; `POST /packages/com.example.nosuch/publish-drafts` answered 200 while `GET /packages/com.example.nosuch` answered 404. This branch: the same six saves answer `422 WRITABLE_PACKAGE_REQUIRED` ("Cannot save dashboard 'ghost_dashboard_a' into package 'com.example.nosuch': no package with that id is installed in this deployment, …"), `publish-drafts` answers `404 RESOURCE_NOT_FOUND`. Controls unchanged on both: a save naming no package (200), and a package created through `POST /api/v1/packages` then saved into and published (201, 200, 200). - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` on `48af4d05fc`: 105 commands, each run with its exit code captured before any pipe; all 105 exit 0. `--ran` reconciliation: "105 derived, 105 run, 0 NOT-MEASURED, 0 UNRUN". - Full dogfood once on the final head `48af4d05fc` (`pnpm --filter @objectstack/dogfood test`): exit 0, 327 files passed / 3 skipped, 2683 tests passed / 20 skipped. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (`packages/spec` untouched.) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. (Scoped to the touched files on the final head: root ESLint exit 0; `ui` ESLint exit 0, 0 errors, 14 warnings, all on lines this PR did not write — the one inside the edited effect is the existing `setPkgWritable(undefined)` call.) - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: not touched. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5nhhuhjVQJ8R3qK9UB)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01FEkQ5nhhuhjVQJ8R3qK9UB --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent acc9c57 commit 4f93696

76 files changed

Lines changed: 1268 additions & 104 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
'@objectstack/runtime': patch
4+
'@object-ui/app-shell': patch
5+
---
6+
7+
**BREAKING** fix(metadata)!: a save or a draft publish naming a package that is not installed is refused, for every metadata type; Studio shows "package not found"
8+
9+
Clause-②: yes (narrowing)
10+
Metadata-protocol: none
11+
12+
<!-- adr-0087: not-required (no-migration-prescription) What is refused is a REQUEST, never a stored shape: a `/meta` save naming a package id no installed package has, and `publish-drafts` on such an id. No metadata document changes meaning or validity, no key or value is retired, and rows already stored under such an id still read, list and discard exactly as before, so there is nothing for `objectstack migrate meta` to rewrite. The remedy is a different request (name an installed package, create one first, or name none), not a conversion between two metadata versions. The other categories are closed on facts: all three packages publish (not unpublished); no ADR-0087 id is named or touched (not registered or already-registered); no spec or Zod face moves (not type-surface-only, not runtime-interface-only); and no export is retired (not runtime-export-retired). -->
13+
14+
`PUT /api/v1/meta/:type/:name?package=ID` used to store the item bound to `ID` even when no installed package has that id, as a draft (`?mode=draft`) or live. With no manifest there was no namespace, so the object prefix rule was skipped too, and `POST /api/v1/packages/ID/publish-drafts` then put those drafts live, owned by a package that cannot be uninstalled or exported. Only `flow` refused it.
15+
16+
- **`@objectstack/metadata-protocol`**: the flow-only named-base rule is now one helper that `saveMetaItem` asks for every type, draft and active, on authoring saves. A save naming an id the package registry does not hold is refused `422 WRITABLE_PACKAGE_REQUIRED`, with the id as `packageId`, and nothing is written. The flow refusal is unchanged, byte for byte, and other types get the same sentence with their type name. Saves naming no package, the `sys_metadata` sentinel or an installed package are unchanged, and so are the two server-side rewrites of stored rows (`migrate-stored` and package duplication).
17+
- **`@objectstack/runtime`**: `POST /packages/:id/publish-drafts` on an id the registry does not hold answers `404 RESOURCE_NOT_FOUND` (the answer `GET /packages/:id` gives) before anything is published, even when drafts are stored under that id. Those drafts are not migrated or deleted. `POST /packages/:id/discard-drafts` still removes them.
18+
- **`@object-ui/app-shell`**: `/studio/ID/…` for an id the package list does not hold shows "package not found", with a way back to the Studio landing, instead of a builder whose saves the server refuses. A pillar segment Studio does not have shows a not-found state instead of the Interfaces pillar. Kernel packages the switcher hides are still opened. If the package list fails to load, the builder shows as before.
19+
20+
**What to do.** Save into a package that is installed: create it first (`POST /api/v1/packages`, or **New package** in Studio), or save without `?package=`. To clean up drafts saved under a mistyped id before this change, call `POST /api/v1/packages/ID/discard-drafts`.

‎content/docs/concepts/metadata-lifecycle.mdx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,12 @@ Every runtime-authored item lives inside a **writable package** — there are no
9292
orphans. Code-defined and installed packages are **read-only** at runtime, so the
9393
first step of any Studio/API authoring action is to target a *writable* package (a
9494
"base"): a create aimed at a read-only package is rejected, and the author is asked
95-
to pick or create a writable base first. An in-place edit of an item the read-only
95+
to pick or create a writable base first. A save naming a package id this deployment
96+
has not installed is refused the same way, draft or active and for every type
97+
(`422 WRITABLE_PACKAGE_REQUIRED`, nothing written), and
98+
`POST /packages/:id/publish-drafts` on such an id answers `404`, publishing nothing;
99+
drafts stored under one before that rule can still be removed with
100+
`POST /packages/:id/discard-drafts`. An in-place edit of an item the read-only
96101
package ships is refused too; for a flow, an action or a permission set the refusal
97102
names that type's sanctioned path instead (see [ADR-0126](#packaged-flows-actions-and-permission-sets-adr-0126)). New objects, fields, views, and
98103
flows are namespaced into that package — which is exactly what `os package publish`

‎packages/cli/src/commands/meta/delete-reset-carriers.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,16 @@ async function bootDoor() {
308308
engine.registry.registerObject(SysMetadataObject as any, TEST_PACKAGE_ID);
309309
engine.registry.registerObject(SysMetadataHistoryObject as any, TEST_PACKAGE_ID);
310310
engine.registry.registerObject(SysMetadataAuditObject as any, TEST_PACKAGE_ID);
311+
// [#26708] A save naming a package the registry does not hold is refused,
312+
// so the two packages the item is saved into are installed first, as a
313+
// boot or `POST /packages` does. Each depends on the package owning
314+
// `task`, so a view over `task` stays inside its closure.
315+
for (const id of [PKG, OTHER_PKG]) {
316+
engine.registry.installPackage(
317+
{ id, name: id, version: '1.0.0', dependencies: { [TEST_PACKAGE_ID]: '*' } } as any,
318+
'authored',
319+
);
320+
}
311321
// Real DDL — the overlay rows the assertions read are physically there.
312322
await engine.syncSchemas();
313323

‎packages/cli/src/commands/meta/register-package.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,16 @@ async function bootDoor() {
240240
engine.registry.registerObject(SysMetadataObject as any, TEST_PACKAGE_ID);
241241
engine.registry.registerObject(SysMetadataHistoryObject as any, TEST_PACKAGE_ID);
242242
engine.registry.registerObject(SysMetadataAuditObject as any, TEST_PACKAGE_ID);
243+
// [#26708] A save naming a package the registry does not hold is refused,
244+
// so the two packages the item is saved into are installed first, as a
245+
// boot or `POST /packages` does. Each depends on the package owning
246+
// `task`, so a view over `task` stays inside its closure.
247+
for (const id of [PKG, OTHER_PKG]) {
248+
engine.registry.installPackage(
249+
{ id, name: id, version: '1.0.0', dependencies: { [TEST_PACKAGE_ID]: '*' } } as any,
250+
'authored',
251+
);
252+
}
243253
await engine.syncSchemas();
244254

245255
const protocol: any = new ObjectStackProtocolImplementation(engine as any);

‎packages/cli/test/permission-set-zero-row.integration.test.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ import { SecurityPlugin, appSecurityPluginOptions } from '@objectstack/plugin-se
4444
const ENV = 'env_zero_row';
4545
const TABLE = 'sys_permission_set';
4646
/** A package whose drafts the package door publishes. */
47-
const DRAFT_PKG = 'app.zero_row_drafts';
47+
const DRAFT_PKG = 'app.zero-row-drafts';
4848
/** A writable base that publishes its set directly (ADR-0070). */
49-
const BASE_PKG = 'app.zero_row_base';
49+
const BASE_PKG = 'app.zero-row-base';
5050

5151
const stack: any = {
5252
manifest: { id: 'com.example.zero_row', name: 'zero_row', version: '0.0.1', type: 'app' },
@@ -117,6 +117,11 @@ for (const kind of ['host', 'environment'] as Kind[]) {
117117
const protocol = await kernel.getServiceAsync('protocol');
118118
const set = (name: string) => ({ name, label: name, isDefault: true, objects: { zero_doc: { allowRead: true } } });
119119

120+
// [#26708] A save naming a package the registry does not hold is
121+
// refused, so both packages are created first, as `POST /packages` does.
122+
await protocol.installPackage({ manifest: { id: DRAFT_PKG, name: 'Zero row drafts', version: '0.1.0', type: 'app', namespace: 'zrd' } });
123+
await protocol.installPackage({ manifest: { id: BASE_PKG, name: 'Zero row base', version: '0.1.0', type: 'app', namespace: 'zrb' } });
124+
120125
// The package door: a draft into the package, then its atomic publish.
121126
await protocol.saveMetaItem({ type: 'permission', name: 'zero_pkg_default', item: set('zero_pkg_default'), packageId: DRAFT_PKG, mode: 'draft' });
122127
const published = await protocol.publishPackageDrafts({ packageId: DRAFT_PKG, actor: 'system' });

‎packages/cli/test/security-catalog-echo-env-kernel.integration.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const ENV = 'env_catalog_echo';
5252
const SYS = { context: { isSystem: true } } as any;
5353

5454
/** A writable runtime package, never installed as code. */
55-
const RUNTIME_PKG = 'app.catalog_echo';
55+
const RUNTIME_PKG = 'app.catalog-echo';
5656
/** Its default set: `isDefault: true`, no `packageId` in the body. */
5757
const PKG_SET = 'echo_pkg_default';
5858
/** A set saved into no package. */
@@ -143,6 +143,9 @@ function scenario(kind: Kind) {
143143
const { ql, protocol, org } = state as Required<typeof state>;
144144
expect(protocol.environmentId ?? null, 'topology').toBe(kind === 'environment' ? ENV : null);
145145
const set = (name: string) => ({ name, label: name, isDefault: true, objects: { echo_doc: { allowRead: true } } });
146+
// [#26708] A save naming a package the registry does not hold is refused,
147+
// so the runtime package is created first, as `POST /packages` does.
148+
await protocol.installPackage({ manifest: { id: RUNTIME_PKG, name: 'Catalog echo', version: '0.1.0', type: 'app', namespace: 'cecho' } });
146149
await protocol.saveMetaItem({ type: 'permission', name: PKG_SET, item: set(PKG_SET), packageId: RUNTIME_PKG, mode: 'draft' });
147150
const published = await protocol.publishPackageDrafts({ packageId: RUNTIME_PKG, actor: 'system' });
148151
expect(published, JSON.stringify(published)).toMatchObject({ outcome: 'published', failed: [] });

‎packages/client/src/meta-delete-item-carriers.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,16 @@ async function bootDoor() {
503503
engine.registry.registerObject(SysMetadataObject as any, TEST_PACKAGE_ID);
504504
engine.registry.registerObject(SysMetadataHistoryObject as any, TEST_PACKAGE_ID);
505505
engine.registry.registerObject(SysMetadataAuditObject as any, TEST_PACKAGE_ID);
506+
// [#26708] A save naming a package the registry does not hold is refused,
507+
// so the two packages the item is saved into are installed first, as a
508+
// boot or `POST /packages` does. Each depends on the package owning
509+
// `task`, so a view over `task` stays inside its closure.
510+
for (const id of [PKG, 'com.qa.beta']) {
511+
engine.registry.installPackage(
512+
{ id, name: id, version: '1.0.0', dependencies: { [TEST_PACKAGE_ID]: '*' } } as any,
513+
'authored',
514+
);
515+
}
506516
// Real DDL — the overlay rows the assertions read are physically there.
507517
await engine.syncSchemas();
508518

‎packages/client/src/meta-publish-item-package.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,16 @@ async function bootDoor() {
263263
engine.registry.registerObject(SysMetadataObject as any, TEST_PACKAGE_ID);
264264
engine.registry.registerObject(SysMetadataHistoryObject as any, TEST_PACKAGE_ID);
265265
engine.registry.registerObject(SysMetadataAuditObject as any, TEST_PACKAGE_ID);
266+
// [#26708] A save naming a package the registry does not hold is refused,
267+
// so the two packages the item is saved into are installed first, as a
268+
// boot or `POST /packages` does. Each depends on the package owning
269+
// `task`, so a view over `task` stays inside its closure.
270+
for (const id of [PKG, OTHER_PKG]) {
271+
engine.registry.installPackage(
272+
{ id, name: id, version: '1.0.0', dependencies: { [TEST_PACKAGE_ID]: '*' } } as any,
273+
'authored',
274+
);
275+
}
266276
// Real DDL — the overlay rows the assertions read are physically there.
267277
await engine.syncSchemas();
268278

‎packages/metadata-protocol/src/protocol-publish-drafts-object-field-refs.test.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ import { describe, expect, it } from 'vitest';
4545
import { assertEngineDeleteDispatch, assertEngineUpdateDispatch, assertEngineFindOnePredicate } from '@objectstack/metadata-core';
4646
import { ObjectStackProtocolImplementation } from './protocol.js';
4747

48+
/**
49+
* [#26708] The packages this file's saves name, installed: a save naming a
50+
* package no installed package has is refused (`WRITABLE_PACKAGE_REQUIRED`)
51+
* before any gate this file pins is reached. Each answers a manifest that
52+
* declares no dependencies, as an authored base does.
53+
*/
54+
const INSTALLED_PACKAGES: ReadonlySet<string> = new Set(['app.studio']);
55+
const installedPackage = (id: string) => (INSTALLED_PACKAGES.has(id) ? { manifest: { id } } : undefined);
56+
57+
4858
interface Row {
4959
id: string;
5060
type: string;
@@ -183,7 +193,7 @@ function makeStubEngine() {
183193
registerObject: () => {},
184194
// No declared package namespace → publishPackageDrafts skips the
185195
// ADR-0028 prefix check (legacy-grandfathered path).
186-
getPackage: () => undefined,
196+
getPackage: installedPackage,
187197
},
188198
};
189199
return { engine, rows, historyRows };

‎packages/metadata-protocol/src/protocol-publish-drafts-org-scope.test.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ import { describe, expect, it } from 'vitest';
1111
import { assertEngineDeleteDispatch, assertEngineUpdateDispatch, assertEngineFindOnePredicate } from '@objectstack/metadata-core';
1212
import { ObjectStackProtocolImplementation } from './protocol.js';
1313

14+
/**
15+
* [#26708] The packages this file's saves name, installed: a save naming a
16+
* package no installed package has is refused (`WRITABLE_PACKAGE_REQUIRED`)
17+
* before any gate this file pins is reached. Each answers a manifest that
18+
* declares no dependencies, as an authored base does.
19+
*/
20+
const INSTALLED_PACKAGES: ReadonlySet<string> = new Set(['app.projects']);
21+
const installedPackage = (id: string) => (INSTALLED_PACKAGES.has(id) ? { manifest: { id } } : undefined);
22+
23+
1424
/**
1525
* Regression for #3115 — `publish-drafts` fails with `no_draft` after saving a
1626
* draft via Studio UI.
@@ -177,7 +187,7 @@ function makeStubEngine() {
177187
registerObject: () => {},
178188
// No declared package namespace → publishPackageDrafts skips the
179189
// ADR-0028 prefix check (legacy-grandfathered path).
180-
getPackage: () => undefined,
190+
getPackage: installedPackage,
181191
},
182192
};
183193
return { engine, rows, historyRows };

0 commit comments

Comments
 (0)