Handle Compose null endpoints in exact network-priority proof

This commit is contained in:
Codex
2026-09-30 11:33:56 +03:00
parent 93b91a4b1e
commit 50dc3b1a2c
8 changed files with 252 additions and 11 deletions
@@ -0,0 +1,25 @@
# Actual Compose 2.20.3 config output
`base.json` is an isolated synthetic two-service configuration, with no secrets,
mounts or published ports. `config.json` contains the full parsed JSON output of
the official Darwin ARM64 Compose v2.20.3 binary, SHA256
`51cd66bf94923ec8668f1a78c8740abb6cfbe1189da5720a8051a97be527372b`.
Reproduce without creating containers or contacting Docker Engine:
```sh
COMPOSE=/absolute/path/to/docker-compose-2.20.3
FIXTURE=infra/deploy-runner/fixtures/device-core-network-priority-compose220/base.json
"$COMPOSE" -p nodedc-ci-null-endpoint-repro -f "$FIXTURE" config --format json
"$COMPOSE" -p nodedc-ci-null-endpoint-repro -f "$FIXTURE" \
-f infra/device-core-deploy/docker-compose.network-priority.yml config --format json
```
The first output contains `null` for bare attachments. The second contains `{}`
for explicit zero-priority endpoints and `{"priority":100}` for private networks.
Do not replace nulls with hand-written fixture objects: that omission caused
runner014 to reject the initial NAS plan. The fixture regression reproduces
`Device Core network priority endpoint is invalid` on014 and passes on015.
It compares the full config, preserves raw config hashes and exercises negative
endpoint-type/property changes separately. This is synthetic source evidence;
it does not claim access to the NAS effective config or its exact Compose version.
@@ -0,0 +1 @@
{"services": {"device-control-core": {"image": "sha256:968df39aedcea65eeb078fb336ed7191baf48f972b4479711397108be0966920", "pull_policy": "never", "command": ["node", "-e", "setInterval(()=>{},1000)"], "read_only": true, "cap_drop": ["ALL"], "security_opt": ["no-new-privileges:true"], "stop_grace_period": "1s", "mem_limit": "96m", "pids_limit": 32, "networks": ["device-plane-private", "device-plane-egress"]}, "device-manager": {"image": "sha256:968df39aedcea65eeb078fb336ed7191baf48f972b4479711397108be0966920", "pull_policy": "never", "command": ["node", "-e", "setInterval(()=>{},1000)"], "read_only": true, "cap_drop": ["ALL"], "security_opt": ["no-new-privileges:true"], "stop_grace_period": "1s", "mem_limit": "96m", "pids_limit": 32, "networks": ["device-plane-private", "platform-edge"]}}, "networks": {"device-plane-private": {"internal": true}, "device-plane-egress": {}, "platform-edge": {}}}
@@ -0,0 +1,148 @@
{
"base": {
"name": "nodedc-ci-null-endpoint-repro",
"networks": {
"device-plane-egress": {
"name": "nodedc-ci-null-endpoint-repro_device-plane-egress",
"ipam": {},
"external": false
},
"device-plane-private": {
"name": "nodedc-ci-null-endpoint-repro_device-plane-private",
"ipam": {},
"external": false,
"internal": true
},
"platform-edge": {
"name": "nodedc-ci-null-endpoint-repro_platform-edge",
"ipam": {},
"external": false
}
},
"services": {
"device-control-core": {
"cap_drop": [
"ALL"
],
"command": [
"node",
"-e",
"setInterval(()=>{},1000)"
],
"entrypoint": null,
"image": "sha256:968df39aedcea65eeb078fb336ed7191baf48f972b4479711397108be0966920",
"mem_limit": "100663296",
"networks": {
"device-plane-egress": null,
"device-plane-private": null
},
"pids_limit": 32,
"pull_policy": "never",
"read_only": true,
"security_opt": [
"no-new-privileges:true"
],
"stop_grace_period": "1s"
},
"device-manager": {
"cap_drop": [
"ALL"
],
"command": [
"node",
"-e",
"setInterval(()=>{},1000)"
],
"entrypoint": null,
"image": "sha256:968df39aedcea65eeb078fb336ed7191baf48f972b4479711397108be0966920",
"mem_limit": "100663296",
"networks": {
"device-plane-private": null,
"platform-edge": null
},
"pids_limit": 32,
"pull_policy": "never",
"read_only": true,
"security_opt": [
"no-new-privileges:true"
],
"stop_grace_period": "1s"
}
}
},
"candidate": {
"name": "nodedc-ci-null-endpoint-repro",
"networks": {
"device-plane-egress": {
"name": "nodedc-ci-null-endpoint-repro_device-plane-egress",
"ipam": {},
"external": false
},
"device-plane-private": {
"name": "nodedc-ci-null-endpoint-repro_device-plane-private",
"ipam": {},
"external": false,
"internal": true
},
"platform-edge": {
"name": "nodedc-ci-null-endpoint-repro_platform-edge",
"ipam": {},
"external": false
}
},
"services": {
"device-control-core": {
"cap_drop": [
"ALL"
],
"command": [
"node",
"-e",
"setInterval(()=>{},1000)"
],
"entrypoint": null,
"image": "sha256:968df39aedcea65eeb078fb336ed7191baf48f972b4479711397108be0966920",
"mem_limit": "100663296",
"networks": {
"device-plane-egress": {},
"device-plane-private": {
"priority": 100
}
},
"pids_limit": 32,
"pull_policy": "never",
"read_only": true,
"security_opt": [
"no-new-privileges:true"
],
"stop_grace_period": "1s"
},
"device-manager": {
"cap_drop": [
"ALL"
],
"command": [
"node",
"-e",
"setInterval(()=>{},1000)"
],
"entrypoint": null,
"image": "sha256:968df39aedcea65eeb078fb336ed7191baf48f972b4479711397108be0966920",
"mem_limit": "100663296",
"networks": {
"device-plane-private": {
"priority": 100
},
"platform-edge": {}
},
"pids_limit": 32,
"pull_policy": "never",
"read_only": true,
"security_opt": [
"no-new-privileges:true"
],
"stop_grace_period": "1s"
}
}
}
}
+8 -3
View File
@@ -32346,7 +32346,7 @@ def rollback_gitea_ci(root, backup_dir, entries, current_stamp, runtime_started)
# Recurring application releases: a separate domain from immutable historical
# Device Plane transitions. No Compose, database, secret or controller payload.
DEVICE_PRIORITY_ID = "device-core-network-priority-v1-20260930-001"
DEVICE_PRIORITY_ID = "device-core-network-priority-v1-20260930-002"
DEVICE_PRIORITY_ENTRY = "deployment/device-core-network-priority-v1.json"
DEVICE_PRIORITY_COMPOSE = "docker-compose.device-release-network-priority.yml"
DEVICE_PRIORITY_ENTRIES = (DEVICE_PRIORITY_COMPOSE, DEVICE_PRIORITY_ENTRY)
@@ -32458,14 +32458,19 @@ def device_priority_config_proof(base, candidate):
expected = json.loads(json.dumps(base))
actual = json.loads(json.dumps(candidate))
for service, networks in DEVICE_PRIORITY_NETWORKS.items():
for config in (expected, actual):
for side, config in (("base", expected), ("candidate", actual)):
edges = config.get("services", {}).get(service, {}).get("networks")
if not isinstance(edges, dict) or set(edges) != set(networks):
die("Device Core network priority changes attached networks")
for name in networks:
edge = edges[name]
# Compose 2.20 serializes a bare attachment as null; an explicit
# empty endpoint (including zero priority) becomes {}. Only
# these four expected endpoints share that empty representation.
if edge is None:
edge = edges[name] = {}
if not isinstance(edge, dict) or type(edge.get("priority", 0)) is not int:
die("Device Core network priority endpoint is invalid")
die("Device Core network priority endpoint is invalid: " + side + "/" + service + "/" + name)
# Compose 2.20 omits the zero default in config JSON.
if edge.get("priority") == 0:
edge.pop("priority")
@@ -74,8 +74,9 @@ class PriorityTests(unittest.TestCase):
R.component_services('device-core-network-priority', entries)
def test_payload_rejects_identity_descriptor_and_yaml_changes(self):
with self.assertRaises(R.DeployError):
R.validate_device_priority_payload(self.payload, self.entries, 'arbitrary-id')
for identity in ('arbitrary-id', 'device-core-network-priority-v1-20260930-001'):
with self.subTest(identity=identity), self.assertRaises(R.DeployError):
R.validate_device_priority_payload(self.payload, self.entries, identity)
descriptor = self.payload / R.DEVICE_PRIORITY_ENTRY
original = descriptor.read_bytes()
changed = json.loads(original)
@@ -100,6 +101,44 @@ class PriorityTests(unittest.TestCase):
candidate['services']['device-manager']['networks']['platform-edge']['priority'] = 0
R.device_priority_config_proof(base, candidate)
def test_real_compose220_config_with_null_endpoints_passes_without_changing_raw_digests(self):
fixture = Path(__file__).parent / 'fixtures/device-core-network-priority-compose220/config.json'
value = json.loads(fixture.read_text())
before = copy.deepcopy(value)
self.assertIsNone(value['base']['services']['device-manager']['networks']['platform-edge'])
proof = R.device_priority_config_proof(value['base'], value['candidate'])
self.assertEqual(value, before)
self.assertEqual(proof['baseConfigSha256'], R.device_release_drift_digest(before['base']))
self.assertEqual(proof['candidateConfigSha256'], R.device_release_drift_digest(before['candidate']))
def test_null_endpoint_support_does_not_accept_other_types_or_missing_primary_priority(self):
for value in (False, True, 0, '', [], 'null', {'priority': None}, {'priority': 0.0}, {'priority': False}):
for side in ('base', 'candidate'):
base, candidate = effective(), prioritized()
config = base if side == 'base' else candidate
config['services']['device-manager']['networks']['platform-edge'] = value
with self.subTest(side=side, endpoint=value), self.assertRaises(R.DeployError):
R.device_priority_config_proof(base, candidate)
candidate = prioritized()
candidate['services']['device-manager']['networks']['device-plane-private'] = None
with self.assertRaises(R.DeployError):
R.device_priority_config_proof(effective(), candidate)
def test_null_equivalence_is_local_and_preserves_endpoint_options(self):
base, candidate = effective(), prioritized()
base['services']['device-manager']['networks']['platform-edge'] = None
candidate['services']['device-manager']['networks']['platform-edge'] = {'aliases': ['foreign']}
with self.assertRaises(R.DeployError):
R.device_priority_config_proof(base, candidate)
base, candidate = effective(), prioritized()
candidate['services']['device-postgres']['networks']['device-plane-private'] = None
with self.assertRaises(R.DeployError):
R.device_priority_config_proof(base, candidate)
base, candidate = effective(), prioritized()
for config in (base, candidate):
config['services']['device-manager']['networks']['platform-edge'] = {'aliases': ['unchanged']}
R.device_priority_config_proof(base, candidate)
def test_network_and_nonnetwork_changes_remain_rejected(self):
mutations = (
lambda c: c['services']['device-manager'].update(ports=['8080:80']),
@@ -1,7 +1,9 @@
# Stable primary network for recurring Device Core releases
Status: source-qualified on 2026-09-30; root promotion, NAS metadata acceptance
and two subsequent automatic releases remain pending. Production remains r12.
Status: runner014 was installed on 2026-09-30, but plan001 rejected an empty
Compose endpoint representation before mutation. The corrected015/002 source
is qualified; its root promotion, metadata acceptance and two subsequent
automatic releases remain pending. Production remains r12.
DCPLATFORM-21 owns this exact registry addition; DCPLATFORM-37 tracks acceptance.
## Reproduced defect and evidence limits
@@ -48,7 +50,7 @@ reason to replay r9 or waive configuration acceptance.
## Exact registered transition
Component: `device-core-network-priority`, type `app-overlay`, fixed identity
`device-core-network-priority-v1-20260930-001`. Both live and Compose roots are
`device-core-network-priority-v1-20260930-002`. Both live and Compose roots are
`/volume1/docker/nodedc-device-plane`. The package permits exactly:
1. `docker-compose.device-release-network-priority.yml`
@@ -80,6 +82,26 @@ priority values change. Environment values and complete config never enter
logs or receipts. Only config hashes, version, file hashes and runtime evidence
are saved in `device-network-priority-before.json` with mode0600.
Runner014/plan001 uncovered a missing parser case: the real Compose2.20.3
`config --format json` output represents bare network attachments as `null`,
and explicit zero-priority attachments as `{}`. Earlier fixture-based config
proof tests used `{}` in both places; actual container tests exercised network
selection/fingerprints but did not call the new effective-config validator.
This was a test coverage gap, not a production topology change.
The corrected proof accepts null as an empty object only at the four known
service/network endpoints in its private comparison copies. Raw before/after
config hashes remain exact. Scalars, arrays, boolean/float/null priority values,
missing primary priority, added networks and changed endpoint properties are
still rejected. Other services and configuration sections are not normalized.
The complete generated config fixture and reproduction commands are committed
under `infra/deploy-runner/fixtures/device-core-network-priority-compose220`.
The fixture test fails on014 with the same message and passes on015.
001 remained staged with no applied/failed receipt or backup. It is superseded
and must not be applied;002 has a new immutable identity and archive digest.
015 rejects001 rather than silently giving that old identity new semantics.
Apply verifies the copied files, effective configuration, original Compose/source,
health and exactly unchanged container identities/images/configuration for all
five services and other Compose projects. It emits `deploy-ok` only after those
@@ -115,7 +137,7 @@ python3 -m unittest discover -s infra/device-core-deploy -p 'test_*.py'
```
Also run the Platform/Device Plane registry suites and the Device Core
repository's artifact/real HTTP-health tests against this candidate runner.
Seventeen focused network-priority tests cover exact payload, deterministic
Twenty focused network-priority tests cover exact payload, deterministic
packaging, configuration-diff boundaries, initial predecessor, secret redaction,
receipt/archive activation, actual release command construction, no-runtime
metadata application and rollback failure. Python3.8 syntax is required.
+2 -1
View File
@@ -9,7 +9,8 @@ Earlier run9 failed Manager runtime configuration acceptance and rolled back;
its exact cause remains unresolved. Installed runner013 retains per-field
diagnostics without weakening acceptance. See [the evidence report](ACCEPTANCE_20260929.md).
An independently reproduced equal-priority Compose network-selection defect now
has a tested correction; its NAS promotion and live acceptance are still pending.
has a tested correction. Runner014 is installed; its first metadata plan exposed
a null-endpoint parser case. Corrected015/002 promotion and live acceptance are pending.
See [the exact network-priority transition](NETWORK_PRIORITY_20260930.md).
DCPLATFORM-21 owns the deployment contract; DCPLATFORM-37 tracks acceptance.
@@ -1 +1 @@
{"schemaVersion":"nodedc.device-core.network-priority.v1","releaseId":"device-core-network-priority-v1-20260930-001","baselineReleaseId":"device-core-release-v1-r12-b2660df9e26afe977bfa62efd35a8397eac4898b","baselineSha256":"44c62036967c3ed26bd6c82f94e6f4103ccad06f45c383498210b43ad80c9d7c","mode":"metadata-only-existing-primary-network","primaryPriority":100,"secondaryPriority":0}
{"schemaVersion":"nodedc.device-core.network-priority.v1","releaseId":"device-core-network-priority-v1-20260930-002","baselineReleaseId":"device-core-release-v1-r12-b2660df9e26afe977bfa62efd35a8397eac4898b","baselineSha256":"44c62036967c3ed26bd6c82f94e6f4103ccad06f45c383498210b43ad80c9d7c","mode":"metadata-only-existing-primary-network","primaryPriority":100,"secondaryPriority":0}