Field notes — essays & research notes

Things I've written down.

Ruby, Rails, performance, security and applied machine learning. Updated when something feels finished.

51 posts · page 2 of 6
SECURITY 07 / 25 / 26

Prompt injection isn't XSS, but it rhymes

Both come from mixing instructions with data. The difference is that there is no escaping function for English.

3 min
RUBY & RAILS 07 / 22 / 26

Where Rails memory actually goes

Your app is not leaking. Ruby freed the memory and the allocator kept it. Arenas, fragmentation, and the two environment variables that fix most of it.

4 min
SECURITY 07 / 18 / 26

What's actually in your session cookie

Rails signs the session cookie, so users can read it but not forge it. That distinction decides what may go in it.

2 min
RUBY & RAILS 07 / 15 / 26

Your connection pool is probably wrong in one of two directions

ActiveRecord::ConnectionTimeoutError and "too many connections" are the same mistake made in opposite directions. The arithmetic is simple.

3 min
RUBY & RAILS 07 / 08 / 26

What belongs in a job, and what belongs in the request

Moving work to a background job doesn't make it faster. It moves who waits, and sometimes that's the wrong trade.

3 min
SECURITY 07 / 04 / 26

Your dependencies are your attack surface

A modest Rails app pulls in a hundred-odd gems and several hundred transitive ones. Almost none were chosen by anyone.

2 min
RUBY & RAILS 06 / 30 / 26

The 55% page-load win was four queries and a cache key

Cutting clinical-study page loads by more than half under real traffic. Not a rewrite — profiling, eager loading, and one honest look at what was cacheable.

4 min
LLM & AGENTS 06 / 27 / 26

Chunking is a retrieval decision, not preprocessing

How you split documents determines what is findable. Everything downstream inherits that choice, and almost nobody measures it.

3 min
RUBY & RAILS 06 / 24 / 26

Everything that runs before your controller

A Rails request passes through twenty-odd middleware before your code sees it. Knowing the stack turns a class of mystery into a list.

2 min