Package Supersession

Maintainer requirement: "module uninstall must be doable in migration (e.g. when renaming package)".

Why

A package that is renamed, or merged into another, leaves its old self behind on every instance that had it: the old partition with its Store/Plugin root, its NodeTypes (shown twice in the data model explorer next to the new package's), sometimes its install record, sometimes not. Measured on partnerre-test (2026-11-30): the packages EslOfficeSync and EslUnderwriting were consolidated into Esl; their partitions and types stayed, with NO Plugins/EslOfficeSync install record, so uninstall_package refused them ("not an installed package here"). The governed package.remove then failed on the recursive delete: a node of a leftover type whose module can no longer compile has a hub that never answers the delete's ValidateDeleteRequest.

The declaration

The package that replaces others names them in its root's content:

"content": {
  "$type": "PluginContent",
  "supersedes": ["EslOfficeSync", "EslUnderwriting"],
  …
}

It is read into PackageManifest.Supersedes (NodeRepoPackageSource.Peek; a package.json source carries it with the whole manifest) and kept on the install record. It is the package's OWN declaration, shipped by pull request and released with it: a governed instruction, not a person's standing right. There is no verb that lets a caller name arbitrary packages to drop. Policy declared-not-derived: a package merely absent from a listing, or a partition that merely looks like a leftover, is never retired here.

What the instance does

PackageSupersession runs after every install through the funnel (PackageInstaller.Install, InstallNodeRepoDelta: an update is an install) and in the boot default install, after the registry retirements (over every install record, so an already up-to-date Esl still acts). For each declared id (PackageSupersession.Decide, pure):

The request carries PackageUninstallRequest.SupersededBy. The ONE executor (PackageUninstallExecutor, see Package Uninstall) runs it with three differences from a person's uninstall:

a person's uninstall a superseded package
no install record refused retired as an orphan when the partition root is a Store/Plugin (refused for any other root type); no module is named, so none is retired
user-data census runs, refuses runs, refuses by name, nothing touched
another installed package requires it not checked refused by name, nothing touched
phase 2 after the requester types the partition name at once: the released declaration IS the confirmation

Phase 2 is the platform's whole-partition teardown (PartitionTeardown.TearDownPartition, as System): one store drop per provider, no per-node ValidateDeleteRequest fan-out, so a node of a type that can never compile does not block it. The request ends Done, and the package then counts as uninstalled here (PackageUninstallExecutor.UninstalledHere): no unattended pass installs it again; a person can.

A request a supersession wrote never enters AwaitingConfirmation, and nothing lets a caller set SupersededBy: uninstall_package and the package page file person requests, and the executor acts only on a request written by System.

Renaming or merging a package (for authors)

  1. Move the content into the new package (or rename its folder), and add "supersedes": ["OldId"] to the NEW package root's content, in the same pull request. Keep the entry for as long as any instance may still hold the old package.
  2. Remove the old package's folder. Do NOT also list it in retired-packages.json: that convergence keeps the partition (see Retired Package Convergence); the supersession drops it.
  3. Anything a person created in the old partition refuses the retirement — move it first (the request names the first five nodes and who created them), then release a new version of the new package, which tries once more.

Verifying on an instance

Tests

PackageSupersessionDecisionTest and APackageSupersedesWhatItReplacesTest (MeshWeaver.Hosting.Test): a rename A→B retires A's record and partition (a node of an uncompilable leftover type included) and a re-run writes nothing; the orphan with no install record is retired; user data refuses it by name; a package another installed package requires is refused; without the declaration nothing happens.

What is NOT established

Related: Package Uninstall, Retired Package Convergence.