Skip to content

Commit f9521e4

Browse files
committed
fix(cli): declare Clause-② yes (narrowing) and re-point the stale integrity_malformed evidence
The changeset now reads `Clause-②: yes (narrowing)`: readCompiledPluginManifest and CompiledPluginManifestRead are new named exports of @objectstack/runtime's root entry. The spec liveness row for `integrity` and the cli platform-checklist item (revision 6) no longer name the deleted `integrity_malformed` refusal: a malformed map is a ManifestSchema issue, refused as manifest_invalid. Claude-Session: https://claude.ai/code/session_016WV4czY8bzmjKmuhj1GP9c Co-authored-by: Claude <noreply@anthropic.com>
1 parent a03c314 commit f9521e4

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

‎.changeset/27686-plugin-install-parses-compiled-manifest.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66
fix(cli)!: `os plugin install` and the boot-time loader parse an artifact's compiled manifest through `ManifestSchema`, so a stale `.osplugin` (e.g. `packaging: 'manifest-deps'`) is refused with the schema's prescription instead of failing at boot as `import_failed`
77

8-
Clause-②: no (narrowing)
8+
Clause-②: yes (narrowing)
99
Metadata-protocol: narrowed
1010

1111
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped: `ManifestSchema` is consumed as it stands, and what changes is that two more doors hold the compiled manifest inside an artifact to it, as `os plugin build` already holds the source manifest. The refusal is the schema's own message (for `manifest-deps`, the retirement prescription), and the fix is to the source manifest and a rebuild, so there is nothing new for a metadata migration to rewrite and no tombstone. -->
1212

1313
**BREAKING** accept-set narrowing at `os plugin install` (`@objectstack/cli`) and at the boot-time loader for installed plugins (`@objectstack/runtime`'s `loadInstalledPlugins` / `verifyInstalledPlugins`, run by `os serve`, `os dev` and `os start`).
1414

1515
- **Before.** Both doors `JSON.parse`d the artifact's `objectstack.plugin.json` and read only `id` and `version` (and `runtime`, `main`, `integrity`, `permissions` by hand). An artifact built before a schema change installed: one carrying the retired `packaging: 'manifest-deps'` installed, and at boot its externalized imports failed and it was refused as `import_failed`, without the retirement prescription. Any other compiled-manifest drift (a missing `name` or `type`, an unknown key) installed the same way.
16-
- **Now.** One helper, `readCompiledPluginManifest` (exported by `@objectstack/runtime`), parses the compiled manifest through `ManifestSchema` for both doors.
16+
- **Now.** One helper, `readCompiledPluginManifest` (a new named export of `@objectstack/runtime`'s root entry, with its result type `CompiledPluginManifestRead`: the one widening in this change), parses the compiled manifest through `ManifestSchema` for both doors.
1717
- `os plugin install` refuses an invalid one before anything is unpacked, as `manifest_invalid`, listing the schema's issues (`--json`: `details`). For `manifest-deps` that is the retirement prescription. Nothing is written under the plugin home and no installation is recorded.
1818
- The boot loader refuses the plugin by name as `manifest_invalid` (a new `InstalledPluginRefusalCode`), with the schema's message, before anything of it is imported. It stays non-fatal: the boot goes on and every other installed plugin loads.
1919
- `os plugin install`'s `manifest_incomplete` and `integrity_malformed` refusals are gone: a missing `id` / `version` and a malformed `integrity` map are schema issues, refused as `manifest_invalid`.

‎docs/qa/platform-checklist/areas/cli.json‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,7 @@
17161716
"title": "os plugin build enforces the manifest at the packaging boundary: an invalid manifest is refused with located errors, `bundled` is the one packaging strategy (the retired `manifest-deps` is refused at the manifest, a native addon is refused by name), and the compiled manifest the artifact carries is readable back",
17171717
"since": "v15",
17181718
"status": "active",
1719-
"revision": 5,
1719+
"revision": 6,
17201720
"priority": "P2",
17211721
"surface": "cli",
17221722
"personas": [
@@ -1799,7 +1799,7 @@
17991799
"packages/cli/src/commands/plugin/build.ts#formatZodErrors — manifest read + named refusal; ManifestSchema.safeParse + formatZodErrors; the explicit id/version guard; packaging default and the Loaded line; entry resolution; the bundled-only esbuild call (only `@objectstack/*` external); findNativeAddons and the native-addon refusal ahead of the integrity map; computeIntegrity + the compiled manifest; the artifact write and its printed block",
18001800
"packages/cli/src/utils/osplugin.ts#MANIFEST_FILENAME — MANIFEST_FILENAME = 'objectstack.plugin.json'; OSPLUGIN_EXT; computeIntegrity (manifest and SIGNATURE excluded, keys sorted); the ustar writer with mtime pinned to 0; readOspluginManifest",
18011801
"packages/cli/src/commands/plugin/publish.ts#version — artifact discovery; readOspluginManifest before any network call; the id/version refusal; the unsigned-artifact notice; the auth refusal",
1802-
"packages/cli/src/commands/plugin/install.ts#PluginInstall — the install-time re-verification the integrity negative points at (verifyIntegrity over the unpacked entries, `integrity_mismatch` / `integrity_malformed`, nothing installed) and the install-time tier warning; not scored here",
1802+
"packages/cli/src/commands/plugin/install.ts#PluginInstall — the install-time re-verification the integrity negative points at (verifyIntegrity over the unpacked entries, `integrity_mismatch`; a compiled manifest ManifestSchema refuses, a malformed integrity map included, is `manifest_invalid` one step earlier through readCompiledPluginManifest; nothing installed) and the install-time tier warning; not scored here",
18031803
"packages/core/src/security/plugin-artifact-integrity.ts#verifyIntegrity — the one integrity verifier, shared by the publish preflight and the install-time check; not scored here",
18041804
"packages/runtime/src/installed-plugin-loader.ts#dispatchPluginRuntime — the boot-time tier dispatch point the trust-tier negative points at (`node` only; `sandbox` / `worker` refused by name; an undeclared tier refused); not scored here",
18051805
"packages/spec/src/kernel/manifest.zod.ts#ManifestSchema — ManifestSchema id and version (both required, version regex-pinned); PluginPackagingSchema ('bundled' only — 'manifest-deps' is a retired value refused with its migration prescription, ADR-0025 v2 §3.3); PluginRuntimeSchema (the trust tier, ADR-0025 §3.6)",
@@ -1838,6 +1838,12 @@
18381838
"date": "2026-10-29",
18391839
"change": "the integrity and trust-tier negatives re-pointed, no clause changed: both said nothing in this repo verifies or dispatches, and both stopped being true with the install loop — os plugin install re-verifies the integrity map at unpack (install.ts#PluginInstall through verifyIntegrity, slice 1, 10f27b6508) and the boot-time loader dispatches on `runtime` before any import (installed-plugin-loader.ts#dispatchPluginRuntime, slice 2, d4ff1a025f). Each negative now names that code as the check this item does NOT score, in place of the tracker numbers it cited, which do not resolve in this repository; three source rows added for the code they point at. The scored clauses and steps are unchanged. Re-verified against the source at 86f2afeb23, no qa-run record",
18401840
"ref": "#27685"
1841+
},
1842+
{
1843+
"revision": 6,
1844+
"date": "2026-10-30",
1845+
"change": "one source row re-pointed, no clause changed: os plugin install no longer has an `integrity_malformed` refusal. The compiled manifest is parsed through ManifestSchema first (readCompiledPluginManifest, the parse install and the boot loader share), so a malformed integrity map is refused as `manifest_invalid` before the integrity step; `integrity_mismatch` is unchanged. Re-verified against install.ts and compiled-plugin-manifest.ts at this PR's head, no qa-run record",
1846+
"ref": "#27686"
18411847
}
18421848
]
18431849
},

‎packages/spec/liveness/manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@
304304
},
305305
"integrity": {
306306
"status": "live",
307-
"evidence": "packages/cli/src/commands/plugin/install.ts#PluginInstall (re-verification at unpack — `verifyIntegrity(files, manifest.integrity, …)` over the archive's entries before anything is written; a digest mismatch, a declared file that is missing or a packaged file the map does not name ⇒ `integrity_mismatch`, a map that is not an object ⇒ `integrity_malformed`, exit 1, nothing installed); packages/cli/src/commands/plugin/publish.ts#PluginPublish (the publish preflight self-check against the manifest's own declared digests, refusing the publish on the same three violations)",
307+
"evidence": "packages/cli/src/commands/plugin/install.ts#PluginInstall (re-verification at unpack — `verifyIntegrity(files, manifest.integrity, …)` over the archive's entries before anything is written; a digest mismatch, a declared file that is missing or a packaged file the map does not name ⇒ `integrity_mismatch`, a map that is not a path → digest record is refused one step earlier as a `ManifestSchema` issue, `manifest_invalid`, by readCompiledPluginManifest, the parse both install and the boot loader share; exit 1, nothing installed); packages/cli/src/commands/plugin/publish.ts#PluginPublish (the publish preflight self-check against the manifest's own declared digests, refusing the publish on the same three violations)",
308308
"verifiedAt": "2026-10-28",
309309
"evidenceScope": "in-repo",
310310
"note": "Per-file content digests of the packaged artifact, computed at build (packages/cli/src/commands/plugin/build.ts#PluginBuild via computeIntegrity). 2026-10-28 (#27123): FLIPPED dead → live. The row had stood `dead` per the #13464 mandate as the enforce-or-remove worklist entry for the RULED leg, re-verification at install-time unpack (ADR-0025 §3.5 step 5), and named the flip as belonging to whatever built that leg; `os plugin install` is it, re-hashing every unpacked entry against the map and refusing the install by name before it writes anything. Both readers live in packages/core/src/security/plugin-artifact-integrity.ts#verifyIntegrity. An absent map is still a permissive pass (the field is `.optional()`). Not yet built, and not this key's reader: the boot-time loader (ADR-0025 §3.5 M1's next slice), which is to re-verify the kept original artifact against its detached signature — a different mechanism on a different field (packages/core/src/security/plugin-artifact-signature.ts)."

0 commit comments

Comments
 (0)