Files
mtusi2026lab7-safronov/infra/incident/jobs_audit.sql
T
ricoromaandClaude Opus 5.5 4f2f940a07 feat: confine a compromised worker and drill its compromise end to end
- narrow the worker S3 user to staging reads and attachments writes
- add database rules the worker role cannot bypass: no return to pending,
  variant keys of its own attachment, known error codes only
- let the cleaner remove a ready source only after its own SHA-256 check
- add make jobs_audit [REPAIR=1] to name and requeue damaged jobs
- add make worker_compromise: isolated before/after stands, one operation
  table, response windows, job safety, controls and committed hypotheses

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 03:01:20 +03:00

29 lines
1.4 KiB
SQL

-- Сверка заданий (make jobs_audit): после jobs_classes.sql в той же транзакции.
-- Ничего не меняет. Строки «class <имя> <число>», «info <имя> <число>» и
-- «damaged <число>» — вложений, у которых есть хотя бы один класс порчи.
SELECT 'class ' || name || ' ' || count(*) FILTER (WHERE found)
FROM (
SELECT c.ord, c.name, c.found FROM incident i
CROSS JOIN LATERAL (VALUES
(1, 'stuck_time', i.stuck_time),
(2, 'attempt_number', i.attempt_number),
(3, 'state_mismatch', i.state_mismatch),
(4, 'false_success', i.false_success),
(5, 'future_updated_at', i.future_updated_at),
(6, 'verified_damaged', i.verified_damaged)
) AS c (ord, name, found)
UNION ALL
VALUES (1, 'stuck_time', false), (2, 'attempt_number', false),
(3, 'state_mismatch', false), (4, 'false_success', false),
(5, 'future_updated_at', false), (6, 'verified_damaged', false)
) rows (ord, name, found)
GROUP BY ord, name
ORDER BY ord;
SELECT 'info failed_with_source '
|| count(*) FILTER (WHERE failed_with_source) FROM incident;
SELECT 'info ready_without_variants '
|| count(*) FILTER (WHERE ready_without_variants) FROM incident;
SELECT 'damaged ' || count(*) FROM incident
WHERE stuck_time OR attempt_number OR state_mismatch OR false_success
OR future_updated_at OR verified_damaged;