growthbook / growthbook/cli

Pagination 'more pages available' hint prints after every list (Next closure always non-nil)

Open
#24 0 comments 0 reactions 0 assignees View on GitHub
bug custom
Dominant language
Go
Stars
1
Forks
0
Avg merge
1d 5h
Merged PRs (30d)
18

Description

## Bug

The per-command hint `Hint: more pages available. Use --all ...` prints to stderr after **every** list command — even when the response has `hasMore: false` / `total: 0`, and even after `--dry-run` (which sends no request). It trains users to ignore it.

## Root cause (Speakeasy)

The generated SDK assigns `res.Next = func() {...}` **unconditionally** on every list response (the closure only returns `nil, nil` when actually *called*). The generated pagination helper `output.HasMorePages` only checked `Next != nil`, so it was always true.

## Stopgap fix (retire when upstream is fixed)

`.speakeasy/patches/internal/output/paginated.go.patch`: `HasMorePages` now reads the response body's own `Object.HasMore` bool (via the existing `extractFieldByPath`) instead of the `Next` closure. Returns false when the body wasn't deserialized (raw-JSON / `--dry-run`).

**To retire:** once the generated `HasMorePages` keys off the real hasMore flag (or `Next` is assigned only when a next page exists), drop the patch.

## Refs

- Introduced by #23
- Upstream: file to speakeasy-api/speakeasy (generated pagination helper / `Next` closure).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with .speakeasy/patches/internal/output/paginated.go.patch and inspect HasMorePages and its use by the per-command hint. Verify behavior for responses with hasMore: false, total: 0, raw JSON, and --dry-run; done means the hint appears only when another page exists, or the patch can be retired once the generated helper handles that flag.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.