# Device Core recurring deployment Status: 2026-09-29. The build runner is installed and push-to-main qualification works. Production polling is **not activated**. DCPLATFORM-21 owns the deployment contract; DCPLATFORM-37 tracks activation. ## Release domain The root-owned `infra/deploy-runner/nodedc-deploy` adds `device-core-release`. Device Core's `infra/ci/package_release.py` creates the only accepted nine-entry, data-only package. It binds repository 38, main, full source commit, CI run ID and number, completed qualification, every source file, and the served UI digest. The served digest uses lexically sorted relative POSIX paths, with 8-byte big-endian path/data lengths; it excludes source maps independently of the full build digest. The first deployment proves the exact applied sequence: Edge channel v4 (023), Control Core v4 (047), Manager v13 (051). Later deployments prove the most recent normal-release archive, journal and complete installed file map. Stale runs, repeated source commits, source drift and unresolved rollback failures fail closed. Historical transition rules are unchanged. Only `device-control-core` and `device-manager` are built and recreated, using the existing effective Compose project/files and `--no-deps --no-build --pull never`. The database, Gateway, backhaul, volumes, existing ports, mounts, identities and all other persistent Compose services remain unchanged. Migration files and build recipes must match the installed foundation; changes need a separately reviewed migration/topology transition. Build jobs never receive installation credentials. Apply backs up the exact replaced source and old image IDs before writing. Failed builds restore source and tags without restarting services. Failed activation restores both old images without rebuilding, recreates only the selected services, then verifies health, source, configuration and preservation before recording a successful rollback. A failed rollback blocks further releases for reconciliation. Successful apply requires new selected container generations, correct images, healthy dependencies, unchanged topology and source hashes before `deploy-ok`. ## Durable queue foundation `deployment_queue.py` supplies transactional SQLite ordering and restart recovery. It has no network or runtime authority. It rejects mismatched run identity, waits for earlier pending runs, records artifact reservation before installation, skips duplicate/already superseded sources, and requires a canonical journal/archive receipt after a crash. It does not discover API pages or prove Git ancestry. ## Remaining activation work - Implement outbound authenticated Gitea polling with complete pagination and refresh of pending runs; verify repository, run, jobs, artifact and Git ancestry. - Import a narrowly scoped read token into root-private controller runtime. - Add and test the canonical controller bootstrap domain and fixed service unit. - Install via the root runner, then accept push → qualified artifact → canonical plan/apply, serial commits, failed tests, rollback and restart recovery on NAS. No helper from this directory is installed by an application release. Do not run helper code from SMB or use Docker as a deployment shortcut. ## Validation ```sh python3 -m unittest discover -s infra/device-core-deploy -p 'test_*.py' python3 -m unittest discover -s infra/deploy-runner -p test_device_core_release.py python3 -m unittest discover -s infra/gitea-ci -p 'test_*.py' ``` The Device Core repository's full `infra/deploy-runner` suite must also pass against the changed canonical runner. Its historical skipped tests remain reported as skipped, not as live acceptance. ## Initial r5 health-contract incident The first normal release (run 5, source `67b2ae586399eb1eb7d3a6c074a292e0dbb7b406`) failed acceptance and rollback acceptance because the new domain selected the old generic disabled-foundation health expectations. The current preserved foundation reports discovery and management enabled and `typed-service-ping-v1`. The release now uses an explicit contract before build, after activation and during rollback. Legacy transition contracts remain unchanged. Device Core's `test_device_release_health_contract.py` runs the actual Core and Manager HTTP handlers against the pinned installer; it fails on the original installer and passes on this correction, including negative dependency/auth/capability cases. `build_reconciliation.py` packages one fixed data descriptor for `device-core-release-reconciliation`. Its plan and apply prove the exact failed journal/archive, six backup digests, restored sources, old image IDs, runtime configuration, Compose and preserved services. No build, restart, secret repair, port or database action exists in this domain. Apply writes only a marker and a separate canonical receipt; failure removes only that marker. It never rewrites the original failed journal. Later releases require marker + applied archive + receipt + original incident evidence. Other rollback failures remain blocked. The r5 archive must never be replayed. Reconciliation does not install a release or activate automatic deployment. Only after its live acceptance may a NEW successful CI run become the next normal-release candidate. ## Read-only diagnosis after rejected reconciliation Reconciliation001 stopped in plan on the saved Core runtime configuration hash. No apply ran. The initial rejection alone did not prove harmless ordering or actual drift. The original backup stores only an aggregate hash, and the legacy snapshot retains HostConfig.Binds/Mounts order. The diagnostic kept acceptance unchanged. `build_drift_audit.py` creates a separate `device-core-release-drift-audit` bundle. Its only entry is `deployment/device-core-release-r5-drift-audit-v1.json`. Only canonical `plan` can execute this diagnostic; `apply` refuses before any application/backup action. It proves original incident evidence and reports all five service image/hash comparisons over three observations, source/Compose, health, secret/mount/network boundaries and unrelated Compose preservation. No raw inspect, environment values or secrets are printed. The diagnostic searches at most 20,000 exact legacy hash candidates, changing only the order of observed HostConfig.Binds/Mounts (up to eight each) and NetworkMode among attached network names. It preserves every other value. A matching old NetworkMode is reported as a difference, never accepted as harmless. Exhaustion, changing samples or no match remains unresolved. No diagnostic result creates a reconciliation marker or bypasses the original acceptance barriers. A subsequent recovery decision requires the actual NAS report. ## Proven mount-order recovery and runtime fingerprint v2 The NAS audit on 2026-09-29 found an exact old hash preimage for Core and Manager by reordering only `HostConfig.Mounts` (7 and 3 entries). All three observations were stable; image IDs, source, topology, health, runtime boundaries and preserved services matched. The audit output SHA is `cf687c8bf550fa8c7d1125a3297e04c3d0d81a704b1d6ad17dbddc66470a1189`. This evidence does not itself create a canonical recovery receipt. The recurring release domain now records `runtimeFingerprintVersion: 2` in new before snapshots. Version 2 sorts complete `HostConfig.Mounts` objects, requiring unique absolute normalized Target paths, and preserves every value and option. Binds and NetworkMode are unchanged. Old snapshots without a version retain the legacy comparison; generic Compose and historical transition guards are unchanged. Docker 24.0.2 registers mount points by unique destination, independently of this input list order: . Build the NEW data-only recovery package with: ```sh python3 infra/device-core-deploy/build_reconciliation.py --version 2 --output-dir /tmp/recovery-v2 ``` The fixed identity is `device-core-release-r5-reconciliation-v2-20260929-002`, with only `deployment/device-core-release-r5-reconciliation-v2.json`. Version 1 remains strict and byte-identical. V2 proves the old digest with at most 5,041 candidates per service by permuting only existing HostConfig.Mounts (at most seven); it never uses the broader diagnostic probe. Three identical observations, old images and exact preserved service rows are required. After proving equivalence it derives a v2 baseline and rechecks every existing acceptance guard. Plan, locked preflight and post-copy acceptance all repeat this proof. Conflicting v1/v2 markers fail. Apply only writes the marker, backup and canonical journal. Original incident files and the failed receipt remain unchanged. Marker plus unique applied receipt, archive digest/identity and original evidence are required to acknowledge r5. A failure removes only the marker. This package performs no application deployment and does not activate automatic deployment. Live plan/apply are still required; the old r5 artifact and the rejected v1 reconciliation must not be replayed.