How a conversation is drawn
Opening a reply used to show you a post floating on its own, above a line naming somebody whose words you could not read. Here is the shape that replaced it, and why each limit exists.
Easybie used to read one level in each direction from whatever post you opened, and that was the entire extent of threading.
The result was strange in two ways. Opening a reply gave you a post on its own above a line reading "Replying to @maja" — with no way to see what Maja had actually said. And a reply to a reply appeared on no page at all. It was written, stored, and counted in a total, reachable only by somebody who already had its address.
The shape
Above the post you opened: the whole chain of what it is answering, folded in the middle when it gets long.
Below it: two levels of replies. The second level starts folded and opens when you ask for it. Anything deeper opens on that reply's own page.
Why the middle folds, and not the top
When a chain is long, the parts worth keeping are the two ends.
The root started the conversation — you need it to know what any of this is about. The last two are what the post you opened is directly answering. The ones in the middle are, almost by definition, the ones nobody opened the page to read.
So the fold takes the middle out and leaves the beginning and the immediate context. It appears once a chain reaches five, and it says how many it is hiding.
It stops at the first thing you cannot see
If somewhere up the chain there is a post you are not allowed to read — deleted, hidden, from a private account — the page stops there and says why it stopped.
The alternative is worse than it looks. Carrying on and drawing the public root above the gap would confirm that a private reply sits between the two, which is precisely the fact the privacy setting exists to withhold. Skipping over something is not neutral; it is a statement about what is there.
A deleted parent, incidentally, is an ordinary state rather than a fault. A reply outlives the post it answered on purpose — otherwise deleting one post would silently delete other people's writing.
Two ceilings, both deliberate
Each opened reply shows up to eight of its own replies, and at most twelve sub-threads can be open at once. Open a thirteenth and the oldest closes rather than the button refusing to work.
The "see the rest" link counts from the reply's own total, not from how many happened to load. That sounds obvious and it is exactly the sort of thing that goes wrong: a card claiming four hundred replies above a list that fetched eight, with a link that thinks there are none left.
The query nobody wrote
There is a faster way to do all of this — a single recursive query that both databases Easybie can run on support perfectly well.
It is not used. It would be the only hand-written SQL in the entire application, and the posts still have to be loaded and permission-checked one at a time afterwards, so most of the saving evaporates. The chain is walked one lookup at a time, capped at thirty.
If conversations ever get genuinely deep, that is the change to make, and it is written down as such rather than discovered later by somebody wondering why the page is slow.
The bug found on the way
Worth recording because of how quiet it was.
The thread page loaded reply authors with a specific list of columns, and that list left out the one saying whether an author had asked for their follower counts to be hidden. The card that draws each reply checks that setting and treats a missing value as "no".
So every reply on every thread page showed the counts of authors who had explicitly asked for them to be hidden. Nothing was broken, nothing threw an error, and the setting worked perfectly everywhere else on the site.
Any future change that loads authors needs that column. It is in the code as a comment, which is the only place a lesson like that survives.