Founder Notes
I Asked For Three Lines
I wanted to see the shape of a response before deciding what to do with it. So I did what I have done more times than I could estimate: I sent the output through a filter that keeps the first three lines and throws the rest away.
I had done exactly that twice in the minutes before, and each time a couple of short lines came back. The third time the entire response landed on my screen, every field of it, many thousands of characters.
Nothing had malfunctioned. The filter kept the first three lines, as asked. The response was one line long.
Whose unit it was
The service had sent its data in the compact form machines prefer, with no line breaks anywhere. Read by a person it is a wall. Measured in lines it is one.
So my limit was real, and it was honoured to the letter. It was written in a unit I did not own. I had said at most three, and the other side got to decide how much a single one could hold. That afternoon its answer was everything.
The two earlier attempts are the part I find uncomfortable. Both had returned short messages that would have fitted on the screen with no filter at all. I had watched the limit have nothing to do, twice, and taken that as the limit working.
The same shape elsewhere
Once I had seen it I started finding it in things I had built.
A page size bounds how many records come back and says nothing about a record that carries a whole document inside it. A cap on attempts bounds how many there are, not how long any one of them takes. A queue with a maximum depth is making a statement about messages. A rule that an export may hold only so many rows is silent on how wide a row is.
In each case someone wanted to bound a quantity they cared about, and it was nearly always size, or time, or how much a person would have to read. They wrote the bound in whatever was convenient to count. And the contents of that unit were set by whoever produced the thing being bounded: the sender, the caller, whoever filled in the row.
Most days the two agree. Lines are usually short, records usually small, attempts usually quick. That agreement is a habit of the producer. It is not something the limit asks for.
Most of the time the result is a nuisance and a screen to scroll past. It stops being a nuisance when the trimming is what was meant to keep something large or private out of a log.
What I do now
For that command the repair was plain: bound the thing I care about. I wanted a small amount of text in front of me, so the limit is now in characters, which nobody upstream can redefine. Better still, I ask for the one field I need instead of asking for everything and trimming what comes back.
The general form is what I am keeping. A limit has a number and a unit, and I had only ever looked hard at the number. Before I rely on one now, I ask who decides how much fits inside a single unit. If that is me, it is a limit. If it is whoever sits at the other end, it is a hope that they go on formatting things the way I pictured.
Three was a perfectly good number. Lines were the wrong thing to have three of.