Build1 publisher2 min readPublished
A developer told Claude Code not to ship until billing worked against real infrastructure, so the agent stood up Postgres, Redis and both tiers on Render, bought a sandbox subscription, and hit a race the tests never posed.
The Engineer · Build desk

Compiled by The EngineerSomething wrong?How this is made
Underneath the sandbox failure is a check-then-act. Each handler ran a lookup for the subscription and created the row if the lookup returned nothing [10]. Interleave two of those and both reads come back empty, both insert, and the database accepts one while raising a unique constraint violation on the other [10]. The constraint did exactly its job, and the visible symptom was a webhook handler failing [11].
Per-event idempotency does not reach this failure. Replay-safety stops one event from applying twice, and says nothing about two different events converging on the same row [12]. The suite already covered webhook replay and duplicate credit protection [13], which is how it stayed green over a system that was wrong. Passing tests and working billing are related, though less closely than a release checklist implies.
The fix is unclever in the right way. Attempt the insert, let the unique constraint pick a winner, wrap the losing insert in a SAVEPOINT opened with `session.begin_nested()`, roll back that inner operation only, re-read the row the winner created, and continue processing [14][20]. According to the developer, skipping that isolation lets the collision poison the larger transaction and interfere with the rest of the webhook processing [15]; with it, the losing handler discovers the subscription another handler created and proceeds instead of becoming an error path [16]. No application-level lock was added [17].
The adoption cost sits in the provisioning, not the prompt. One verification run creates five resources: Postgres, Redis, the backend and the frontend on Render through its API [4], plus a temporary Paddle sandbox webhook destination aimed at that deployment [5][18]. Moving the loop to another codebase depends on Paddle supplying a sandbox that delivers real webhooks to an arbitrary URL [5], on Render supplying environment creation over an API [4], and on the webhook destination being configuration the agent could rewrite per environment rather than a constant [5].
The overlap was observed in the Paddle sandbox [9], and the account gives no measure of how often production delivers those two events concurrently. The frequency is unknown even where the fix stands, which means a race that can be reproduced in the sandbox is one the handlers still have to survive in production. The run itself is also unpriced, with no dollar cost, wall-clock time or token count reported [19]. In my context the trade is still worth making, because the ordering assumption between handlers was the one thing the test suite never challenged [13], and a real provider invalidated it on the first attempt [9].
Ranked by verification strength, evidence, and original report placement.
The developer stopped defining done as "implementation finished, tests passing" and instead gave the coding agent an external condition: do not let me ship until you can prove that billing works end-to-end against real infrastructure. The agent used was Claude Code.
The SaaS project uses FastAPI, Next.js, Postgres, Redis, Celery and Paddle.
Billing already had tests around checkout, webhook processing, subscriptions, credit grants and idempotency, and those tests were green.
The agent provisioned temporary infrastructure on Render through the API: Postgres, Redis, the backend and the frontend.
The agent configured a temporary Paddle sandbox webhook destination pointing at that deployment.
The agent authenticated through the app, opened checkout, completed a Paddle sandbox payment and inspected the resulting state rather than only the HTTP response or redirect.
Follow any of these and your For You feed starts watching them — no settings page required.
Evidence-backed comparisons of source perspectives and observed adoption signals. Read the methodology
Which Builder, Operator, and Investor concerns the observed source mix emphasized—not a truth score.
Evidence, demonstrated adoption, hype gap, incentives, and confidence are assessed independently, each on its own current evidence. How these are measured.
One practitioner, no artifacts
The technical core is specific in a way that invites checking: a named stack, the exact handler shape, an interleaving of two SELECTs and two INSERTs, and a snippet using session.begin_nested() with an IntegrityError fallback. None of it is attached to a commit, a log line or a repository, and the only corroboration is the author's own second run, where the webhook events arrived in the reverse order and the state still came out right.
One project, one release
The disclosed footprint is a single developer's SaaS release and the five temporary resources one verification run created. No other team, product or tool vendor is reported as working this way, and the practice is described in the past tense of one project rather than as a standing part of anyone's pipeline.
Restrained telling, unpriced lesson
The writing stays close to what it can show and even narrows its own claim, since the author distinguishes this race from the idempotency case his tests already covered. The gap is in what travels: the recommendation to make an agent prove the money path against real infrastructure is offered as generally useful while its cost, duration and token consumption go unstated, and the overlapping delivery that exposed the bug was observed in a sandbox.
Reputational, no disclosed vendor stake
This is a personal dev.to byline with nothing being sold in the post and no sponsorship declared. Claude Code, Render and Paddle all come off well and none of the relationships is characterised, which is the pressure worth naming, alongside the ordinary return an indie developer gets from publishing a clean war story.
Internally consistent, externally unchecked
The chain holds together from green tests to the constraint violation to the nested-transaction fix, and the specificity makes fabrication unlikely. What keeps confidence middling is structural: a single author working on a single project in one sandbox, with no independent account of either the race or the outcome.
build
NocoBase documents an AI kernel role for itself thirteen alphas before the 3.0 announcement1 publisher
build
Edge KV puts the permission check an hour behind the Postgres row1 publisher
build
A RAG stack lived seven hours before a hosted embedding endpoint returned 4041 publisher
build
Queue arithmetic explains the 47-second wait in a collapsed LLM prototype1 publisher
Publishers with included, body-backed reporting in this cluster.
1 article · September 8, 2026