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):
- skipped and named: a malformed id, the package itself, or an id installed from another source (a package supersedes only its own source's packages);
- nothing written: neither an install record nor a partition root of that id is here (idempotent: a second run, or an instance that never had it);
- otherwise ONE request, as System, at
Admin/_PackageUninstall/supersede-{old}-by-{new}-{hash}— the hash over old id, new id and the new package's version, so every replica collides on one node, a re-run of the same version writes nothing, and a new version tries once more (after a refusal was resolved).
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)
- Move the content into the new package (or rename its folder), and add
"supersedes": ["OldId"]to the NEW package root'scontent, in the same pull request. Keep the entry for as long as any instance may still hold the old package. - 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. - 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
Admin/_PackageUninstall/supersede-{old}-by-{new}-…exists,status: Done, itslogends with the partition's teardown sentence; orFailedwith the refusal by name.- The old partition's root and types are gone;
Plugins/{old}is gone. - Loki:
[Supersede] {old} (superseded by {new}): Requested …once per version.
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
- Moving content first. The declaration has no old-path → new-path mapping; content to keep is moved by its owner before the release. The engine refuses rather than drops.
- An orphan's source. With no install record the "own source only" rule cannot be checked for an orphan: its
guards are the
Store/Pluginroot, the census (every node created by the installer's System identity) and the dependents check — so the most a wrong declaration can drop is an un-recorded, installer-seeded package partition. - A module of an orphan. With no install record nothing names the old module, so a landed generation of it (if one exists) is not disabled by this path; it is left for the module GC.
- A Postgres run. The tests run on the monolith's in-memory store (the teardown's row sweep); the Postgres
DROP SCHEMApath is the platform's existing one. - Other replicas' hubs are closed by the store drop's write refusal and their next activation, as for a person's phase 2.
Related: Package Uninstall, Retired Package Convergence.