From 7d31b7def4018aafa29624ee3bdab8cf746403a0 Mon Sep 17 00:00:00 2001 From: damocles Date: Sun, 31 May 2026 14:11:11 +0200 Subject: [PATCH] =?UTF-8?q?hive-forge:=20warn=20when=20--tail=20saturates?= =?UTF-8?q?=20the=20pagination=20cap=20(argus=20=F0=9F=9F=A1=20on=20#770)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hive-forge/src/verbs/comments.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/hive-forge/src/verbs/comments.rs b/hive-forge/src/verbs/comments.rs index 7a2d72ec..3779a809 100644 --- a/hive-forge/src/verbs/comments.rs +++ b/hive-forge/src/verbs/comments.rs @@ -92,12 +92,29 @@ fn fetch_head(client: &Client, repo: &str, number: u64, limit: u64) -> Result/comments` oldest-first so the trailing slice maps /// directly to "most recent N". +/// +/// When the fetch saturates `TAIL_MAX_PAGES` (i.e. all 20 pages came +/// back full at 50/page) we can't tell whether more comments exist +/// upstream. Surface a stderr warning so the caller knows the +/// "tail" is anchored to the first 1000 comments, not necessarily +/// the actual newest of the thread. False positive: a thread with +/// EXACTLY 1000 comments will warn even though the slice IS the +/// real tail — acceptable noise given how rare 1000-comment threads +/// are (closes argus 🟡 on PR #770). fn fetch_tail(client: &Client, repo: &str, number: u64, n: usize) -> Result> { let all = client.get_json_all( &format!("/repos/{repo}/issues/{number}/comments?limit=50"), TAIL_MAX_PAGES, )?; let total = all.len(); + if total >= TAIL_MAX_PAGES as usize * 50 { + eprintln!( + "warning: hit pagination cap ({TAIL_MAX_PAGES} pages × 50 = \ + {total} comments); --tail slice is anchored to the first \ + {total} comments and may not include the actual newest of \ + the thread." + ); + } if total <= n { return Ok(all); }