Skip to content

fix(cloud-connection): POST /api/v1/marketplace/install-local parses the package id through its declaration - #20022

Merged
os-steve merged 3 commits into
mainfrom
claude/issue-19576-install-local-id-gate
Sep 24, 2026
Merged

os-steve merged 3 commits into
mainfrom
claude/issue-19576-install-local-id-gate

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #19576

Clause-②: no (narrowing)

POST /api/v1/marketplace/install-local now parses the package id it installs through its declaration, ManifestSchema.shape.id (by reference, never a copy of the grammar). An id MANIFEST_ID_PATTERN refuses is answered PLUGIN_MANIFEST_INVALID with the declaration's own sentence (manifestIdRefusal, surfaced, not reworded). The status is 400 for an inline manifest and 502 for a cloud snapshot. Nothing is registered or written.

Diff measured between b81da66df773 (merge base, origin/main at dispatch) and 37b8ecfd027c (head). 4 files, +477 / -6.

The change

packages/cloud-connection/src/marketplace-install-local-plugin.ts, handleInstall:

  • Before: const manifestId = String(manifest?.id ?? manifest?.name ?? ''). Nothing parsed it. late-app, com.example.my_erp, the number 123, or a manifest carrying only a name installed with 200, and the value became the ledger file's key and the :manifestId route key.
  • After: one parse, at the one point where both branches have converged: the inline manifest (after normalizeBundle has flattened a compiled bundle) and the cloud-fetched snapshot. The parse sits ahead of the 409 MANIFEST_CONFLICT collision check, the ADR-0120 D5e posture gate, the hot-register and the ledger write. Validity is answered before collision.
  • manifest.name is no longer read as an id. ManifestSchema declares id, and name is an unpatterned display label. The inline branch's early refusal Inline manifest must have an "id" or "name". was deleted with the fallback it described. The inline packageId is now assigned from the parsed id, so no second, looser derivation remains.
  • The message: a string id surfaces the parse's own issue message, which is manifestIdRefusal('manifest.id', raw) by construction. A non-string id (absent, a number) fails the leg's type check first. That check's generic zod sentence names neither the key nor the form, so for that case the door calls manifestIdRefusal('manifest.id', raw) directly. Every refusal therefore names manifest.id and states the rule.
  • Error code: the existing ledgered PLUGIN_MANIFEST_INVALID is reused, with the same inlineManifest ? 400 : 502 split this door already uses for an invalid manifest. No new error code was added, and packages/spec is untouched.

Doors that are deliberately NOT gated: what an already-installed non-conforming entry does

Rehydrate at kernel:ready and the three :manifestId routes (DELETE, reseed-sample-data, purge-sample-data) act on ledger entries that already exist, so they are not gated. After this change, an entry that an older build installed under a now-refused id (for example a ledger file late-app.json) behaves as follows:

  • it still rehydrates at boot: pinned, manifest.register receives it and no error is logged;
  • it can still be removed with DELETE /api/v1/marketplace/install-local/late-app: pinned, answers 200, and the ledger no longer has it;
  • it cannot be re-installed under that id: pinned, a fresh POST answers 400, and the existing entry is left byte-for-byte at its old version.

Blast radius, measured BEFORE enforcing (the triage rider)

Readings on objectstack-ai/objectstack at e5786a58 (the gate commit; the only later commit tightens the new test file's assertions) unless stated otherwise.

probe reading control
every id the new parse saw across the WHOLE @objectstack/cloud-connection suite (a setup-file spy on ManifestSchema.shape.id.safeParse, recording file, test and value) 90 parses from 14 test files (70 of them from the 13 pre-existing files). 0 refused outside the new suite. The 13 pre-existing files drive app.test.crm, app.test.helpdesk, app.test.hotcrm, app.test.pipeline, app.test.proj, app.acme.crm, app.user.foo, app.mk.bar, app.brand.new, app.objectstack.hotcrm, com.acme.crm, com.acme.flat, com.acme.gated, com.acme.mrp, com.acme.clean and com.acme.tenancy. All of them conform. the same spy recorded all 15 refusals of the new suite, so the instrument sees a refusal when there is one
test fixtures that needed a new id none. No fixture was moved (old id to new id: n/a) the PM's lead named late-app. Its only hit is packages/objectql/src/plugin.integration.test.ts:237, which calls manifest.register directly and never reaches this door
other packages' tests driving this POST none. The 4 cli test files that name MarketplaceInstallLocalPlugin (serve-marketplace-*.test.ts ×3, serve-capability-identity.test.ts) mount or plan it, and a grep of them for POST, fetch( and .post( answers 0 lines git grep MarketplaceInstallLocalPlugin outside packages/cloud-connection/src lists those 4 test files plus install.ts, serve.ts, examples/app-showcase and docs, all opened
os package install (packages/cli/src/commands/package/install.ts:130) the artifact path sends id: artifact.manifest.id ?? artifact.id. That id comes from a built artifact, and defineStack refuses both late-app and a manifest without id (probed: manifest.id: Required property 'id' is missing). The catalog path sends packageId only, and the parse reads the snapshot's manifest.id a conforming defineStack manifest is accepted by the same probe
examples/* builds com.example.crm, .showcase, .todo, com.example.multi.core, com.example.multi.orders: all conform the platform checklist item platform-core.marketplace-install-local-lifecycle installs examples/app-crm through this door, and that id conforms
Studio import (objectui, read-only, pinned .objectui-sha 62597c58, same code on main a3380379) PackagesPage.tsx:850 (at the pin) forwards the user's file unchanged. It mints no id, so it is not a sender that depends on the fallback. Its client pre-check does mirror the retired rule (!manifest.id && !manifest.name, i18n missing "id" or "name"). See Acceptance notes the Studio catalog install (marketplaceApi.ts:675) sends packageId only
the cloud snapshot shape NOT MEASURED: the snapshot writer lives in objectstack-ai/cloud, which this session cannot read (an attach request was denied). The in-repo contract side is PackageSchema.manifestId (packages/spec/src/marketplace/package.zod.ts:172), which carries the same MANIFEST_ID_PATTERN on the publish face —

The measured answer is that no first-party code sends this door a refused id. The narrowing refuses hand-built caller input only. There is no grandfather clause and no route around it.

PM mechanism assumptions: what was measured

  1. Convergence point :763: confirmed. The gate went there. The card's probe was reproduced first as a failing test: late-app inline answered 200 (expected 200 to be 400).
  2. Name fallback: confirmed and removed. No first-party sender depends on it (table above).
  3. Status by branch under the existing PLUGIN_MANIFEST_INVALID: confirmed. No new code was needed, so the claim's Clause-②: no basis holds on that axis.
  4. Only the install POST is gated: confirmed and pinned (section above).
  5. "Some test ids are refused": falsified. 0 of 70 pre-existing parses were refused, so no fixture moved.

Both directions pinned

New file packages/cloud-connection/src/marketplace-install-local-id-gate.test.ts, 22 cases. Every refusal row except the repair-arm row asserts the declared envelope (BaseResponseSchema, envelopeViolations empty, ApiErrorSchema), code and status, a message identical to manifestIdRefusal('manifest.id', value), and that nothing was written: no manifest.register after boot, no syncSchemas after boot, and an unchanged ledger directory. The repair-arm row asserts the message only, because the message is its subject.

  • Refused inline, 400: late-app, com.example.my_erp, com.1acme.crm, Com.Acme.Crm, a whitespace-padded com.acme.crm (the raw value is parsed), '', a name-only manifest, a manifest with neither key, and id: 123.
  • Refused compiled bundle, 400: a nested manifest.id of late-app is refused after normalizeBundle.
  • Refused cloud snapshot, 502: late-app, and a name-only snapshot. fetch was called exactly once, so the refusal came from the snapshot.
  • Validity before collision: a refused id that local code also registered answers 400, not 409.
  • The repair survives: com.example.my_erp still carries 'com.example.my-erp'.
  • Lit controls: com.example.crm, com.example.my-erp and org.apache.superset inline, plus a conforming compiled bundle and a conforming snapshot. Each installs with 200, is registered once with the id intact, and gets a ledger file named for the id.
  • Legacy entry: rehydrates, DELETE removes it, and re-install is refused (see above).

Reverse verification: direction predicted BEFORE running, restore proven

leg predicted measured
repro: the first version of the new suite against the unmodified door (b81da66d plus the test file only, before commit) every refusal row red, every lit control and legacy row green 15 failed / 7 passed. The card's probe: late-app inline answered 200
ablation: at head 37b8ecfd, the committed gate block replaced by the old String(manifest?.id ?? manifest?.name ?? '') derivation, through scripts/ablation-replace.mjs (anchor hit x1 to x0, blob ce38ed611189 to 7560ea96170f) the same 15 red, the 7 controls green 15 failed / 7 passed. Restore: blob back to ce38ed611189 equal to HEAD, git diff HEAD empty, and git status --porcelain empty. The same leg at e5786a58 read the same 15 / 7

The subject resolves from src/ (the suite imports ./marketplace-install-local-plugin.js inside its own package), so dist/ is not on the resolution path of this ablation.

Docs

content/docs/deployment/publish-and-preview.mdx: the page taught 409 MANIFEST_CONFLICT as the install refusal. A bullet beside it now states that the collision check is the second refusal, not the first: 400 PLUGIN_MANIFEST_INVALID with the declaration's remedy (502 from a catalog snapshot), nothing written, and a name is not an id. A search of content/docs/** (outside references/ and releases/) for install-local, package install, MANIFEST_CONFLICT, PLUGIN_MANIFEST_INVALID and id or name found no other statement this change makes false. cli.mdx lists 401, the D5e stop and 404 for os package install without claiming completeness. The CLI prints the new refusal as Install failed (400): followed by the declaration's sentence (install.ts:208).

Changeset, and one point for the seat

.changeset/19576-install-local-id-gate.md: @objectstack/cloud-connection minor, a **BREAKING for callers of the install-local door** banner, and an ADR-0087 not-required (no-migration-prescription) disposition. It carries the PR's Clause-②: no line verbatim.

⚠️ This departs from the order's suggested patch, on purpose, and the reason is stated here. The two landed sibling gates for this same class, f9977c11 (HTTP door) and 2306a75e (protocol primitive), each declared Clause-②: no (narrowing), shipped minor, and carried the BREAKING banner plus the same ADR-0087 disposition. Per AGENTS.md, a (narrowing) is BREAKING, and a breaking change ships minor during the launch window. This door's accept set narrows the same way theirs did. The claim's line is bare Clause-②: no (no direction arm), and this body copies it verbatim, as the frame requires. If the seat agrees this is a narrowing, the fix is a seat edit of this body's line to Clause-②: no (narrowing). The minor level already satisfies the level axis under either spelling. The dev did not choose between the two silently.

Gates, at head 37b8ecfd

  • node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack re-derived 89 commands from the real diff, identical to the PM's list, at both commits. --ran reconciliation at 37b8ecfd: 89 derived, 89 run, 0 NOT-MEASURED, 0 UNRUN, all exit 0.
  • Three gates first answered PREREQUISITE NOT MET (exit 3) and were converted by building what they read. None of them was read as a pass before that:
    • check:skill-examples: built @objectstack/client-react and its closure, then 259 examples type-checked.
    • check:dual-build-cjs-loads: built the 4 packages still missing dist/, then 104 entry points across 67 packages loaded.
    • check:type-check-debt: --re-measure of 4 ledger entries in 103.8 s, 53 raw errors, none above its recorded number. Independently, tsc --noEmit -p packages/cloud-connection/tsconfig.json gives 13 errors, equal to its DEBT entry. --listFiles shows both changed .ts files in the program, with 0 errors in them.
  • ⚠️ One tree-state repair: a first check:type-check-debt run was cut at a 400 s per-gate budget while it was building the closure. That left plugin-auth and plugin-approvals with JS but no .d.ts in this worktree only (check:dts-closure named the second one). Both were rebuilt, and check:dts-closure then read 153/153 declaration files across 64 packages. Nothing was committed from it.
  • Roster gates whose roster sits under a changed directory were run by hand at e5786a58, all exit 0: check-changeset-fixed, check:authz-resolver, check:error-code-casing, check:filter-alias-parity, check:error-status-conformance, check:route-ledger-census, check:tenant-chokepoint. Also exit 0: check:adr-anchors and check:durability-log-level.
  • pnpm lint (the full union, eslint . --no-inline-config): exit 0, no output, 108 s, at 37b8ecfd.
  • @objectstack/cloud-connection tests: 30 files / 396 tests pass at 37b8ecfd.
  • The Check Changeset level axis was not run locally, because it needs this PR's event payload. With the bare no line it stands down, and minor is admissible under either spelling.

Acceptance notes (observations, not filed)

  • Studio import pre-check mirrors the retired rule. objectui packages/app-shell/src/views/metadata-admin/PackagesPage.tsx:850 (at pin 62597c58) pre-checks !manifest.id && !manifest.name, and its i18n string reads missing "id" or "name". After this change, a name-only file passes that client check and gets the server's 400 carrying the declaration's remedy, which the page shows through its envelope reader (apiJson then readEnvelopeFailureText, PackagesPage.tsx:123). The refusal is loud, not silent, so no card was filed. The pre-check is simply looser than the server now. Carrier: whoever next edits that objectui page (承接者:无).
  • manifestIdOf (:133) still reads manifest.name as a last resort. It classifies packages already in the engine registry for findConflict, not install input, and was left alone.

Generated by Claude Code

…nifestSchema.shape.id

POST /api/v1/marketplace/install-local derived the id as
`manifest.id ?? manifest.name` and parsed nothing, so an id the
declaration refuses installed and became the ledger key. The door now
parses the raw `manifest.id` through the declaration, by reference, at
the point where the inline and cloud branches converge, and refuses with
the declaration's own sentence (PLUGIN_MANIFEST_INVALID, 400 inline /
502 snapshot) before the collision check, the hot-register or any write.
Rehydrate and the :manifestId routes stay ungated so an entry installed
before this still boots and can still be removed.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TnPAC1UsTGfHPXVUCL6iLn
… written

Each refusal row now checks, through one helper, that no manifest was
registered past boot, syncSchemas never ran for the request, and the
ledger directory is untouched; the re-install row checks the legacy
entry is the only file and keeps its old version.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TnPAC1UsTGfHPXVUCL6iLn
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Sep 24, 2026
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/cloud-connection, touching 4 documentable anchor(s).

13 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/declarative-endpoints.mdx (via manifest.id (literal, a string literal in handleInstall))
  • content/docs/api/environment-routing.mdx (via /api/v1/packages (route, a path literal in a comment in handleInstall))
  • content/docs/deployment/cli.mdx (via manifest.id (literal, a string literal in handleInstall))
  • content/docs/deployment/publish-and-preview.mdx (via PLUGIN_MANIFEST_INVALID (literal, a string literal in handleInstall), manifest.id (literal, a string literal in handleInstall))
  • content/docs/getting-started/examples.mdx (via /api/v1/packages (route, a path literal in a comment in handleInstall))
  • content/docs/getting-started/quick-reference.mdx (via manifest.id (literal, a string literal in handleInstall))
  • content/docs/kernel/contracts/metadata-service.mdx (via /api/v1/packages (route, a path literal in a comment in handleInstall))
  • content/docs/kernel/services-checklist.mdx (via /api/v1/packages (route, a path literal in a comment in handleInstall))
  • content/docs/permissions/permission-sets.mdx (via /api/v1/packages (route, a path literal in a comment in handleInstall))
  • content/docs/plugins/packages.mdx (via manifest.id (literal, a string literal in handleInstall))
  • content/docs/protocol/kernel/error-handling.mdx (via /api/v1/packages (route, a path literal in a comment in handleInstall))
  • content/docs/protocol/kernel/http-protocol.mdx (via manifest.id (literal, a string literal in handleInstall), /api/v1/packages (route, a path literal in a comment in handleInstall))
  • content/docs/ui/apps.mdx (via manifest.id (literal, a string literal in handleInstall), /api/v1/packages (route, a path literal in a comment in handleInstall))

⛔ 2 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-0.mdx (via /api/v1/packages (route, a path literal in a comment in handleInstall))
  • content/docs/releases/v17/17-4.mdx (via /api/v1/packages (route, a path literal in a comment in handleInstall))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • the SDK route bridge reached 60 of 215 client-bound route-ledger rows — the other 155 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 155: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 100 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 3 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 44639665eea4adc6de1eaa963ccd0e5a3e875f98 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 8a2e46c637a23d27769c87d50472637e806e12a2 — the merge of head ca79edd22437c0b94df24274be25f90cbfb1e498 into base 44639665eea4adc6de1eaa963ccd0e5a3e875f98, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 8a2e46c637a23d27769c87d50472637e806e12a2 && git checkout 8a2e46c637a23d27769c87d50472637e806e12a2
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 44639665eea4adc6de1eaa963ccd0e5a3e875f98 ca79edd22437c0b94df24274be25f90cbfb1e498 && git checkout -B drift-repro 44639665eea4adc6de1eaa963ccd0e5a3e875f98 && git merge --no-ff ca79edd22437c0b94df24274be25f90cbfb1e498

node scripts/docs-audit/affected-docs.mjs --json 44639665eea4adc6de1eaa963ccd0e5a3e875f98

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 44639665eea4adc6de1eaa963ccd0e5a3e875f98 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

The changeset carries the amended claim's declaration line,
`Clause-②: no (narrowing)`, matching the PR body.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TnPAC1UsTGfHPXVUCL6iLn
@os-steve
os-steve marked this pull request as ready for review September 24, 2026 23:15
@os-steve
os-steve enabled auto-merge September 24, 2026 23:15
@os-steve
os-steve added this pull request to the merge queue Sep 24, 2026
Merged via the queue into main with commit d58b8b6 Sep 24, 2026
37 checks passed
@os-steve
os-steve deleted the claude/issue-19576-install-local-id-gate branch September 24, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants