Notes from the engine room.

Notes on building AI products that survive production: architecture, LLM pipelines, cloud infrastructure, and running small engineering teams.

Topics

All posts11 notes

  1. CHECK constraints guard states, not transitions

    A CHECK constraint can't stop a finished CI run from going back to queued, because it only sees the new row. A conditional UPDATE can. Here's the compare-and-swap pattern in Postgres, the read-then-write version that let 19 of 20 goroutines win, and two type errors along the way.

    6 min read · PostgreSQL, Go, Architecture

  2. My bot kept saying it was 2025. I had to tell it the date

    My Telegram bot's jokes kept naming the wrong year, even with a prompt rule against inventing dates. The model has no clock, so it guessed from its training data. Passing the post's date and today's date fixed it in about 40 lines.

    6 min read · AI, Go

  3. Killing `go test` doesn't kill the tests

    exec.CommandContext kills only the process it started. go test runs your tests in a child process, so a timeout either leaves orphans behind or hangs Wait, depending on how you call it. Here's what I measured and the four lines that fix it.

    5 min read · Go, Linux, CI

  4. Teaching my Telegram bot to complain with us, not about us

    I added /roast to my group-chat bot. The first version made fun of the wrong person, the second mocked the right one, and the one we kept roasts the situation instead. Plus what it took to get Claude running on Bedrock.

    9 min read · AWS, Go, AI

  5. A Postgres job queue in one statement, and what breaks when you remove each part

    UPDATE ... WHERE id = (SELECT ... FOR UPDATE SKIP LOCKED) is the standard Postgres job queue. I removed its parts one at a time: duplicate claims, workers that think the queue is empty, and a queue that runs in single file.

    6 min read · PostgreSQL, Go, Distributed Systems

  6. I built a bot that listens to my friends' voice messages so nobody else has to

    A Telegram bot that turns long voice messages and round videos into short, funny summaries. Two Go Lambdas, Amazon Transcribe, Nova Lite on Bedrock, and the small surprises along the way.

    14 min read · AWS, Go, AI

  7. `kubectl auth can-i` said my control plane couldn't read secrets. It read one anyway

    I locked down a Kubernetes CI worker and proved from inside a Pod that it couldn't read secrets. Then the control plane read one through a Job it was allowed to create. RBAC checks who sends a request, not what's in it. Here's how I closed the gap with a ValidatingAdmissionPolicy.

    11 min read · Kubernetes, Security, CI

  8. We stored a parsed tree of LLM output, and the UI stopped fixing broken Markdown

    Sky's frontend had 1,500 lines of code that repaired broken Markdown from the LLM. Then the backend started storing a parsed tree, the UI rendered it directly, and new content skipped every repair. Here's why the repairs belong on the server.

    6 min read · AI, Architecture, TypeScript

  9. Your Kubernetes Job's exit code is lying to you

    I made a Kubernetes Job fail three ways: a failing test, an OOM, and a deadline. All three ended as the same Failed, and two of them left no logs. Here's what I learned and how it shaped the result contract of a CI worker.

    8 min read · Kubernetes, CI, Architecture

  10. A missing `tx` deadlocked my service, and my test just hung

    I broke a Postgres transaction on purpose and expected a red test. The test hung instead. One query that skipped the transaction made every pool connection wait on another, and Postgres had no way to tell.

    5 min read · Go, PostgreSQL, Reliability

  11. Every deploy was quietly stranding SQS messages for 15 minutes

    An SQS message-age alarm fired on an empty queue. The cause: Sky's Node workers ignored SIGTERM, so each ECS deploy killed them mid-message. Here's how we traced it and the 60-line fix.

    5 min read · AWS, Node.js, Reliability