docs(cli): name the server path --depth-limit selects and the root's extra row

Two measured facts about `messages thread` that its flags do not suggest,
both surfaced in review.

The relay reads the thread cursor only on the depth-limited server path
(bridge.rs:1155 `extract_depth_limit ... None => continue`), so
`--depth-limit` selects WHICH server code path serves the request. That
is why a cursor without an explicit depth bound sends the sentinel; the
help now says so rather than leaving it as an implementation detail.
Verified on the built binary: `--after 1786800000` returns n=1 with no
`--depth-limit`, so the sentinel does reach the cursor, and
`--after 1785163671` returns 21 of the thread's 44 replies.

The root arrives on a second filter carrying no cursor, no depth bound
and its own `limit: 1`, so it is un-budgeted: a page holds `--limit`
replies PLUS the root, and the root reappears on every page. Measured at
caps 3/5/11 — n = cap+1 each time, and the page-to-page id overlap is
exactly the root and nothing else. Callers concatenating pages must
dedupe it. Also measured: `--limit N --depth-limit 5` returns N+1 for
N in {1,2,5,10}, and `--depth-limit 0` returns the root alone.

Co-authored-by: Sami <f4a42a97e594b77bdbd8ee35191c8b28a94a4cb871d96f32921558275421fb68@buzz.block.builderlab.xyz>
Signed-off-by: Sami <f4a42a97e594b77bdbd8ee35191c8b28a94a4cb871d96f32921558275421fb68@buzz.block.builderlab.xyz>
This commit is contained in:
Sami
2026-08-15 21:14:20 -04:00
parent da612711cf
commit de99e5c100

View File

@@ -488,7 +488,7 @@ pub enum MessagesCmd {
},
/// Get a message thread (replies to a root message)
#[command(
after_help = "Pagination:\n Returns up to --limit replies (default 100, max 500) plus the root event.\n Replies without a cursor and without --depth-limit are NEWEST-first; either\n one selects the OLDEST-first walk, so the cursor picks which end you see.\n\n To page a thread larger than the cap, walk FORWARD from the oldest reply.\n Seed with --after 0, then pass the newest reply of each page back in:\n\n buzz messages thread --channel <UUID> --event <ID> --limit 500 --after 0\n buzz messages thread --channel <UUID> --event <ID> --limit 500 \\\n --after <created_at of newest reply seen> --after-id <its event id>\n\n Always pass --after-id. The timestamp-only cursor is STRICTLY greater-than,\n so a page boundary landing inside a second shared by several replies skips\n the rest of that second silently (rc=0). --after-id carries the tiebreak, so\n no reply is skipped regardless of where the boundary lands.\n\nKind scope:\n Replies are limited to kinds 9,40002,40003,40008,45003 (message, message\n v2, edit, diff, forum comment) and NOTHING ELSE. Notably EXCLUDED:\n reactions (7) and deletions (5) — on a busy thread these outnumber the\n replies, and no flag here surfaces them, so a reply count is not a thread\n event count. This list intentionally differs from `messages get`, which\n omits edits (40003) and includes forum posts (45001)."
after_help = "Pagination:\n Returns up to --limit replies (default 100, max 500) plus the root event.\n Replies without a cursor and without --depth-limit are NEWEST-first; either\n one selects the OLDEST-first walk, so the cursor picks which end you see.\n\n To page a thread larger than the cap, walk FORWARD from the oldest reply.\n Seed with --after 0, then pass the newest reply of each page back in:\n\n buzz messages thread --channel <UUID> --event <ID> --limit 500 --after 0\n buzz messages thread --channel <UUID> --event <ID> --limit 500 \\\n --after <created_at of newest reply seen> --after-id <its event id>\n\n Always pass --after-id. The timestamp-only cursor is STRICTLY greater-than,\n so a page boundary landing inside a second shared by several replies skips\n the rest of that second silently (rc=0). --after-id carries the tiebreak, so\n no reply is skipped regardless of where the boundary lands.\n\nServer path and counts:\n The cursor is honoured only on the depth-limited server path; a filter\n without a depth bound routes to a generic query that has no cursor. So\n --depth-limit selects WHICH server code path serves the request, which\n its name does not suggest. Passing --after implies a depth bound meaning\n \"no effective limit\" so the cursor is always reached.\n\n The root event is fetched by a SECOND filter that carries no cursor, no\n depth bound and its own limit of 1. It therefore reappears on every page\n and does not consume a reply slot: expect --limit + 1 events per page,\n and dedupe the root when concatenating pages.\n\nKind scope:\n Replies are limited to kinds 9,40002,40003,40008,45003 (message, message\n v2, edit, diff, forum comment) and NOTHING ELSE. Notably EXCLUDED:\n reactions (7) and deletions (5) — on a busy thread these outnumber the\n replies, and no flag here surfaces them, so a reply count is not a thread\n event count. This list intentionally differs from `messages get`, which\n omits edits (40003) and includes forum posts (45001)."
)]
Thread {
/// Channel UUID
@@ -497,11 +497,14 @@ pub enum MessagesCmd {
/// Root message event ID (64-char hex)
#[arg(long)]
event: String,
/// Maximum number of replies to return (default 100, max 500)
/// Maximum number of replies to return (default 100, max 500).
/// The root event arrives on its own filter, so a page holds
/// --limit replies PLUS the root
#[arg(long)]
limit: Option<u32>,
/// Maximum reply nesting depth to include. Also selects the
/// oldest-first reply ordering (see Pagination below)
/// oldest-first reply ordering and the cursor-capable server path
/// (see Pagination below)
#[arg(long)]
depth_limit: Option<u32>,
/// Unix timestamp cursor — return replies created after this time