Repository navigation
fix(cloud-connection): POST /api/v1/marketplace/install-local parses the package id through its declaration - #20022
Conversation
…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
📓 Docs Drift CheckThis PR changes 1 package(s): 13 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 3 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # 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
|
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
Fixes #19576
Clause-②: no (narrowing)
POST /api/v1/marketplace/install-localnow parses the package id it installs through its declaration,ManifestSchema.shape.id(by reference, never a copy of the grammar). An idMANIFEST_ID_PATTERNrefuses is answeredPLUGIN_MANIFEST_INVALIDwith the declaration's own sentence (manifestIdRefusal, surfaced, not reworded). The status is400for an inline manifest and502for a cloud snapshot. Nothing is registered or written.Diff measured between
b81da66df773(merge base,origin/mainat dispatch) and37b8ecfd027c(head). 4 files, +477 / -6.The change
packages/cloud-connection/src/marketplace-install-local-plugin.ts,handleInstall:const manifestId = String(manifest?.id ?? manifest?.name ?? ''). Nothing parsed it.late-app,com.example.my_erp, the number123, or a manifest carrying only anameinstalled with200, and the value became the ledger file's key and the:manifestIdroute key.normalizeBundlehas flattened a compiled bundle) and the cloud-fetched snapshot. The parse sits ahead of the409 MANIFEST_CONFLICTcollision check, the ADR-0120 D5e posture gate, the hot-register and the ledger write. Validity is answered before collision.manifest.nameis no longer read as an id.ManifestSchemadeclaresid, andnameis an unpatterned display label. The inline branch's early refusalInline manifest must have an "id" or "name".was deleted with the fallback it described. The inlinepackageIdis now assigned from the parsed id, so no second, looser derivation remains.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 callsmanifestIdRefusal('manifest.id', raw)directly. Every refusal therefore namesmanifest.idand states the rule.PLUGIN_MANIFEST_INVALIDis reused, with the sameinlineManifest ? 400 : 502split this door already uses for an invalid manifest. No new error code was added, andpackages/specis untouched.Doors that are deliberately NOT gated: what an already-installed non-conforming entry does
Rehydrate at
kernel:readyand the three:manifestIdroutes (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 filelate-app.json) behaves as follows:manifest.registerreceives it and no error is logged;DELETE /api/v1/marketplace/install-local/late-app: pinned, answers200, and the ledger no longer has it;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/objectstackate5786a58(the gate commit; the only later commit tightens the new test file's assertions) unless stated otherwise.@objectstack/cloud-connectionsuite (a setup-file spy onManifestSchema.shape.id.safeParse, recording file, test and value)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.cleanandcom.acme.tenancy. All of them conform.late-app. Its only hit ispackages/objectql/src/plugin.integration.test.ts:237, which callsmanifest.registerdirectly and never reaches this doorMarketplaceInstallLocalPlugin(serve-marketplace-*.test.ts×3,serve-capability-identity.test.ts) mount or plan it, and a grep of them forPOST,fetch(and.post(answers 0 linesgit grep MarketplaceInstallLocalPluginoutsidepackages/cloud-connection/srclists those 4 test files plusinstall.ts,serve.ts,examples/app-showcaseand docs, all openedos package install(packages/cli/src/commands/package/install.ts:130)id: artifact.manifest.id ?? artifact.id. That id comes from a built artifact, anddefineStackrefuses bothlate-appand a manifest withoutid(probed:manifest.id: Required property 'id' is missing). The catalog path sendspackageIdonly, and the parse reads the snapshot'smanifest.iddefineStackmanifest is accepted by the same probeexamples/*buildscom.example.crm,.showcase,.todo,com.example.multi.core,com.example.multi.orders: all conformplatform-core.marketplace-install-local-lifecycleinstallsexamples/app-crmthrough this door, and that id conforms.objectui-sha62597c58, same code on maina3380379)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, i18nmissing "id" or "name"). See Acceptance notesmarketplaceApi.ts:675) sendspackageIdonlyobjectstack-ai/cloud, which this session cannot read (an attach request was denied). The in-repo contract side isPackageSchema.manifestId(packages/spec/src/marketplace/package.zod.ts:172), which carries the sameMANIFEST_ID_PATTERNon the publish faceThe 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
:763: confirmed. The gate went there. The card's probe was reproduced first as a failing test:late-appinline answered200(expected 200 to be 400).PLUGIN_MANIFEST_INVALID: confirmed. No new code was needed, so the claim'sClause-②: nobasis holds on that axis.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,envelopeViolationsempty,ApiErrorSchema),codeandstatus, a message identical tomanifestIdRefusal('manifest.id', value), and that nothing was written: nomanifest.registerafter boot, nosyncSchemasafter boot, and an unchanged ledger directory. The repair-arm row asserts the message only, because the message is its subject.late-app,com.example.my_erp,com.1acme.crm,Com.Acme.Crm, a whitespace-paddedcom.acme.crm(the raw value is parsed),'', a name-only manifest, a manifest with neither key, andid: 123.manifest.idoflate-appis refused afternormalizeBundle.late-app, and a name-only snapshot.fetchwas called exactly once, so the refusal came from the snapshot.400, not409.com.example.my_erpstill carries'com.example.my-erp'.com.example.crm,com.example.my-erpandorg.apache.supersetinline, plus a conforming compiled bundle and a conforming snapshot. Each installs with200, is registered once with the id intact, and gets a ledger file named for the id.DELETEremoves it, and re-install is refused (see above).Reverse verification: direction predicted BEFORE running, restore proven
b81da66dplus the test file only, before commit)late-appinline answered20037b8ecfd, the committed gate block replaced by the oldString(manifest?.id ?? manifest?.name ?? '')derivation, throughscripts/ablation-replace.mjs(anchor hit x1 to x0, blobce38ed611189to7560ea96170f)ce38ed611189equal to HEAD,git diff HEADempty, andgit status --porcelainempty. The same leg ate5786a58read the same 15 / 7The subject resolves from
src/(the suite imports./marketplace-install-local-plugin.jsinside its own package), sodist/is not on the resolution path of this ablation.Docs
content/docs/deployment/publish-and-preview.mdx: the page taught409 MANIFEST_CONFLICTas the install refusal. A bullet beside it now states that the collision check is the second refusal, not the first:400 PLUGIN_MANIFEST_INVALIDwith the declaration's remedy (502from a catalog snapshot), nothing written, and anameis not an id. A search ofcontent/docs/**(outsidereferences/andreleases/) forinstall-local,package install,MANIFEST_CONFLICT,PLUGIN_MANIFEST_INVALIDandid or namefound no other statement this change makes false.cli.mdxlists401, the D5e stop and404foros package installwithout claiming completeness. The CLI prints the new refusal asInstall 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-connectionminor, a**BREAKING for callers of the install-local door**banner, and an ADR-0087not-required (no-migration-prescription)disposition. It carries the PR'sClause-②: noline verbatim.patch, on purpose, and the reason is stated here. The two landed sibling gates for this same class,f9977c11(HTTP door) and2306a75e(protocol primitive), each declaredClause-②: no (narrowing), shippedminor, and carried the BREAKING banner plus the same ADR-0087 disposition. Per AGENTS.md, a(narrowing)is BREAKING, and a breaking change shipsminorduring the launch window. This door's accept set narrows the same way theirs did. The claim's line is bareClause-②: 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 toClause-②: no (narrowing). Theminorlevel already satisfies the level axis under either spelling. The dev did not choose between the two silently.Gates, at head
37b8ecfdnode scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackre-derived 89 commands from the real diff, identical to the PM's list, at both commits.--ranreconciliation at37b8ecfd: 89 derived, 89 run, 0 NOT-MEASURED, 0 UNRUN, all exit 0.check:skill-examples: built@objectstack/client-reactand its closure, then 259 examples type-checked.check:dual-build-cjs-loads: built the 4 packages still missingdist/, then 104 entry points across 67 packages loaded.check:type-check-debt:--re-measureof 4 ledger entries in 103.8 s, 53 raw errors, none above its recorded number. Independently,tsc --noEmit -p packages/cloud-connection/tsconfig.jsongives 13 errors, equal to its DEBT entry.--listFilesshows both changed.tsfiles in the program, with 0 errors in them.check:type-check-debtrun was cut at a 400 s per-gate budget while it was building the closure. That leftplugin-authandplugin-approvalswith JS but no.d.tsin this worktree only (check:dts-closurenamed the second one). Both were rebuilt, andcheck:dts-closurethen read 153/153 declaration files across 64 packages. Nothing was committed from it.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-anchorsandcheck:durability-log-level.pnpm lint(the full union,eslint . --no-inline-config): exit 0, no output, 108 s, at37b8ecfd.@objectstack/cloud-connectiontests: 30 files / 396 tests pass at37b8ecfd.Check Changesetlevel axis was not run locally, because it needs this PR's event payload. With the barenoline it stands down, andminoris admissible under either spelling.Acceptance notes (observations, not filed)
packages/app-shell/src/views/metadata-admin/PackagesPage.tsx:850(at pin62597c58) pre-checks!manifest.id && !manifest.name, and its i18n string readsmissing "id" or "name". After this change, a name-only file passes that client check and gets the server's400carrying the declaration's remedy, which the page shows through its envelope reader (apiJsonthenreadEnvelopeFailureText,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 readsmanifest.nameas a last resort. It classifies packages already in the engine registry forfindConflict, not install input, and was left alone.Generated by Claude Code