Skip to content

feat(list): warn on 'helm list' truncation with default --max limit - #31887

Closed
john-weathers wants to merge 2 commits into
helm:mainfrom
john-weathers:feat/list-truncation-indicator
Closed

john-weathers wants to merge 2 commits into
helm:mainfrom
john-weathers:feat/list-truncation-indicator

Conversation

@john-weathers

Copy link
Copy Markdown

What this PR does / why we need it:

This PR adds a warning to helm list when results are truncated due to the default --max limit (only when the user has not explicitly set --max).

Currently, helm list silently truncates results (default max=256), which can make it appear as if releases are missing. This change improves clarity by informing users that more results may exist.

The warning:

  • is printed to stderr
  • only applies to table (default) output
  • does not affect JSON/YAML or other machine-readable formats
  • is only shown when truncation is caused by the default limit

My intention in printing the warning to stderr and limiting it to table output was to preserve backward compatibility of structured and machine-readable output.

Closes #31617

Special notes for your reviewer:

  • Implemented via a Truncated field in the action List struct
  • No changes to existing CLI flags or output formats
  • Manually tested with large (>256) release sets using --max and --offset
  • Unit tests added to cover truncation scenarios

If applicable:

  • this PR contains user facing changes (the docs needed label should be applied if so)
  • this PR contains unit tests

add a stderr warning when results are truncated by the default --max limit.

Closes helm#31617

Signed-off-by: John Weathers <[email protected]>
Copilot AI review requested due to automatic review settings February 27, 2026 21:13
@pull-request-size pull-request-size Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds user-facing visibility to helm list pagination by tracking whether results were truncated by the default --max limit and emitting a warning for human-readable (table) output.

Changes:

  • Introduces a Truncated field on the action.List struct and sets it during pagination/truncation.
  • Updates helm list command to emit a stderr warning when truncation occurs due to the default --max (only for table output and only when --max wasn’t explicitly set).
  • Adds unit tests to validate truncation detection across limit/offset scenarios.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
pkg/cmd/list.go Prints a truncation warning after table output when default --max causes truncation.
pkg/action/list.go Tracks truncation state in the list action via a new Truncated field.
pkg/action/list_test.go Adds unit coverage for truncation behavior across multiple limit/offset combinations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/cmd/list.go Resolved
Comment thread pkg/action/list.go Resolved
Comment thread pkg/action/list_test.go Resolved
Comment thread pkg/action/list.go Resolved
@promptless-for-oss

Copy link
Copy Markdown

📝 Documentation updates detected!

New suggestion: Document helm list --max and --offset flags in CheatSheet


Tip: Configure how Promptless handles changelogs in Agent Settings 📋

Reset Truncated on each Run(), use cmd.ErrOrStderr(), and reorder tests
to cover early-return stale state.

Signed-off-by: John Weathers <[email protected]>

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@john-weathers

Copy link
Copy Markdown
Author

Hi @gjenkins8, just wanted to follow up here since you helped triage the issue associated with this. It looks like this PR needs an additional review. I wanted to check if you could take a look or if you could suggest someone for a second review. Thanks!

@StantonMatt StantonMatt left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a local validation pass on 1f77d24a.

The focused limit/truncation tests pass:

go test ./pkg/action -run 'TestList_(Truncation|Limit|LimitOffset|LimitOffsetOutOfBounds)$' -count=1
go test ./pkg/cmd -run 'TestList(Cmd|OutputFormats|StatusMapping|CustomTimeFormat)?$' -count=1

I also ran the touched packages together:

go test ./pkg/action ./pkg/cmd -count=1

That passed as well. To check the command-level behavior directly, I ran a temporary local probe with 257 in-memory deployed releases: plain list emitted the new default-limit warning, while list --max 256 and list --output json did not. I removed the probe afterward, and git diff --check origin/main...HEAD is clean.

The current shape looks right to me: the action layer tracks whether pagination actually omitted results, the command only warns for table output when the user did not explicitly set --max, and the warning goes through Cobra's stderr stream. I do not see a blocker from this pass.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

This pull request has been marked as stale because it has been open for 90 days with no activity. This pull request will be automatically closed in 30 days if no further activity occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files. Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show if more search results are present

5 participants