Stateless HMAC Auth in Next 16: The Quiet Rename That Burned Me
Next 16 killed middleware.ts. The replacement is proxy.ts — and it needs to live beside your app/ folder, not at the project root. I learned
A lab notebook: what I'm learning while building with AI, written as I go.
Next 16 killed middleware.ts. The replacement is proxy.ts — and it needs to live beside your app/ folder, not at the project root. I learned
When you hit a ContactId cannot be null or empty 400 from Xero (the accounting platform), the tempting fix is blind-create. Don't. Find-or-create the
At batch LLM scale, a 1–3% flake rate isn't rare — it's guaranteed. Wrap every client.messages.create() call in a retry loop, and strip empty defaul
Never build a dedup key out of fields your model generates. It'll regenerate them differently every run. Hash the raw content — the one thing that
If you're placing N nodes on a canvas by accumulating a running offset, stop. Compute position from index. It's deterministic, it's idempotent, and
For text RAG, default to OpenAI text-embedding-3-small. Competitive quality, you probably already have the key, one fewer billing surface. Voyage
When your RAG corpus has multiple source kinds, make sourcekind a first-class column from day one. The unit of rebuild should match the unit of c
I spent two archive sweeps chasing a token cap that was never actually costing me anything. 9% reduction. The cap was aspirational. My session budge
One LLM call per visual block, not one per page. The pattern library was a dead end.
Strip sensitive content before it hits your vector DB — not at query time. One LLM pass at ingest beats a thousand prompt instructions at retrieval.
Liquid won't let you run a filter inside an {% if %} condition. Assign the result to a variable first, then compare. Simple — except your LLM will get
If your iMessage agent marks its own sends with a zero-width joiner (U+200D) and uses str.isprintable() to walk decoded attributedBody blobs —
If you're reading a live-written SQLite database you don't own, open it with mode=ro — NOT immutable=1. The difference is subtle, the failure is bru
The Setup
A Content Security Policy isn't just a list of trusted domains. It's a matrix of domains × resource types — and one missing intersection means a bla
useState updates are async. If you call a function in the same tick as setState, that function reads the old value. Use a useRef alongside
Running unrelated migrations triggers a PostgREST schema cache reload. If any of your embeds have latent FK ambiguity, that reload will enforce it — and
will-change: transform, translate3d, and backdrop-filter each create a new GPU compositing layer. On a drag-and-drop board, that silently kills dr
If your LLM pipeline feeds untrusted external content to a model, you need to (1) fence your instructions away from that content and (2) place your
If you pass secrets to a subprocess as command-line arguments, every other process on the box can read them with ps aux. Pass them via stdin inste
The Setup
Don't add E2E after you fix the board. Add it first — so you can actually fix the board.
SWR's revalidateOnFocus, revalidateOnReconnect, and revalidateIfStale are all true by default. On a drag-and-drop board, that's lethal. Wrap
Every background daemon you ship needs a RotatingFileHandler. One line. Five minutes. Your disk will thank you.
Centralize your retry/backoff in one shared runner. And never, ever retry a timeout — it just doubles your wait.
Running autonomous agent cycles in the same session means every new cycle has read the prior ones. By Cycle 5 they stop catching bugs and start agre
Don't check for required env vars when you need them. Check at boot — before anything else touches them. Silent missing-config bugs are the worst
When Pydantic is validating LLM output, extra='forbid' is the wrong default. Switch to extra='ignore' — and wrap each item in its own try/except.
dnd-kit's closestCenter is a geometry function. It doesn't know what you mean. When you have nested droppables, you have to write that intent yourse
claude -p --output-format json does NOT hand you the model's JSON. It wraps it in an envelope. The model's text lives inside a .result field — a