Watch
0
0
Fork
You've already forked hyperhive
0

hive-forge: page past the forge's 50-row clamp; show list --json truncation

The forge clamps page_size to 50. branches, pr reviews, the review
bodies merged into `comments <pr>`, and view's comment list each sent
one request, so anything past the first page was dropped silently.
labels::repo_labels did loop, but asked for 100/page and stopped on
`len < 100`, so a clamped full page of 50 ended the walk.

Add verbs::all_pages: requests 50/page until a short page, capped at
50 pages with a stderr warning when the cap is hit. Use it in all of
the above; repo-labels now calls labels::repo_labels instead of its
own copy of the loop.

list --json now prints the same "N of M shown" stderr trailer as the
pretty output; its paging and stdout shape are unchanged.

Closes #5051
This commit is contained in:
atlas 2026-10-09 11:44:03 +02:00 • committed by mara
commit 0e5c61d12c
9 changed files with 164 additions and 90 deletions

View file

@ -173,10 +173,20 @@ pub fn run(client: &Client, args: Args) -> Result<()> {
.page_size(u32::try_from(args.limit).unwrap_or(u32::MAX))
.send()?;
let count = issues.len() as u64;
let note = trailer(
headers.x_total_count.and_then(|t| u64::try_from(t).ok()),
count,
args.page,
args.limit,
);
let mut items = serde_json::to_value(issues)?;
if client.json_mode() {
hoist_merge_state(&mut items);
return print_json(&items);
print_json(&items)?;
if let Some(msg) = note {
eprintln!("{msg}");
}
return Ok(());
}
for item in items.as_array().into_iter().flatten() {
let number = item.get("number").and_then(Value::as_u64);
@ -192,12 +202,7 @@ pub fn run(client: &Client, args: Args) -> Result<()> {
blocks.as_deref().map_or(0, blocking_open_count),
);
}
if let Some(msg) = trailer(
headers.x_total_count.and_then(|t| u64::try_from(t).ok()),
count,
args.page,
args.limit,
) {
if let Some(msg) = note {
eprintln!("{msg}");
}
Ok(())