fix(device-edge): pin accepted foundation baseline

This commit is contained in:
Codex
2026-08-12 01:11:23 +03:00
parent 3a13f0effc
commit e85bb1448e
2 changed files with 80 additions and 1 deletions
+36 -1
View File
@@ -197,6 +197,25 @@ PHASE_FILE_SHA256 = {
},
}
# Exact immutable baselines from terminally accepted predecessor artifacts.
# This is intentionally keyed by both patch id and artifact digest so a later
# artifact cannot inherit compatibility from a merely similar deployment.
ACCEPTED_PREDECESSOR_FILE_SHA256 = {
"foundation": {
(
"device-edge-vps-foundation-20260806-003",
"1be852f144e9f0fea32af70bebd07a2607b6a1818825094bd4c1b4062064716a",
): {
"vps/config/00-nodedc-b2-vps.conf":
"cc94d0579f85d0af9746b9ce760bc72980f4a22fb59027e1f5f9c7bf3aaebd64",
"vps/config/nftables-foundation.conf":
"4d44f902d8d98d1aa8506fca9d9582e700f6424def2b1d667ab2cd5a5ee84934",
"deployment/device-edge-vps-foundation-v1.json":
"317c98b42520fff3238275908482de7aa611b4ee41c6b1f8062abd2730ab072a",
},
},
}
class DeployError(RuntimeError):
pass
@@ -455,8 +474,24 @@ def assert_management_key():
die("verified Mac management key is missing")
def phase_file_sha256(phase: str):
expected = dict(PHASE_FILE_SHA256[phase])
accepted = [
record
for record in journal_records(APPLIED_JOURNAL)
if record.get("phase") == phase and record.get("status") == "ok"
]
if len(accepted) == 1:
record = accepted[0]
identity = (record.get("patch"), record.get("sha256"))
expected.update(
ACCEPTED_PREDECESSOR_FILE_SHA256.get(phase, {}).get(identity, {})
)
return expected
def source_file_state(phase: str):
expected = PHASE_FILE_SHA256[phase]
expected = phase_file_sha256(phase)
actual = {}
for relative, digest in expected.items():
path = LIVE_ROOT / relative