fix(device-plane): activate manager from v2 reconciliation

This commit is contained in:
Codex
2026-08-11 10:14:24 +03:00
parent 37bdbebb4e
commit 1adbabefcf
5 changed files with 116 additions and 39 deletions
@@ -239,21 +239,28 @@ class DeviceManagerControlPlaneArtifactsTest(unittest.TestCase):
)
runtime_acceptance.assert_called_once_with()
def test_v2_activation_requires_exact_applied_reconciliation(self):
def test_v3_activation_requires_exact_applied_v2_reconciliation(self):
with tempfile.TemporaryDirectory(
prefix="nodedc-device-manager-v2-predecessor-",
prefix="nodedc-device-manager-v3-predecessor-",
) as directory:
root = Path(directory)
artifact = root / RUNNER.DEVICE_PLANE_MANAGER_RECONCILIATION_ARTIFACT
artifact = (
root
/ RUNNER.DEVICE_PLANE_MANAGER_V2_RECONCILIATION_ARTIFACT
)
artifact_bytes = b"reviewed-reconciliation-artifact"
artifact.write_bytes(artifact_bytes)
state_file = root / "applied.jsonl"
state_file.write_text(
json.dumps({
"id": RUNNER.DEVICE_PLANE_MANAGER_RECONCILIATION_PATCH_ID,
"artifact": RUNNER.DEVICE_PLANE_MANAGER_RECONCILIATION_ARTIFACT,
"id": (
RUNNER.DEVICE_PLANE_MANAGER_V2_RECONCILIATION_PATCH_ID
),
"artifact": (
RUNNER.DEVICE_PLANE_MANAGER_V2_RECONCILIATION_ARTIFACT
),
"backup_id": (
RUNNER.DEVICE_PLANE_MANAGER_RECONCILIATION_APPLY_BACKUP_ID
RUNNER.DEVICE_PLANE_MANAGER_V2_RECONCILIATION_APPLY_BACKUP_ID
),
"component": "device-plane",
"sha256": hashlib.sha256(artifact_bytes).hexdigest(),
@@ -267,7 +274,7 @@ class DeviceManagerControlPlaneArtifactsTest(unittest.TestCase):
mock.patch.object(RUNNER, "STATE_FILE", state_file),
mock.patch.object(
RUNNER,
"DEVICE_PLANE_MANAGER_RECONCILIATION_ARTIFACT_SHA256",
"DEVICE_PLANE_MANAGER_V2_RECONCILIATION_ARTIFACT_SHA256",
hashlib.sha256(artifact_bytes).hexdigest(),
),
mock.patch.object(
@@ -279,12 +286,12 @@ class DeviceManagerControlPlaneArtifactsTest(unittest.TestCase):
) as payload,
mock.patch.object(
RUNNER,
"validate_device_plane_manager_reconciliation_backup",
"validate_device_plane_manager_v2_reconciliation_backup",
return_value=backup,
),
mock.patch.object(
RUNNER,
"validate_device_plane_manager_reconciled_baseline",
"validate_device_plane_manager_v2_reconciled_baseline",
return_value={"accepted": True},
) as baseline,
):
@@ -296,7 +303,7 @@ class DeviceManagerControlPlaneArtifactsTest(unittest.TestCase):
self.assertEqual(
result["mode"],
"reconciled-manager-forward-activation",
"reconciled-v2-manager-forward-activation",
)
payload.assert_called_once_with(root / "payload")
baseline.assert_called_once_with(backup, marker_installed=True)