Files
launcher-next/docs/architecture/package-activation.md
T

43 lines
2.7 KiB
Markdown

# Package activation
Before changing package pointers, Launcher Next writes an activation snapshot containing exact previous `current.json` and `previous.json` contents and their SHA-256 values. Files are copied to a unique staging directory and rehashed. Only then is staging moved to `packages/<package>/versions/<version>` and the package-local pointer updated atomically.
Rollback restores the exact pointers, deletes the pilot version and startup script, and removes incomplete staging. Autodesk assemblies, PDBs, executables, test assemblies and legacy files are rejected from the pilot package.
## Last-known-good resolution
Each activated version retains its validated package manifest alongside its payload.
`PackageResolutionUseCase` receives an explicit roster requirement: package ID,
product/year/architecture, channel, exact version, roster identity and offline
policy. On an online acquisition it stages locally, binds that requirement to the
activated version, then revalidates through `LocalPackageStore.ResolveAsync`.
The resolver checks manifest, binding, identity/product compatibility, entry and
all payload lengths/SHA-256 before returning a local version. It returns current
first. Only when current is invalid and the requirement explicitly permits offline
fallback can it return previous. A cache entry with another roster, channel or
version is rejected. It never reads or executes a package from DFS, and a failed
or corrupted update never becomes last-known-good.
Resolution emits stable evidence codes: `ONLINE_PACKAGE_SELECTED`,
`VALID_CURRENT_CACHE_SELECTED`, `PREVIOUS_LKG_SELECTED`,
`OFFLINE_FALLBACK_DISABLED`, and `NO_SAFE_PACKAGE_AVAILABLE`.
## Roster-to-package plan
`RosterAdapter` keeps source formats outside the package domain. It selects,
in order, a project `roster.json`, a legacy `download_list.xml`, then an
explicit central default; malformed project JSON is a block, not an implicit
fallback. JSON roster version 1 requires a stable roster ID, product, year,
architecture, explicit offline policy and unique package IDs. Legacy XML disables
DTD/external entities and accepts only proven `Plugin` fields
(`id`, `version`, optional `channel` and `install`).
`RosterPackagePlanUseCase` converts enabled records into deterministic,
load-order-sorted requirements and resolves every one before launch preparation.
It emits roster/source, requirement and plan-completed/blocked evidence. The
filesystem catalog adapter returns a descriptor for acquisition only; local
immutable staging remains the only active package root. These adapters and the
controlled local catalog scenarios are verified by tests; a corporate DFS pilot
and Autodesk launch with a real roster are not runtime verified.