Both story claims can be valid
Imagine two dispatcher executions selecting different ready stories. Each can claim its row and pass the readback for external key, locked status and owner. That readback rejects missing, multiple or mismatched rows, so both executions can legitimately continue.
The selected story is chosen randomly from eligible rows, not by highest score. More importantly for allocation, the claim covers only that story. It doesn't reserve every shared record the dispatcher will touch next.
The next number is shared state
Episode allocation reads the existing numbers, adds one to the maximum and rolls over after ten episodes. The dispatcher then upserts by that calculated key. If both valid story owners read before either writes, they can calculate the same key.
This is a possible interleaving in the source, not a collision reproduced in production. Number reservation needs its own atomic operation or a uniqueness check with retry. A test should run the competing allocations, not only show that each seed lock works on its own.
Recovery also needs to know whether work started
When a worker response is rejected or unrecognized, recovery marks the episode failed and releases the still-owned seed. But an accepted request can lose its response. Releasing that story would make it available while rendering may already be underway.
A stable handoff key and acceptance readback would let recovery distinguish rejection from an uncertain response. That is separate from the allocation race, but both show why ownership of one source row isn't enough to coordinate the whole episode.
Per-seed claims and a shared season allocator
This source-derived interleaving shows why independent seed locks do not reserve a unique episode number.
Dispatcher A
Shared registry
Dispatcher B
Scroll or drag the background to move. Use the zoom buttons to resize.Arrow keys move between components. Enter selects.
Choose a component to explore
Select a numbered component on the map or use the component menu. Its details and connections will appear here.
No component selected.
All connections (8)
- 01 · Ready seed A → 02 · Owned claim AClaim · Direct call
- 06 · Ready seed B → 07 · Owned claim BClaim · Direct call
- 02 · Owned claim A → 04 · Season episode rowsRead season rows · Direct call
- 07 · Owned claim B → 04 · Season episode rowsRead season rows · Direct call
- 04 · Season episode rows → 03 · Compute next key AMaximum N · Direct call
- 04 · Season episode rows → 08 · Compute next key BMaximum N · Direct call
- 03 · Compute next key A → 05 · Registry upsertUpsert key N + 1 · Direct call
- 08 · Compute next key B → 05 · Registry upsertSame possible key N + 1 · Direct call