fix(sre): type backup learning as read-only

This commit is contained in:
Your Name
2026-07-19 01:10:47 +08:00
parent 2285df21c9
commit 0f30d1350f
2 changed files with 88 additions and 20 deletions

View File

@@ -51,6 +51,26 @@ def test_agent99_playbook_identity_is_project_scoped() -> None:
assert job._playbook_id(IDENTITY) != job._playbook_id(other)
def test_backup_learning_profile_is_typed_and_no_write() -> None:
identity = build_agent99_dispatch_identity(
project_id="awoooi",
incident_id="INC-20260719-BACKUP-LEARNING",
source_fingerprint="backup-learning-fingerprint",
route_id="agent99:backup_health:BackupCheck",
)
profile = job._learning_profile(identity, mode="BackupCheck")
assert profile["affected_services"] == ["backup_restore"]
assert profile["action_type"] == "agent99_readonly_check"
assert profile["rollback_command"] == "not_applicable_no_write"
assert profile["km_category"] == "資料保護/DR Scorecard"
assert "verified backup readback" in profile["km_title"]
assert "LLM had no runtime authority" in profile["km_content"]
assert "cold-start" not in str(profile)
assert "verified recovery" not in profile["km_title"]
class _Context:
def __init__(self, db) -> None: # type: ignore[no-untyped-def]
self.db = db