All work

AI Engineer · Oct 2025–present · Source private

YoLearn.ai

Recover the run. Preserve the result. Charge once.

Resumable tutoring runs, duplicate-payment protection, and fixes that keep generated content visible.

Live websiteyolearn.aiOpen site
YoLearn.ai website preview imageVisit yolearn.ai

This website opens in a new tab.

The problem

A teacher can lose a connection halfway through generation. A payment can arrive through two handlers. A completed stream can contain less information than the frames before it. I work across these boundaries so the product has a consistent answer about what happened.

What I worked on

A reconnect should find the same operation

An open connection is a fragile place to keep the identity of a long-running task.

I added resumable teacher runs with ordered Redis events and cursor-based replay. PostgreSQL retains the completed document and terminal settlement. When recent events have expired, the gateway returns a snapshot and an explicit gap instead of pretending it can replay everything.

The tradeoff The journal is bounded. Reconnecting restores a view of a run; it does not promise that every interrupted worker can continue generating.

Two payment handlers, one fulfillment

Webhook delivery and browser verification could race and create duplicate payment records.

I added transaction-scoped advisory locks, a second fulfillment check inside the transaction, and ledger idempotency checks. I also repaired the billing-history view to merge duplicate fragments while retaining distinct renewal payments.

The tradeoff Cleaning up the history view helps the user read it. The transaction guard protects the write; both need attention.

A completed frame must not erase an image

The UI could receive an image during streaming, then lose it when the final document carried an empty asset list.

I merged ready assets by stable identifier and preserved them across an empty terminal frame. I added a regression case that sends the same asset twice, completes with an empty list, and checks that the image remains.

A cache hit should stop generation

The full-length test pool looked up a cached paper under the wrong key and could fall back to generating another one.

I corrected the lookup and the cached response path, including both PDF links. The regression test makes generation throw if it is called on a valid cache hit—so an accidental fallback cannot pass unnoticed.

What I take forward

I start with a concrete failure path, trace it across services, and put a test at the point where the system previously lost its guarantee.

Read the engineering note
Next projectPrevio