The Glass Archive / Editorial automation / 2026
Building each episode around four tracked frames.
An n8n dispatcher verifies ownership of a story seed and creates episode and frame records before rendering, giving returned assets explicit places to belong.
- ROLE
- Software engineering
- STATE OF THE BUILD
- Prototype
- RECORD UPDATED
THE WORK
The project.
The Glass Archive organizes generation around an episode before the first frame is rendered. Its dispatcher claims a ready story seed, verifies the lock owner, and creates an episode with four pending frame records. The worker can then attach returned assets to those identities while the registry shows what is still waiting, rather than reconstructing the episode from a group of finished files.
The source lock also scopes recovery: a failed handoff releases only the seed still owned by that execution. Episode numbering needs a separate rule, however. The current allocator reads the highest number and adds one, so two dispatchers holding different stories can still choose the same next episode. This account describes the exported implementation and that unresolved concurrency case, not an executed collision or verified live run.
IMPLEMENTATION
Design choices.
- Claim acquisition is followed by verification. Reaching an update node doesn't prove that it returned one usable row owned by this execution; the readback checks that before episode allocation proceeds.
- Episode and frame records exist before rendering. They provide explicit pending state and attachment targets, although the separate upserts don't form one atomic allocation transaction.
- Story ownership is distinct from episode-number reservation. Max-plus-one is easy to derive from the registry, but different valid seed owners can read the same maximum. The shared number still needs concurrency control.
- Eligible seeds are chosen uniformly at random. A ranking-oriented node name doesn't make the selected story the highest-scored candidate, so the account follows the actual selection code.
- Failed handoffs release only a still-owned seed. This avoids clearing another owner's lock, but a lost response after worker acceptance remains ambiguous. An idempotent handoff or acceptance readback is needed before requeueing can resolve that case.
HOW IT FITS TOGETHER
Architecture.
- The story pool records eligibility, lock owner and expiry. After selecting an eligible seed, the dispatcher conditionally claims it and reads back by external key, locked status and owner. Missing, multiple or mismatched rows stop allocation.
- The allocator reads the season registry and adds one to the maximum episode number, rolling over after ten episodes. It upserts metadata by the calculated episode key; that shared calculation is separate from ownership of the selected story.
- The dispatcher creates four pending frame records before handing work to the worker. Provider generation and storage use those episode and frame identities, so an artifact can be attached to the intended frame as it arrives.
- A rejected or unrecognized handoff response marks the episode failed. Recovery releases the source seed only if its key and owner still match, preserving another execution's claim while leaving lost-response acceptance to resolve.
Explore the architecture map9 components · 14 connections
Seed ownership, episode records and frame production
Dispatch prepares shared episode state before a worker renders frames; failed handoff has a source-lock recovery path.
Selection and handoff
Shared records
Frame production
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 (14)
- 01 · Story pool → 02 · Claim and verifyEligible candidate · Direct call
- 02 · Claim and verify → 01 · Story poolOwned lock · Direct call
- 02 · Claim and verify → 03 · Episode allocatorVerified claim · Direct call
- 04 · Episode registry → 03 · Episode allocatorSeason episode rows · Direct call
- 03 · Episode allocator → 04 · Episode registryUpsert episode · Direct call
- 03 · Episode allocator → 05 · Pending frame recordsPending placeholders · Direct call
- 05 · Pending frame records → 06 · Worker handoffPrepared frame context · Direct call
- 06 · Worker handoff → 07 · Frame workerEpisode request · Async task
- 07 · Frame worker → 08 · Image providerSubmit / poll · Async task
- 08 · Image provider → 07 · Frame workerFrame output · Response / return
- 07 · Frame worker → 09 · Stored frame assetsPersist output · Direct call
- 09 · Stored frame assets → 05 · Pending frame recordsResolve frame records · Direct call
- 06 · Worker handoff → 04 · Episode registryMark handoff failed · Blocked / denied
- 06 · Worker handoff → 01 · Story poolRelease matching owned lock · Direct call
MADE WITH
n8n · Apify · Data Tables · OpenAI · Grok · JavaScript · Notion
CHECKS & RESULTS
What was checked.
A source review shows what the code does. It is not a fresh test of the running app.
Code and development records reviewedReviewed
The code, tests and available development records were checked. Reported test results keep their original scope. No fresh app or live deployment check was run for this write-up.
- Scope of this check
- Code review, not a fresh run of the app
NEXT
Still to work through.
Preallocated frames make the episode easier to follow while generation is incomplete. The next tests need to cross the places where those records are shared: two simultaneous number allocations, then a worker that accepts a request whose response is lost. A per-story lock answers who owns the source; it doesn't answer either of those questions.