Files
NODEDC_PLATFORM/infra/device-core-deploy/README.md
T

6.6 KiB

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

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. This does not prove either harmless ordering or actual drift. The original backup stores only an aggregate hash, and the legacy snapshot retains HostConfig.Binds/Mounts order. Existing acceptance is deliberately 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.