feat(agent99): expose seven-host backup truth
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 2m36s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled

This commit is contained in:
Your Name
2026-07-18 17:05:59 +08:00
parent 33d2cc4bbc
commit 79489635d8
3 changed files with 424 additions and 4 deletions

View File

@@ -167,7 +167,7 @@ def test_agent99_backupcheck_reads_offsite_and_escrow_without_mutation() -> None
source = _CONTROL_PLANE.read_text(encoding="utf-8")
readback = source[
source.index("function Test-AgentBackupProtectionReceipts") :
source.index("function Invoke-AgentBackupReadbackContractSelfTest")
source.index("function Convert-AgentGoogleDriveQuotaReadback")
]
assert "[switch]$SelfTestBackupReadbackContract" in source
@@ -220,3 +220,55 @@ def test_agent99_backupcheck_reads_offsite_and_escrow_without_mutation() -> None
assert "-not $escrowPartialResult.escrow.ok" in source
for mutation in ("rclone ", "rsync ", " rm ", "restore ", "Set-Content"):
assert mutation not in readback
def test_agent99_backupcheck_covers_all_hosts_and_bounds_drive_quota() -> None:
source = _CONTROL_PLANE.read_text(encoding="utf-8")
host_contract = source[
source.index("function Get-AgentBackupCanonicalHostDefinitions") :
source.index("function Test-AgentBackupHealth")
]
quota_contract = source[
source.index("function Convert-AgentGoogleDriveQuotaReadback") :
source.index("function Invoke-AgentBackupReadbackContractSelfTest")
]
for host_alias in ("99", "110", "111", "112", "120", "121", "188"):
assert f'alias = "{host_alias}"' in host_contract
for asset in (
"windows_system",
"vmware_inventory",
"agent99_control_plane",
"gitea",
"harbor",
"workstation_safe_artifacts",
"wazuh_security_state",
"k3s_etcd",
"k3s_local_pv",
"product_datastores",
"docker_volumes",
"ai_assets",
):
assert f'"{asset}"' in host_contract
assert "runtimeReadbackOk" in source
assert "backupEvidenceReady" in source
assert '"host_backup_contract_not_registered"' in source
assert "backupEvidenceReadyCount" in source
assert 'schemaVersion = "agent99_google_drive_quota_readback_v1"' in quota_contract
assert "timeout --signal=TERM --kill-after=5s" in quota_contract
assert "rclone about" in quota_contract
assert 'remoteName -notmatch "^[A-Za-z0-9_.-]+:$"' in quota_contract
assert 'canonicalRemoteCountedOnce = $true' in quota_contract
assert 'capacityDecision = if ($ok)' in quota_contract
assert 'rawOutputStored = $false' in quota_contract
assert 'secretValueRead = $false' in quota_contract
for mutation in ("rclone copy", "rclone sync", "rclone delete", "rclone purge"):
assert mutation not in quota_contract
def test_agent99_backupcheck_escrow_receipt_uses_exact_mtime() -> None:
source = _CONTROL_PLANE.read_text(encoding="utf-8")
assert '"escrow-status:${mtime}:missing-0"' in source
assert '"escrow-status:$mtime:missing-0"' not in source