feat(agent): persist failed retry terminal receipt
This commit is contained in:
@@ -72,6 +72,7 @@ async def test_backfill_enqueues_catalog_matched_incident(monkeypatch: pytest.Mo
|
||||
"replayed": 1,
|
||||
"check_mode_passed": 1,
|
||||
"check_mode_failed": 0,
|
||||
"runtime_stage_receipt_written": 1,
|
||||
"error": None,
|
||||
}
|
||||
|
||||
@@ -93,6 +94,7 @@ async def test_backfill_enqueues_catalog_matched_incident(monkeypatch: pytest.Mo
|
||||
assert result["failed_apply_retry_replayed"] == 1
|
||||
assert result["failed_apply_retry_check_mode_passed"] == 1
|
||||
assert result["failed_apply_retry_check_mode_failed"] == 0
|
||||
assert result["failed_apply_retry_stage_receipt_written"] == 1
|
||||
assert recorded[0]["decision_path"] == "repair_candidate_controlled_queue"
|
||||
assert recorded[0]["incident"]["incident_id"] == "INC-20260627-NODE110"
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ from src.services.awooop_ansible_check_mode_service import (
|
||||
_post_apply_verification_result,
|
||||
_record_auto_repair_execution_receipt,
|
||||
_record_learning_writeback_receipt,
|
||||
_record_retry_runtime_stage_receipt,
|
||||
_record_runtime_stage_receipts,
|
||||
_run_ansible_command,
|
||||
_send_controlled_apply_telegram_receipt,
|
||||
@@ -1793,9 +1794,16 @@ def test_failed_apply_retry_replay_is_no_write_and_idempotent() -> None:
|
||||
assert "controlled_apply_allowed=False" in source
|
||||
assert '"runtime_apply_executed": False' in source
|
||||
assert "retry_requires_repair_and_new_apply_gate" in source
|
||||
assert "_record_retry_runtime_stage_receipt" in source
|
||||
assert "NOT EXISTS" in source
|
||||
assert "run_controlled_apply_for_claim" not in source
|
||||
|
||||
receipt_source = inspect.getsource(_record_retry_runtime_stage_receipt)
|
||||
assert "_runtime_stage_receipt" in receipt_source
|
||||
assert 'stage_id="retry_or_rollback"' in receipt_source
|
||||
assert "jsonb_array_elements" in receipt_source
|
||||
assert "runtime_apply_executed" in receipt_source
|
||||
|
||||
|
||||
def test_ansible_check_and_apply_rows_persist_canonical_automation_run_id() -> None:
|
||||
finalize_source = inspect.getsource(finalize_check_mode_claim)
|
||||
|
||||
Reference in New Issue
Block a user