Skip to main content

Module threads

Module threads 

Source
Expand description

The order a post’s comments are shown in, and what a comment’s line costs a read.

One copy for the server and every client (CLAUDE.md rule 8): the server lists a thread’s stubs in this order and charges each line what the seed runner renders it to, and the runner renders the comments in it.

Structs§

ThreadPosition
One comment’s place in thread_order

Constants§

COMMENT_LINE_BYTES
What a full comment’s line costs beyond its author’s name, its parent’s and its body, the same way: its badges, date, id and punctuation
COMMENT_LINE_JSON_BYTES
The longest a full comment’s JSON gets beyond its name and body
DETACHED_NOTE_BYTES
What a line adds when its comment replies to one not in the read, which it then names
STUB_LINE_BYTES
What a stub’s line costs a read beyond its author’s name and its preview, as the seed runner renders it: its date, reply count, size, id and punctuation, at the deepest indent. Held against the rendering by its tests.
STUB_LINE_JSON_BYTES
The longest a stub’s JSON gets beyond its name and preview, for a reader of JSON to plan by. 280 since 0.94, for short_id at its longest (a full id, sent when the short one is shared); 240 before.

Functions§

preview
A stub’s preview: the first chars characters of body, cut back to the last word boundary when that keeps at least half of them, and marked … when anything was cut. Whitespace is collapsed, so a preview stays on its line.
thread_order
Depth-first thread order: roots by date, each followed by its replies, by date, recursively. A comment whose parent is not in items is a root. The sorts are stable, so undated items keep the order they came in.