# Stop a saved record and its message from diverging

A row written and a message published separately, replaced so the two cannot diverge.

Category: Queues, jobs, and async work
Source: https://letsship.ai/use-cases/replace-a-dual-write-with-an-outbox
Published: 2026-08-25

## Goal

Replace a dual write with an outbox so the row and the message commit together.

## Acceptance criteria

- The message is written in the same transaction as the row
- A relay publishes from the outbox with at-least-once delivery
- A failure injected between the two produces no divergence
- Consumers already handle duplicates, or that is fixed first

## What lands as proof

A failure-injection test showing the row and the message cannot end up out of step.

## Prompt

Copy this to an agent to open the ticket:

```text
Create a Linear issue in my team and assign it to the SHIP agent.

Title: Replace the dual write in {operation} with an outbox

Description: Replace a dual write with an outbox so the row and the message commit together.

Acceptance criteria:
- The message is written in the same transaction as the row
- A relay publishes from the outbox with at-least-once delivery
- A failure injected between the two produces no divergence
- Consumers already handle duplicates, or that is fixed first

Before you create the issue, find a place in this repository that writes a row and publishes a message separately, and replace {operation}.
```

## Questions

### What does the agent actually change?

The ticket is scoped to one outcome: replace a dual write with an outbox so the row and the message commit together. Work that serves that outcome is in scope, and anything outside it is left for a separate ticket, so the pull request stays reviewable.

### How do I know the work is done?

The pull request carries the evidence, not only the diff. Here that means failure-injection test proving the two cannot diverge, so a reviewer can confirm the result without reproducing the work locally.

### How much oversight does this need?

The run stops for the plan, and the review bar is raised afterwards so that smaller suggestions block the merge too, not only serious findings.
