fix(api): record ansible repair receipts with typed inserts
All checks were successful
Code Review / ai-code-review (push) Successful in 15s
CD Pipeline / tests (push) Successful in 1m46s
CD Pipeline / build-and-deploy (push) Successful in 5m28s
CD Pipeline / post-deploy-checks (push) Successful in 1m50s

This commit is contained in:
Your Name
2026-06-27 14:27:15 +08:00
parent e92d8e35aa
commit 8d31fbf69e
2 changed files with 18 additions and 8 deletions

View File

@@ -600,22 +600,22 @@ async def _record_auto_repair_execution_receipt(
execution_time_ms
)
SELECT
:incident_id,
:playbook_id,
:playbook_name,
CAST(:incident_id AS varchar(30)),
CAST(:playbook_id AS varchar(36)),
CAST(:playbook_name AS varchar(200)),
:success,
CAST(:executed_steps AS jsonb),
:error_message,
:triggered_by,
CAST(:triggered_by AS varchar(50)),
:similarity_score,
:risk_level,
CAST(:risk_level AS varchar(20)),
:execution_time_ms
WHERE NOT EXISTS (
SELECT 1
FROM auto_repair_executions existing
WHERE existing.incident_id = :incident_id
AND existing.triggered_by = :triggered_by
AND existing.executed_steps::text LIKE :apply_op_id_needle
WHERE existing.incident_id = CAST(:incident_id AS varchar(30))
AND existing.triggered_by = CAST(:triggered_by AS varchar(50))
AND existing.executed_steps::text LIKE CAST(:apply_op_id_needle AS text)
)
RETURNING id
"""),