Skip to content

fix(cloud-connection): uninstalling a composed app through install-local uninstalls every package body it installed - #34418

Merged
objectstack-fleet[bot] merged 20 commits into
mainfrom
claude/issue-34396-composed-uninstall
Nov 16, 2026
Merged

objectstack-fleet[bot] merged 20 commits into
mainfrom
claude/issue-34396-composed-uninstall

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #34396

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:install-local 卸载一个组合包(一个 type: app 包加若干 type: module 包,ADR-0130 D4)时,按"安装时的同一个单元"卸载:安装登记的每个子包都会被撤下,扩展了其他子包对象的模块先撤,被扩展的应用后撤。
  • 为什么改:某个模块用 objectExtensions 扩展了应用自己的对象时,卸载应用返回 409 要求"先卸载模块",但模块没有自己的安装记录(404),包接口又把它当只读(422),结果什么都删不掉,只能去主机上删缓存文件再重启。
  • 风险与回滚:低。单包安装的卸载路径不变(原有 withdrawal 测试与新增对照测试钉住);来自另一次安装的扩展依旧被 409 拒绝且不动任何东西。回滚即 revert 本 PR。
  • 先看:packages/cloud-connection/src/marketplace-install-local-plugin.ts 的 planUnitWithdrawal 与 handleUninstall 中逐成员撤下的那段;marketplace-install-local-composed-uninstall.test.ts。
  • 两分钟验证:pnpm --filter @objectstack/cloud-connection exec vitest run src/marketplace-install-local-composed-uninstall.test.ts,预期 8 条全过;把插件文件换回 main 版本再跑,预期 4 条以 409 RESOURCE_CONFLICT 失败。
  • 需要你做的:无,席位落地。

What changes

DELETE /api/v1/marketplace/install-local/:manifestId now uninstalls the unit the install entry installed.

  • The unit. The ledger entry's stored body is read the way the rehydrate reads it. A packages[] artifact yields every member id, in the reverse of the install's dependency order (orderHydrationBatch). A single-package entry yields its own id alone, so that path is unchanged.
  • The decision, before anything moves. The registry's one predicate, assertPackageUninstallable, is asked of every member while the whole unit is still registered. A new pure helper, planUnitWithdrawal, reads each refusal's extenders and customizationPackageId:
    • If every cause is another member of the same unit, the refusal sets the order instead of refusing: those members are withdrawn first, so extending modules go before the package they extend.
    • A cause outside the unit refuses the whole uninstall with the registry's own 409 RESOURCE_CONFLICT sentence, as before. That includes a package of a different install and a pair this install did not deliver. So does a refusal that carries no readable causes, and a cycle of members that extend each other.
  • The withdrawal. For each member, in the planned order, the door captures the declared permission names and then withdraws the member, all synchronously with no await after the ledger removal. Then it withdraws each withdrawn member's object copies, restores the copies its extensions rewrote, and runs each member's uninstall cleanups under its own package id. Artifact handlers are unbound once, under the entry's id, which is where the install bound them. The metadata:reloaded re-sync is announced once, and only when at least one member was withdrawn. The package_uninstall ledger row is written once for the entry.
  • The uninstall guards (runUninstallGuards) are asked of every member, not only the entry's id.
  • The response shape is unchanged. cleanups holds the outcomes of every member, in order.

No packages/objectql file changed: the registry's predicate and its refusal fields are read as they are. The claim's file surface allowed the split registry modules, and none needed an edit.

Tests

New packages/cloud-connection/src/marketplace-install-local-composed-uninstall.test.ts runs on a real ObjectKernel with ObjectQLPlugin. It installs through the door, then uninstalls.

  • Reporter's doors: the module's own DELETE answers 404 RESOURCE_NOT_FOUND, and isWritablePackage answers false for it. That predicate is the one behind the package door's 422 WRITABLE_PACKAGE_REQUIRED. Both stay true after the fix, by design.
  • The composed uninstall answers 200, withdraws all three members with the module before the app, and leaves no contributor on the app's object.
  • The module goes first even when the artifact lists it ahead of the app. Here the base order puts the app first, so this case exercises the planner.
  • A reinstall after the uninstall registers the unit again.
  • An extension from a different install: the uninstall answers 409 RESOURCE_CONFLICT naming that package, and nothing of the unit moves. The control: after that install is uninstalled, the unit's uninstall answers 200.
  • A single-package install withdraws only itself. A single package extended by another install still gets the registry's 409.
Red leg (plugin at the merged main parent cfcba53) and green leg, HEAD c965590
  • Red: Tests 4 failed | 4 passed (8). Each failure is the reporter's refusal: {"code":"RESOURCE_CONFLICT","message":"Uninstall the package that extends an object of \"com.probe.suite\" first (com.probe.suite.carbon), then uninstall \"com.probe.suite\" again: ... (objectExtensions, ADR-0029). ..."}: expected 409 to be 200.
  • The mutation was proven on disk: the file hash equalled cfcba53920: + path, and planUnitWithdrawal occurred 0 times. The restore went through git checkout HEAD --, was proven by an empty git diff HEAD, and the hash matched the HEAD blob.
  • Green: Test Files 1 passed (1) · Tests 8 passed (8).
  • Whole package, pnpm --filter @objectstack/cloud-connection test: Test Files 84 passed (84) · Tests 1235 passed (1235). This includes the existing marketplace-install-local-uninstall-withdrawal.test.ts pins of the single-package order and the 409.
  • pnpm --filter @objectstack/cloud-connection typecheck: exit 0. tsconfig.test.json lists the new test file.

Acceptance notes

  • Mixed refusal text. If a member is extended both by another member and by a foreign package, the 409 is the registry's sentence for that member, so it also names the same-unit module among the packages to uninstall first. The decision is right (refused), but that part of the prescription has no door of its own. The sentence is the registry's, and this PR leaves it untouched.
  • Same-unit dependent rules. The uninstall guards are asked per member and cannot tell a same-unit dependent from a foreign one. Suppose a member's field, added through objectExtensions, is read by an active validation rule of another member of the same artifact. The runtime's dependent-rule guard would then refuse that member's uninstall. Not measured on a real artifact. The reporter's shape (a module adding fields to the app's objects) does not hit it.
  • Partial withdrawal note. The pre-check refuses everything the registry would refuse. A withdrawal that still throws for some other cause leaves that member registered, and the response note speaks of "the package". The operator log names the members that were withdrawn.
  • Overlaps. Before the PR, git merge-tree ran against the open PRs that touch marketplace-install-local-plugin.ts: fix(cloud-connection): install-local seeds a composed bundle's package datasets on install, reseed, upgrade and restart #34403 (claude/issue-34336-composed-bundle-seeds) and fix(cloud-connection)!: install-local parses manifest.namespace through its declaration #34316 (claude/area-A5-33922). Both merged with no conflict.

Verification

Local subset, at HEAD c965590. The CI-owned farm is read from this PR's check-runs.

  • pnpm --filter '@objectstack/cloud-connection^...' build (the dependency closure) ran under os-verify-lock.sh and ended with VERDICT command-exit 0.
  • The gate families dispatch-gates.mjs --commands derived for this diff: 71 derived, 70 run at exit 0, and --ran reconciles 71 derived, 70 run, 0 NOT-MEASURED, 1 UNRUN.
  • The unrun family is pnpm check:dual-build-cjs-loads, NOT MEASURED locally: PREREQUISITE NOT MET — this gate reads built output, and some package has no dist/ (39 packages unbuilt in this worktree). CI's Lint & Repo Gates runs it.
  • No exported symbol was renamed or deleted, so check-platform-checklist --changed-from is not owed.
  • No full dogfood run is owed: the title has no ! and no (narrowing) arm.

Generated by Claude Code

…runnable command

The first pass of codemod-split-engine.mjs, copied with its host
parameterised (registry.ts, SchemaRegistry, registry-*, #33949) and
an exports-equality proof added beside its byte-identity proof.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
… (move-only)

Generated by node scripts/codemod-split-registry.mjs --write on a
branch cut from origin/main; never hand-edited.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
…plit moved

Six READERS rows named registry.ts sites that the split moved, unedited,
into registry-top-level.ts and registry-platform-global.ts.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
…y split's changeset

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
…ons in registry.ts

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
node scripts/codemod-split-registry.mjs --write on registry.ts at
86350e1, after the open PR that touched it merged.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
…its two path readers look, and regenerates

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
…e the split now keeps it

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
… split on it

registry.ts took a 73-line change on main; the split is regenerated from
main's registry.ts with node scripts/codemod-split-registry.mjs --write.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
… split on it

registry.ts changed on main; the split is regenerated from main's
registry.ts with node scripts/codemod-split-registry.mjs --write.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
…ed at the regeneration commit plus the margin

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
…script lives in branch history only

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
… reasons cite the split's PR instead of a script path

Comments and text only; no code moves.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ
…fact withdraws every package body it installed, extending modules first

Claude-Session: https://claude.ai/code/session_01FEkQ5pHNFS9mn8hS13iGyL
Co-Authored-By: Claude <noreply@anthropic.com>
…nstall's own warnings

Claude-Session: https://claude.ai/code/session_01FEkQ5pHNFS9mn8hS13iGyL
Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l 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 Nov 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

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

16 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json fa9d695522925152815106605e5a612e331d2773.

⛔ 7 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 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 — 7 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 fa9d695522925152815106605e5a612e331d2773 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 0c83f8f17a96656ce55ef1e605d51b2a20fe6c8b — the merge of head c965590cfc76df116ed986cb4401a52668d88125 into base fa9d695522925152815106605e5a612e331d2773, 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 0c83f8f17a96656ce55ef1e605d51b2a20fe6c8b && git checkout 0c83f8f17a96656ce55ef1e605d51b2a20fe6c8b
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin fa9d695522925152815106605e5a612e331d2773 c965590cfc76df116ed986cb4401a52668d88125 && git checkout -B drift-repro fa9d695522925152815106605e5a612e331d2773 && git merge --no-ff c965590cfc76df116ed986cb4401a52668d88125

node scripts/docs-audit/affected-docs.mjs --json fa9d695522925152815106605e5a612e331d2773

⚠️ 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 fa9d695522925152815106605e5a612e331d2773 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-project-manager · session_01FEkQ5pHNFS9mn8hS13iGyL

Request: review · PR #34418 · area o1-B · Fixes #34396 · head c965590cfc76df116ed986cb4401a52668d88125 (declared final, green) · 2026-11-16T16:06Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-project-manager · session_01FEkQ5kcNtBBExhz4DZqYbi

席位核对 · ACCEPT (L1, first read) · Head-sha: c965590 · 2026-11-16T16:08Z

L1 thread L1-a for area o1-B, reading the final head declared in 6921783819. I read card #34396, dev report 6921083519, the PR body with its Acceptance notes, and the PR's own diff against the main it merged (cfcba539): 3 files, +475/−29. No L2 is owed: Clause-②: no, Metadata-protocol: none, and no file under packages/objectql changes.

  • Card relation. Fixes #34396. The card's "expected" is that uninstalling a composed artifact's entry uninstalls every package body the install registered, with extending modules before the package they extend. That is what the PR builds, and it is the first of the card's two equivalent readings.

  • The unit. installedUnitPackageIds reads the entry's stored body (flattenPackageBody). For a body with packages[], it takes each member's id in the reverse of the rehydrate's own order (orderHydrationBatch, dependents first), deduplicated, and appends the entry's own id if no member carries it. A body without packages is the entry's id alone, so a single-package entry asks and withdraws exactly what it did before.

  • Refusal versus order. planUnitWithdrawal asks the registry's one predicate (assertPackageUninstallable) of every member while the whole unit is still registered.

    • A PackageUninstallExtendedError whose causes (extenders, which the class always sets as an array, plus customizationPackageId) all lie inside the unit becomes an ordering constraint.
    • A cause outside the unit refuses the whole uninstall with the registry's own 409 sentence, before anything moves. So does a cycle of members that extend each other.
    • A throw that is not the coded 409 is left to the withdrawal, as before.
    • The pure planner places a member only after everything it waits on.
  • Withdrawal. Each member's names are captured, then each is withdrawn, all synchronously (no await between the ledger removal and the last withdrawal). Object copies and extended-copy restores run per withdrawn member, and so do the uninstall cleanups, so a module's permission sets go with it. Handler unbind, metadata:reloaded and the package_uninstall row run once per entry, matching the one entry the install wrote.

  • Pins. The new file marketplace-install-local-composed-uninstall.test.ts (8 tests) covers:

    • the reporter's 404 and read-only predicate on the module, with nothing moved;
    • the entry's DELETE answering 200 and withdrawing every member, module before app;
    • the module going first even when the artifact lists it ahead of the app;
    • a reinstall after uninstall, which is the recovery the card asked for;
    • an extension from a different install still answering 409 naming that package, with nothing moved, plus its CONTROL once that install is gone;
    • single-package withdrawal and its 409, as before.

    Per 6921083519 the file was red on cfcba539 (4 failed, each the reporter's 409) and is 8/8 at head.

  • Changeset. patch on @objectstack/cloud-connection. The three "what does not change" bullets match the code: a foreign extension or pair still gets 409, a single package is withdrawn alone, and a module still has no entry of its own.

  • Checks on this head (check-runs): 51 names, 35 success, 16 skipped, 0 failed, 0 pending.

  • Base. PRBASE is fa9d6955 (Test Core plan), so K = 1. Since then main gained fix(cloud-connection): install-local seeds a composed bundle's package datasets on install, reseed, upgrade and restart #34403, which touches marketplace-install-local-plugin.ts too. git merge-tree --write-tree origin/main <head> is clean, and the two changes sit in different methods (the seed readers versus handleUninstall).

Notes (not blocking)

  • Partial withdrawal. If one member's withdrawal is refused after others have been withdrawn, the handlers bound for the whole install stay bound (unbindArtifactHandlers runs only when none was refused), and the withdrawn members' handlers stay with them until restart. The refused member is reported on cleanups, and the log names the members that were withdrawn. This is acceptable as reported. A sentence in Acceptance notes would make it visible.
  • Already recorded in Acceptance notes and not built: a member extended by both a same-unit module and a foreign package gets a sentence that also names the same-unit module; and per-member uninstall guards. Both are accepted as recorded.

Landing: not Tier H. Area o1-B lands it. If #34403 lands first, re-check that the merge is still clean on the landing head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-project-manager · session_01FEkQ5pHNFS9mn8hS13iGyL

Verdict: ACCEPT at 2026-11-16T16:09Z, and the landing rides this stroke. ACCEPT → PR #34418 comment 6921833020.

Reading Head c965590cfc76df116ed986cb4401a52668d88125
L1 (L1-a) ACCEPT 6921833020
Contract review not owed (Clause-②: no, Metadata-protocol: none)
check-governed-merges --pr 34418 NOT governed, 504 changed lines, under 3,000
Dogfood battery n/a, no ! title
K (head → origin/main) 9, below 15; git merge-tree against main (with #34403, same file) clean
Check-runs 35 success, 16 skipped, 0 failure

State: ready plus auto-merge through the merge queue. On MERGED, Fixes #34396 closes the card. L1's non-blocking notes (partial withdrawal leaves handlers bound until restart; mixed-cause 409 text; same-unit dependent rule guard) stay in the PR's Acceptance notes.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 16, 2026 16:09
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 16, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-project-manager · session_01FEkQ5pHNFS9mn8hS13iGyL

Re-queue · 2026-11-16T16:46Z: PR #34418 left the merge queue on CI_FAILURE. The only red is the Lint & Repo Gates aggregator, because lane Lint · scoped · query-options erasure was cancelled at its step timeout in merge-group run 43904368128: the step Engine query-options erasure ratchet ran 16:21:12Z to 16:44:52Z with no finding before the cancel. The same lane passed on this head in the PR run in 5 minutes (15:43:10Z to 15:48:24Z), and this PR touches only packages/cloud-connection, outside the engine files that ratchet reads. Head unchanged at c965590cfc76df116ed986cb4401a52668d88125; L1 ACCEPT 6921833020 stands. Re-queued once in this stroke; a second cancel of the same lane goes to the seat, not to another re-queue.

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/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

1 participant