Files
NODEDC_PLATFORM/infra/deploy-runner/DEVICE_B2_FOUNDATION.md

7.3 KiB

Device Core: external B2 VPS foundation v1

Draft, 2026-09-30. Not installed. Canonical design recorded in DCPLATFORM-21.

This transition precedes the normal Device Core application release. It keeps its image and existing infrastructure, adds one Core private bind mount and DEVICE_B2_SECRET_ROOT, and executes one SHA-pinned additive SQL transaction. Neither Manager nor PostgreSQL is recreated. No build, pull, port or network change.

The fixed artifact contains only:

  • docker-compose.device-b2-foundation.yml
  • deployment/device-b2-foundation-v1.sql
  • deployment/device-b2-foundation-v1.json

It is built by Device Core's infra/deploy-runner/build_device_b2_foundation.py. The source SQL SHA is dc5608eccb8f628aab49390d245e6758505bb8a459a49705c375c3ca59b3e03b. The initial predecessor is accepted r14, source 6ca6738bab22d0fdef714b90c68959363106ee5b, archive SHA 385c2fec8fce300cb80a93edfbcb0d537e34755b0ccc35294c0102b3c4a7f724. The accepted network-priority override remains part of effective Compose.

Preflight proves exact predecessor source and its applied archive, empty feature schema, absent private directory, current healthy runtime and immutable effective Compose delta. The local Core tag must equal its running image. Fresh root runner promotion and plan/apply are still required; local tests do not prove NAS state.

Apply owns schema execution/receipt, private directory UID/GID1000 mode0700, Core-only recreation using its existing image, health, exact before/after runtime comparison with only the new mount/env removed, unchanged dependent containers, existing Compose/source files and unrelated services. Schema acceptance compares all ordered columns/types/nullability and constraint definitions to a fixed contract. PostgreSQL18's separately catalogued NOT NULL constraints are omitted from the constraint list because nullability is checked independently; NAS uses PostgreSQL16. This is a scoped schema normalization, not runtime guard relaxation.

Rollback restores source and the original Core configuration with the same image. It may remove only its verified, complete and empty new schema and empty key directory. Any unexpected schema, inserted data or key is retained and triggers reconciliation; it is never erased to make rollback appear successful.

Normal later device-core-release operations include the new Compose file only when a complete matching canonical receipt and applied archive prove ownership. They also validate the installed private directory, actual mount/environment, and exact schema on preflight and acceptance. A SQL failure before Core recreation does not mark runtime as changed or restart Core during rollback. Existing Dockerfile/migration immutability remains unchanged.

Runner016 was installed (SHA256 1cda852fec9e940cfbec835b27159f04e96b13e24b6bbcd3ef87dd1a91f306aa), but plan001 rejected the effective Compose comparison before mutation. Official Compose2.20.1 reproduced that rejection on all five current NAS Compose files: the sole mismatch was the new mount's bind: {} versus an expected explicit create_host_path: false. Existing synthetic tests missed this serializer form. The corrected transition is device-b2-foundation-v1-20260930-002;001 is rejected by identity and must not be applied. SQL, source YAML, predecessor and runtime scope are unchanged.

Runner017 normalizes only omitted/false create_host_path on this one new bind, in private comparison copies, alongside the existing false read_only rule. Actual config hashes remain untouched. True/null/non-boolean values, missing bind objects, unknown bind options, duplicate mounts and unrelated changes fail. See fixtures/device-b2-foundation-compose220 for real parser output and exact reproduction. Qualification with that fixture and with all five NAS files proves the old failure and corrected exact comparison. This is local parser evidence, not proof of NAS apply or runtime acceptance.

Foundation002 failure and exact reconciliation

Runner017 was installed and plan002 passed. Apply002 created the schema and recreated Core, then failed Device Core predecessor service is not healthy. Automatic rollback recreated Core again; its acceptance also failed. Canonical failed ledger80 records started_apply=true, rollback_status=failed:DeployError at 2026-09-30T13:45:49+00:00. Incident archive SHA is da1c97fb0fd2ed9f50acf198c0492b27a5d7273009c0a85b9231fd8c60a70222; backup is device-b2-foundation-device-b2-foundation-v1-20260930-002-20260930-164433. The archive, journal and seven backup-file digests are pinned in the runner.

The acceptance order was wrong: the strict healthy snapshot ran before the existing bounded readiness/HTTP checks. The tests now exercise the actual readiness loop through starting to healthy for both apply and rollback. Both cases fail on017 and pass on018. Persistently unhealthy containers still fail after the existing grace window; image/config/dependency guards are intact. Historical failed-generation health states were not saved, so starting is a reproduced defect, not a retroactively observed Docker status for this incident.

Read-only SMB observation found all three foundation files and its vault absent. Public Manager health returned200/ok. These facts do not prove restored database and runtime. No second application attempt is allowed until exact reconciliation.

device-b2-foundation-reconciliation is a separate metadata-only component. Identity: device-b2-foundation-reconciliation-v1-20260930-001. Its sole payload is deployment/device-b2-foundation-reconciliation-v1.json; builder: infra/deploy-runner/build_device_b2_reconciliation.py. Root is /volume1/docker/nodedc-device-plane, with no build or selected services. Plan and apply independently prove:

  • exact failed row/archive and immutable before/schema/backup partition evidence;
  • accepted r14 baseline and no different unresolved foundation transition;
  • no foundation files, private directory, or any of the three new schema objects;
  • readiness, original Core image/config, unchanged other containers, Compose files and application source.

Apply writes only the descriptor and canonical backup/journal/archive, then repeats the proof before success. Its rollback removes only that new descriptor; neither path issues runtime mutations or DDL. Only a complete matching receipt and applied archive can acknowledge this one failed002 record. The original failed journal/archive/backup remain immutable. A marker alone, altered history, another failure, remaining schema/data/keys or runtime drift blocks acceptance. Ordinary app releases also check this barrier even if no foundation overlay is present. No generic health/fingerprint or unrelated registry rules are weakened.

After reconciliation, a fresh foundation003 plan/apply may add the original unchanged YAML and SQL.003 is a new immutable identity;001/002 cannot be replayed. Preparation of018 or a local test is not production reconciliation acceptance.

Local validation: foundation boundary/negative tests, deterministic artifact, real archive through runner loader, existing release/network-priority/autodeploy and Device Plane registry regression. SQL was also executed after all17 existing migrations in temporary PGlite PostgreSQL WASM, with cross-company foreign-key and contour uniqueness checks. This is SQL validation, not NAS runtime acceptance. The actual Device Core connect/link SQL also passed against that database.