Skip to content

simplify: use ResolveRequestPageSize helper in eventgateway fetch functions#880

Merged
rspurgeon merged 3 commits intomainfrom
copilot/simplify-eventgateway-fetch-functions
Apr 24, 2026
Merged

simplify: use ResolveRequestPageSize helper in eventgateway fetch functions#880
rspurgeon merged 3 commits intomainfrom
copilot/simplify-eventgateway-fetch-functions

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 24, 2026

PR #865 introduced common.ResolveRequestPageSize(cfg) to encapsulate the repeated page-size resolution pattern but left 8 eventgateway/adopt files using the duplicated 3-line inline block, and getEventGateway.go missing the < 1 fallback guard entirely (risking pageSize=0 sent to the API).

Changes

  • 7 eventgateway fetch functions (backend_clusters, virtual_clusters, listeners, data_plane_certificates, schema_registries, static_keys, tls_trust_bundles): replace duplicated inline block with helper
  • adopt/event_gateway.go: replace int-typed block + int64() cast with helper (already returns int64)
  • getEventGateway.go: fix missing < 1 guard — bare int64(cfg.GetInt(...)) could pass pageSize=0 to the API
// Before (repeated in 7+ files):
requestPageSize := int64(cfg.GetInt(common.RequestPageSizeConfigPath))
if requestPageSize < 1 {
    requestPageSize = int64(common.DefaultRequestPageSize)
}

// After:
requestPageSize := common.ResolveRequestPageSize(cfg)

No functional changes — the helper is a direct extraction of the inline logic.

Copilot AI changed the title [WIP] Simplify fetch functions by using ResolveRequestPageSize helper simplify: use ResolveRequestPageSize helper in eventgateway fetch functions Apr 24, 2026
Copilot AI requested a review from rspurgeon April 24, 2026 02:50
@rspurgeon rspurgeon marked this pull request as ready for review April 24, 2026 14:18
@rspurgeon rspurgeon requested review from a team as code owners April 24, 2026 14:18
Copilot AI review requested due to automatic review settings April 24, 2026 14:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors Konnect Event Gateway listing/fetching code to use the shared common.ResolveRequestPageSize(cfg) helper, reducing duplicated pagination page-size resolution and ensuring the Event Gateway list call won’t send pageSize=0 when unset/invalid.

Changes:

  • Replace repeated inline page-size fallback logic with common.ResolveRequestPageSize(cfg) across Event Gateway fetch functions.
  • Update Event Gateway adopt flow to use the shared page-size helper (and remove redundant int/int64 conversions).
  • Apply small gofmt/goimports formatting adjustments in a handful of related files.

Reviewed changes

Copilot reviewed 11 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/theme/theme.go Minor formatting alignment in var block.
internal/declarative/resources/portal_team.go Minor struct field alignment formatting.
internal/declarative/resources/explain.go Minor struct field alignment formatting.
internal/declarative/planner/event_gateway_tls_trust_bundle_planner_test.go Multi-line function signature formatting.
internal/declarative/planner/env_placeholders_test.go Minor map literal alignment formatting.
internal/cmd/root/verbs/scaffold/scaffold.go Constant alignment formatting.
internal/cmd/root/products/konnect/eventgateway/backend_clusters.go Use ResolveRequestPageSize in backend cluster pagination setup.
internal/cmd/root/products/konnect/eventgateway/virtual_clusters.go Use ResolveRequestPageSize in virtual cluster pagination setup.
internal/cmd/root/products/konnect/eventgateway/listeners.go Use ResolveRequestPageSize in listeners pagination setup.
internal/cmd/root/products/konnect/eventgateway/data_plane_certificates.go Use ResolveRequestPageSize in data plane certs pagination setup.
internal/cmd/root/products/konnect/eventgateway/schema_registries.go Use ResolveRequestPageSize in schema registries pagination setup.
internal/cmd/root/products/konnect/eventgateway/static_keys.go Use ResolveRequestPageSize in static keys pagination setup.
internal/cmd/root/products/konnect/eventgateway/tls_trust_bundles.go Use ResolveRequestPageSize in TLS trust bundles pagination setup.
internal/cmd/root/products/konnect/eventgateway/getEventGateway.go Use ResolveRequestPageSize to ensure page size fallback guard is applied.
internal/cmd/root/products/konnect/eventgateway/cluster-policies.go Import ordering adjustment (goimports).
internal/cmd/root/products/konnect/adopt/event_gateway.go Use ResolveRequestPageSize for adopt flow pagination.

Comment thread internal/cmd/root/products/konnect/adopt/event_gateway.go Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@rspurgeon rspurgeon temporarily deployed to kongctl-acceptance-4 April 24, 2026 14:27 — with GitHub Actions Inactive
@rspurgeon rspurgeon temporarily deployed to kongctl-acceptance April 24, 2026 14:27 — with GitHub Actions Inactive
@rspurgeon rspurgeon temporarily deployed to kongctl-acceptance-5 April 24, 2026 14:27 — with GitHub Actions Inactive
@rspurgeon rspurgeon temporarily deployed to kongctl-acceptance-3 April 24, 2026 14:27 — with GitHub Actions Inactive
@rspurgeon rspurgeon temporarily deployed to kongctl-acceptance-2 April 24, 2026 14:27 — with GitHub Actions Inactive
@rspurgeon rspurgeon merged commit 0b957b4 into main Apr 24, 2026
22 checks passed
@rspurgeon rspurgeon deleted the copilot/simplify-eventgateway-fetch-functions branch April 24, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[simplifier] Code Simplification - 2026-04-23: Use ResolveRequestPageSize helper in eventgateway fetch functions

3 participants