# Checkpoints follow the promised commit

> For agents: start with the [agent guide](https://ratstack.sh/llms.txt). Every page is Markdown by default; add `Accept: text/html` for HTML.

Free workshop: [Build Agent Loops That Never Stop Shipping](/tokenmaxx#interested).

A consumer position and its materialized state must agree. Acknowledge processing only after the promised processing completes.

> allowing a single stateful transaction to atomically update both the state and input offsets.

Source: [Q13](/lore/durability-bibliography#q13); [B5](/lore/durability-bibliography#b5-building-event-driven-microservices).

## Failure it prevents

Progress advances without its state, or state commits while replay still reapplies the event.

## Our Effect 4.0.0 reading

`SqlClient.withTransaction` covers its database boundary. `Stream.runForEach` expresses handling only. Broker acknowledgement and remote transactions need their own protocol.

Source: `packages/effect/src/sql/SqlClient.ts`, `packages/effect/src/Stream.ts`.

## How to check

Crash before and after state commit and acknowledgement. Redeliver and compare state with the expected checkpoint. This check is our proposal. The books do not prescribe it.

Continue with [Retry needs idempotent effects](/lore/retry-needs-idempotency), [Dead letters need a return path](/lore/dead-letters-need-a-return-path).

Connect this to [the existing rat-stack guidance](/lore/concurrent-work-needs-an-owner).

Use [the durability skill](/skills/durability) for the full review. Return to [the durability index](/lore/durability).

## Sources

1. [Bellemare, Adam. Building Event-Driven Microservices: Leveraging Organizational Data at Scale. O’Reilly, 2020.](https://www.oreilly.com/library/view/building-event-driven-microservices/9781492057888/)
   O’Reilly. Chapter 3 Communication and Data Contracts; Chapter 6 Deterministic Stream Processing; Chapter 7 Stateful Streaming; Chapter 9 Microservices Using Function-as-a-Service; Chapter 14 Supportive Tooling. Accessed 2026-10-23.

2. [Effect contributors. Effect 4.0.0. sql/SqlClient.ts](https://github.com/Effect-TS/effect/blob/67ba4e46a11ccda0b6761578bfd22c04ae00167d/packages/effect/src/sql/SqlClient.ts)
   Effect-TS. Pinned source for our Effect mapping, not a claim from the book. Accessed 2026-10-23.

3. [Effect contributors. Effect 4.0.0. Stream.ts](https://github.com/Effect-TS/effect/blob/67ba4e46a11ccda0b6761578bfd22c04ae00167d/packages/effect/src/Stream.ts)
   Effect-TS. Pinned source for our Effect mapping, not a claim from the book. Accessed 2026-10-23.

## Linked from

- Agent guide → An Effect stack so pure (aspirational) Kit Langton will blush. → [Read page](https://ratstack.sh/llms.txt)

- Change log → What changed in the files served here, newest first. → [Read page](https://ratstack.sh/log)

- durability → Keep a rat-stack app standing when a provider, pool, or dependency slows down or a worker dies. Use at any I/O boundary, connection pool, provider call, shared waiter, fan-out, flag, gate, or work that can outlive a request, or when asked "what happens when this is slow", "add a timeout", "make this durable", or "what survives a crash". → [Read page](https://ratstack.sh/skills/durability)

- Durability starts with a recovery record → A reading order for storage, replay, worker ownership, overload, and recovery tests. → [Read page](https://ratstack.sh/lore/durability)

- Durable work needs storage → A restarted worker cannot recover intent that existed only in memory. → [Read page](https://ratstack.sh/lore/durable-work-needs-storage)

- Full agent guide → An Effect stack so pure (aspirational) Kit Langton will blush. → [Read page](https://ratstack.sh/llms-full.txt)

- Rat Stack lore | rat-stack → Short, source-grounded notes on the ideas and decisions behind rat-stack. → [Read page](https://ratstack.sh/lore)

- Recovery needs model tests → Test sequences of failures and recoveries against explicit invariants. → [Read page](https://ratstack.sh/lore/recovery-needs-model-tests)

- Retry needs idempotent effects → Repeating an operation must preserve its intended observable result. → [Read page](https://ratstack.sh/lore/retry-needs-idempotency)

- Source change history (log.md) → The generated change log as Markdown. → [Read page](https://ratstack.sh/log.md)
