fix(telegram): finalize legacy pending receipt routes
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 4m44s
CD Pipeline / build-and-deploy (push) Successful in 15m3s
AWOOOI Harbor 110 Local Repair / workflow-shape (push) Successful in 2s
AWOOOI Harbor 110 Local Repair / harbor-110-local-repair (push) Successful in 19s
CD Pipeline / post-deploy-checks (push) Successful in 2m28s
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 4m44s
CD Pipeline / build-and-deploy (push) Successful in 15m3s
AWOOOI Harbor 110 Local Repair / workflow-shape (push) Successful in 2s
AWOOOI Harbor 110 Local Repair / harbor-110-local-repair (push) Successful in 19s
CD Pipeline / post-deploy-checks (push) Successful in 2m28s
This commit is contained in:
@@ -883,6 +883,51 @@ async def test_durable_reconcile_finalizes_exact_pending_row_without_provider_se
|
||||
assert "UPDATE awooop_outbound_message" in db.statements[2]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_controlled_result_finalize_backfills_missing_destination_binding(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
db = _SequenceDB(
|
||||
_MappingResult(),
|
||||
_MappingResult(row={"send_status": "sent", "provider_message_id": "456"}),
|
||||
)
|
||||
|
||||
@asynccontextmanager
|
||||
async def fake_get_db_context(_project_id):
|
||||
yield db
|
||||
|
||||
monkeypatch.setattr("src.db.base.get_db_context", fake_get_db_context)
|
||||
gateway = TelegramGateway()
|
||||
identity = {
|
||||
"project_id": "awoooi",
|
||||
"automation_run_id": "agent99-lifecycle-missing-binding",
|
||||
"incident_id": "INC-20260717-WAZUHACK",
|
||||
"apply_op_id": "00000000-0000-0000-0000-000000000104",
|
||||
"delivery_kind": "controlled_apply_result",
|
||||
}
|
||||
|
||||
finalized = await gateway._finalize_controlled_apply_result_outbound(
|
||||
identity=identity,
|
||||
reservation={
|
||||
"message_id": "00000000-0000-0000-0000-000000000202",
|
||||
"run_id": str(
|
||||
telegram_gateway_module._controlled_apply_result_delivery_run_id(
|
||||
identity
|
||||
)
|
||||
),
|
||||
},
|
||||
provider_message_id="456",
|
||||
expected_destination_binding="a" * 64,
|
||||
)
|
||||
|
||||
assert finalized is True
|
||||
update_sql = db.statements[1]
|
||||
assert "{canonical_route_receipt,destination_binding}" in update_sql
|
||||
assert "COALESCE(" in update_sql
|
||||
assert "IN ('', :expected_destination_binding)" in update_sql
|
||||
assert db.parameters[1]["expected_destination_binding"] == "a" * 64
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_durable_reconcile_rejects_provider_message_identity_mismatch(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
|
||||
Reference in New Issue
Block a user