Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Fail-closed Python automation: dry runs, single-use approvals, and safe retries

Описание и применение

Паттерн Fail‑closed для Python‑автоматизации обеспечивает безопасное выполнение записей: по умолчанию используется dry‑run, требуется явное одобрение JSON‑payload, однократный nonce, резервирование работы между воркерами и append‑only аудит.

Задача

Automations that create or update records risk unsafe states and lack auditability if they run without explicit approval and safeguards.

Результат

The pattern ensures that only approved, non‑duplicate, and non‑concurrent writes occur, with full auditability and robust failure testing.

Рабочий процесс

  • 1. Run script in dry‑run mode to validate inputs and compute payload. 2. Generate a canonical JSON representation of the payload. 3. Obtain explicit approval that binds to the JSON signature. 4. Store a unique nonce/approval ID in a transactional table. 5. Reserve work with a unique key and short DB transaction to prevent concurrent execution. 6. Execute the write only if approval and reservation succeed. 7. Log sanitized JSON lines to an append‑only audit trail. 8. Test that dry‑run never writes, modified payload fails approval, nonce reuse is rejected, and reservations are shared across workers.

Доказательства

A dry run should validate inputs, compute the intended payload, and produce a machine-readable outcome without performing a live write.

Источник

Store a nonce or approval identifier in a transactional table and consume it atomically.

Источник

  • Дата записи: 2026-09-15T13:15:34.930Z