Skip to content

Limit filtered ListEvents responses - #7086

Open
rootp1 wants to merge 1 commit into
pipe-cd:masterfrom
rootp1:fix/list-events-filtered-pagination
Open

Limit filtered ListEvents responses#7086
rootp1 wants to merge 1 commit into
pipe-cd:masterfrom
rootp1:fix/list-events-filtered-pagination

Conversation

@rootp1

@rootp1 rootp1 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Limit label-filtered ListEvents responses to the requested logical page size.
  • Return a cursor based on the last event actually included when filtering reaches PageSize inside a datastore page.

Linked Issue

Fixes #7085

What Changed

  • Added a helper for appending label-matched events up to PageSize.
  • Added regression coverage for dense matches, sparse matches, and zero-match filtering.

Verification

  • go test ./pkg/app/server/grpcapi — passed
  • go test -race ./pkg/app/server/grpcapi — passed
  • docker run --rm -e GOCACHE=/repo/.cache/go-build -e GOLANGCI_LINT_CACHE=/repo/.cache/golangci-lint -v ${PWD}:/repo -w /repo golangci/golangci-lint:latest golangci-lint run -v --config /repo/.golangci.yml --fix=false ./pkg/app/server/grpcapi — passed
  • make check — failed: repository-pinned make lint/go image uses golangci-lint built with Go 1.25, while this repo targets Go 1.26.2
  • make test/go MODULES=. — failed: pkg/oci could not dial /var/run/docker.sock in this environment
  • DOCKER_HOST=unix:///Users/rootp1/.colima/default/docker.sock go test -race ./pkg/oci — passed
  • DOCKER_HOST=unix:///Users/rootp1/.colima/default/docker.sock make test/go MODULES=. — failed: pkg/oci local registry tests returned EOF in the full suite; rerunning pkg/oci alone passed
  • make test/web — passed
  • make lint/web — passed
  • make lint/helm — passed
  • make check/gen/code — no-op because the Makefile target is named check/gen
  • make check/gen — failed: target uses docker run -it, which cannot attach stdin in this non-interactive environment
  • docker run --rm -v ${PWD}:/repo --entrypoint ./tool/codegen/codegen.sh ghcr.io/pipe-cd/codegen@sha256:8b17498a7cfb58fbaf403ec7cab01a740238aaee43d030e65a40abb710f9e68a /repo && git diff --exit-code --quiet HEAD -- <generated paths> — passed
  • make check/dco — failed: script compares against stale origin/master and flagged upstream commit 25ae69937e55e8330bff96c34346718f3e5e7148; upstream/master..HEAD contains only this signed-off commit

Scope

  • Only pkg/app/server/grpcapi/web_api.go and pkg/app/server/grpcapi/web_api_test.go were changed.

What this PR does:

Caps filtered ListEvents responses at PageSize and returns a continuation cursor from the last returned event when filtering fills a page.

Why we need it:

Without this, ListEvents can append every matching event from the final scanned datastore page and return more events than requested.

Which issue(s) this PR fixes:

Fixes #7085

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: rootp1 <arnav.iitr@gmail.com>
@rootp1
rootp1 requested a review from a team as a code owner July 24, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ListEvents can exceed page size after label filtering

1 participant