liveBook · Manning

Retry safety

As explained in Crack Any Codebase with AI

Retry safety is the property of an operation that repeated execution after failure does not produce unintended additional effects.

Retry safety means repeated execution after failure does not create unintended additional effects. It matters when one operation combines database writes with independent external network calls. section 7.5

Evaluate each step separately:

  • Treat repeated database writes as safe when they are idempotent, such as setting an already-CANCELLED booking to CANCELLED. section 7.5
  • Protect external effects with provider-supported idempotency keys; otherwise a timeout and retry can issue a Stripe refund twice. section 7.5
  • Check asynchronous work separately because failures after the response can leave users seeing success while reminders or calendar state remain wrong. section 7.5

Cancelling a booking

A process marks a booking CANCELLED, then crashes before refunding the customer. Retrying safely repeats the harmless database update, uses the same Stripe idempotency key, and prevents duplicate webhook scheduling through its unique key. section 7.5

How Crack Any Codebase with AI covers it

How deep it goes
Checks idempotent writes, provider idempotency keys, unique scheduling keys, crash points, and synchronous versus asynchronous boundaries.
Examples
Uses booking cancellation with a Stripe refund, workflow-reminder cancellation, webhook scheduling, and Google Calendar deletion.
What it assumes
Assumes familiarity with database writes, transactions, network calls, HTTP responses, and background tasks.
What you can do after
Diagnose which operations can double-fire after crashes or timeouts and identify the keys or safeguards needed for safe retries.
How it connects
Connects idempotence, database transactions, network calls, webhooks, asynchronous processing, and idempotency keys.

This explainer was generated by Manning's knowledge graph from the text of Crack Any Codebase with AI. The section links point to the parts of the book it draws on.