feat(deploy): add the recurring Device Core release domain and durable queue policy

This commit is contained in:
Codex
2026-09-29 18:41:21 +03:00
parent d87a0c48b4
commit d161d7fb91
5 changed files with 941 additions and 1 deletions
+67
View File
@@ -0,0 +1,67 @@
# 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.