fix(iwooos): send deploy-scoped Wazuh receipt retry

This commit is contained in:
Your Name
2026-07-22 21:44:17 +08:00
parent e990e17414
commit 9ac7fd4ef2
2 changed files with 69 additions and 7 deletions

View File

@@ -337,10 +337,40 @@ async def test_post_apply_pending_receipt_does_not_write_learning_or_failure(
@pytest.mark.asyncio
@pytest.mark.parametrize(
("source_receipt_ref", "expected_provider_delivery"),
[
(
"scheduled-wazuh-manager-posture:2026071506",
"shadow_only",
),
(
(
"scheduled-wazuh-manager-posture:2026071506-"
"ABCDEF123456-RECEIPT"
),
"state_transition",
),
(
(
"scheduled-wazuh-manager-posture:2026071506-"
"DEADBEEFCAFE-RECEIPT"
),
"shadow_only",
),
],
)
async def test_backfill_repairs_orphan_incident_and_reuses_verifier(
monkeypatch: pytest.MonkeyPatch,
source_receipt_ref: str,
expected_provider_delivery: str,
) -> None:
claim = _wazuh_claim()
claim.input_payload["source_receipt_ref"] = source_receipt_ref
monkeypatch.setenv(
"AWOOOI_BUILD_COMMIT_SHA",
"abcdef1234567890abcdef1234567890abcdef12",
)
apply_op_id = "00000000-0000-0000-0000-000000000203"
receipt = _durable_verifier_receipt(claim, apply_op_id=apply_op_id)
row = {
@@ -424,15 +454,16 @@ async def test_backfill_repairs_orphan_incident_and_reuses_verifier(
"_record_runtime_stage_receipts",
AsyncMock(return_value=True),
)
closure = AsyncMock(
return_value={
"closed": True,
"telegram_receipt_acknowledged": True,
}
)
monkeypatch.setattr(
service,
"_reconcile_verified_apply_closure_projections",
AsyncMock(
return_value={
"closed": True,
"telegram_receipt_acknowledged": True,
}
),
closure,
)
result = await service.backfill_missing_auto_repair_execution_receipts_once(limit=1)
@@ -443,6 +474,9 @@ async def test_backfill_repairs_orphan_incident_and_reuses_verifier(
assert result["incident_closure_written"] == 1
incident_ledger.assert_awaited_once()
assert writeback.await_args.kwargs["durable_verifier_receipt"] == receipt
assert closure.await_args.kwargs["provider_delivery"] == (
expected_provider_delivery
)
@pytest.mark.asyncio