[CF-4208] Add --page-size to on-prem Flink list commands - #3424
Draft
Paras Negi (paras-negi-flink) wants to merge 1 commit into
Draft
[CF-4208] Add --page-size to on-prem Flink list commands#3424Paras Negi (paras-negi-flink) wants to merge 1 commit into
--page-size to on-prem Flink list commands#3424Paras Negi (paras-negi-flink) wants to merge 1 commit into
Conversation
|
❌ Error getting contributor login(s). |
Copilot started reviewing on behalf of
Paras Negi (paras-negi-flink)
July 31, 2026 15:26
View session
There was a problem hiding this comment.
Pull request overview
This PR closes CF-4208 by adding user-facing pagination control (--limit) across on-prem Flink “list” commands and introducing flink application list filtering (--name, --status). It also refactors the CMF REST client to centralize paging behavior (including limit short-circuiting) and updates test server behavior plus integration fixtures accordingly.
Changes:
- Add a shared
--limitflag (default 0 = unlimited) to on-prem Flink list commands, applying it server-side where endpoints are paginated and client-side for non-paginated exception listing. - Add
--name/--statusfiltering toflink application listby composing CMF’s genericfilterquery parameter. - Refactor duplicated CMF paging loops into a generic
listAllPageshelper and add unit + integration coverage (with updated goldens).
Reviewed changes
Copilot reviewed 46 out of 47 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/test-server/flink_onprem_handler.go | Adds CMF applications filter query emulation in the test server. |
| test/flink_onprem_test.go | Adds integration coverage for --limit and application list filtering flags. |
| test/fixtures/output/flink/statement/list-limit-json.golden | New golden output for statement list with --limit. |
| test/fixtures/output/flink/statement/list-help-onprem.golden | Updates help golden to include --limit. |
| test/fixtures/output/flink/statement/list-env-missing-failure.golden | Updates failure/help golden to include --limit. |
| test/fixtures/output/flink/statement/exception/list-help-onprem.golden | Updates help golden to include --limit for exception list. |
| test/fixtures/output/flink/secret/list-help-onprem.golden | Updates help golden to include --limit for secret list. |
| test/fixtures/output/flink/secret-mapping/list-help-onprem.golden | Updates help golden to include --limit for secret-mapping list. |
| test/fixtures/output/flink/savepoint/list-help-onprem.golden | Updates help golden to include --limit for savepoint list. |
| test/fixtures/output/flink/savepoint/list-fail-both.golden | Updates failure/help golden to include --limit. |
| test/fixtures/output/flink/environment/list-help-onprem.golden | Updates help golden to include --limit for environment list. |
| test/fixtures/output/flink/detached-savepoint/list-limit-json.golden | New golden output for detached-savepoint list with --limit. |
| test/fixtures/output/flink/detached-savepoint/list-help-onprem.golden | Updates help golden to include --limit. |
| test/fixtures/output/flink/compute-pool/list-missing-env-flag-failure.golden | Updates failure/help golden to include --limit. |
| test/fixtures/output/flink/compute-pool/list-help-onprem.golden | Updates help golden to include --limit. |
| test/fixtures/output/flink/catalog/list-help-onprem.golden | Updates help golden to include --limit. |
| test/fixtures/output/flink/catalog/database/list-help-onprem.golden | Updates help golden to include --limit. |
| test/fixtures/output/flink/application/list-status-no-match-json.golden | New golden output for application list status filter no-match case. |
| test/fixtures/output/flink/application/list-status-filter-json.golden | New golden output for application list status filter match case. |
| test/fixtures/output/flink/application/list-name-filter-json.golden | New golden output for application list name filter case. |
| test/fixtures/output/flink/application/list-limit-json.golden | New golden output for application list with --limit. |
| test/fixtures/output/flink/application/list-limit-invalid.golden | New golden output for invalid --limit value. |
| test/fixtures/output/flink/application/list-help-onprem.golden | Updates help golden to include --name, --status, and --limit. |
| test/fixtures/output/flink/application/list-env-missing.golden | Updates env-missing output to include new flags in help text. |
| test/fixtures/output/flink/application/instance/list-help-onprem.golden | Updates help golden to include --limit for instance list. |
| test/fixtures/output/flink/application/instance-list-env-missing.golden | Updates failure/help golden to include --limit. |
| test/fixtures/output/flink/application/instance-list-app-missing.golden | Updates failure/help golden to include --limit. |
| test/fixtures/output/flink/application/event/list-help-onprem.golden | Updates help golden to include --limit for event list. |
| test/fixtures/output/flink/application/event-list-missing-flags.golden | Updates failure/help golden to include --limit. |
| test/fixtures/output/flink/application/event-list-app-missing.golden | Updates failure/help golden to include --limit. |
| pkg/flink/test/mock/cmf_client_mock.go | Updates generated CMF client mock for the new ListStatements(..., limit) signature. |
| pkg/flink/cmf_rest_client.go | Refactors paging into listAllPages and threads limit through CMF list calls. |
| pkg/flink/cmf_rest_client_test.go | Adds unit tests for listAllPages behavior across limits and paging scenarios. |
| internal/flink/command.go | Adds shared --limit flag registration and parsing helper (getLimit). |
| internal/flink/command_statement_list_onprem.go | Wires --limit into on-prem statement list via CMF client. |
| internal/flink/command_statement_exception_list_onprem.go | Adds --limit and truncates exceptions client-side for non-paginated endpoint. |
| internal/flink/command_secret_mapping_list.go | Wires --limit into secret-mapping list. |
| internal/flink/command_secret_list.go | Wires --limit into secret list. |
| internal/flink/command_savepoint_list.go | Wires --limit into savepoint list. |
| internal/flink/command_environment_list.go | Wires --limit into environment list. |
| internal/flink/command_detached_savepoint_list.go | Wires --limit into detached-savepoint list. |
| internal/flink/command_compute_pool_list_onprem.go | Wires --limit into compute-pool list. |
| internal/flink/command_catalog_list.go | Wires --limit into catalog list. |
| internal/flink/command_catalog_database_list.go | Wires --limit into catalog database list. |
| internal/flink/command_application_list.go | Adds --name/--status filtering and wires --limit into application list. |
| internal/flink/command_application_instance_list.go | Wires --limit into application instance list. |
| internal/flink/command_application_event_list.go | Wires --limit into application event list. |
Files not reviewed (1)
- pkg/flink/test/mock/cmf_client_mock.go: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+132
to
+141
| func getLimit(cmd *cobra.Command) (int32, error) { | ||
| limit, err := cmd.Flags().GetInt("limit") | ||
| if err != nil { | ||
| return 0, err | ||
| } | ||
| if limit < 0 { | ||
| return 0, fmt.Errorf("`--limit` must be a non-negative integer") | ||
| } | ||
| return int32(limit), nil | ||
| } |
The on-prem Flink (CPF/CMF) list commands loop over a hardcoded 100-item page size with no way to control it, so listing a large environment costs many serial round trips (~51 requests for 5000 applications). Add a --page-size flag to every paginated on-prem list command so callers can fetch the full list in fewer, larger requests. It defaults to 100, which preserves today's behavior and output. Collapse the 12 duplicated pagination loops in the CMF client into a single generic listAllPages helper that takes the page size. The requested size is passed through to the CMF page/size API; the loop still terminates on the first empty page. Server-side filtering for `application list` is deliberately left out and will follow in a separate PR stacked on this one. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
airlock-confluentinc
Bot
force-pushed
the
cli-cf-4208-flink-list-limit-filter
branch
from
August 2, 2026 08:38
bba9ac2 to
1ecbfcb
Compare
--limit pagination and application list filtering to on-prem Flink--page-size to on-prem Flink list commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The on-prem Flink (CPF/CMF) list commands paginate internally at a hardcoded
size=100and always fetch every page. Listing a large environment therefore costs many serial round trips — e.g. ~51 requests / ~35s for 5000 applications, where the UI does the equivalent in one request (see CF-4202).This PR adds a
--page-sizeflag to every paginated on-prem Flink list command, letting callers fetch the full list in fewer, larger requests (e.g.--page-size 5000→ ~1 round trip). It defaults to 100, so existing behavior and output are unchanged.Changes
--page-sizeflag on all paginated on-prem list commands (application list,application event/instance list,catalog list,catalog database list,compute-pool list,detached-savepoint list,environment list,savepoint list,secret list,secret-mapping list,statement list). SharedaddPageSizeFlag/getPageSizehelpers incommand.go(validates0..MaxInt32;0= default 100).listAllPages(pageSize, fetchPage)helper. The size is passed straight through to the CMFpage/sizeAPI; the loop still terminates on the first empty page.statement exception listis untouched — it hits a non-paginated endpoint, so--page-sizedoesn't apply.Scope / follow-up
application list(--name/--status, or a--filterpassthrough) is intentionally not in this PR. It will land as a separate PR stacked on this one, keeping pagination and filtering reviewable independently.--limit(cap results) was dropped as low-value.Compatibility
New optional flag, default
--page-size 0→ 100 per page → identical output to today. Non-breaking.Testing
listAllPages(default size, custom size, large size = fewer round trips, size > total, empty, error propagation).page/size, soapplication list --page-size 2genuinely fetches the 3-app list across multiple round trips and asserts the full, unchanged output.application list/statement list/detached-savepoint list --page-size, plus invalid--page-size -1. Help/error goldens regenerated.make lintpasses; full flink suite passes except the pre-existingTestFlinkShell/TestFlinkShellOnPremTUI tests (fail identically on a cleanmaincheckout).🤖 Generated with Claude Code