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
+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")