fix(fleetcontrol): paginate fleet search across all pages - #1874
Open
ShaneLillieNR wants to merge 3 commits into
Open
fix(fleetcontrol): paginate fleet search across all pages#1874ShaneLillieNR wants to merge 3 commits into
ShaneLillieNR wants to merge 3 commits into
Conversation
fleet search --name-equals/--name-contains only inspected the first page of GetEntitySearch results, so the client-side name filter silently missed any fleet that wasn't on page 1 (confirmed live: a known fleet absent from a 100-entity first page, found instantly via a name-scoped query against the general entitySearch API). searchFleetEntities now loops on NextCursor (capped at 1000 pages as a safety net against a misbehaving cursor) and accumulates entities across every page before applying the name filter. Depends on newrelic/newrelic-client-go#1442, which fixes the same bug one layer down: GetEntitySearch's cursor parameter was a no-op because the generated query never declared/passed $cursor. go.mod currently points at that PR's commit via a temporary replace directive so this fix can be reviewed and tested end-to-end before #1442 merges and ships a release - opening as a draft for that reason. The replace directive needs to be swapped for a released client-go version, and this PR marked ready, once that lands. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Merged
5 tasks
Collaborator
Author
|
Live end-to-end verification of this fix, using the built With this fix (built against newrelic/newrelic-client-go#1442's commit via the temporary
Without this fix (same live account, same two fleet names, built from |
pranav-new-relic
previously approved these changes
Aug 20, 2026
pranav-new-relic
left a comment
Member
There was a problem hiding this comment.
LGTM (as discussed over the call). Thanks for fixing this :)
ShaneLillieNR
marked this pull request as ready for review
August 20, 2026 18:01
ShaneLillieNR
marked this pull request as draft
August 20, 2026 18:18
newrelic/newrelic-client-go#1442 merged and shipped in v2.93.2, which carries the GetEntitySearch cursor fix this PR depends on. Drop the temporary replace directive and point go.mod at the real release. Re-verified against the same live account/fleets used for the earlier before/after check - unchanged now that a real released version is in place. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ShaneLillieNR
marked this pull request as ready for review
August 24, 2026 22:18
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.
fleetcontrol fleet search --name-equals/--name-containsonly inspected the first page ofGetEntitySearchresults, so the client-side name filter silently missed any fleet that wasn't on page 1 (confirmed live: a known fleet absent from a 100-entity first page, found instantly via a name-scoped query against the generalentitySearchAPI).searchFleetEntitiesnow loops onNextCursor(capped at 1000 pages as a safety net against a misbehaving cursor) and accumulates entities across every page before applying the name filter. This intentionally does not expose a--next-cursorflag the wayfleet members listdoes - a name search's entire point is "does this exist," and the caller has no way to know which page a match might be on, so partial/manual paging would defeat the feature.Depended on newrelic/newrelic-client-go#1442, which fixed the same bug one layer down:
GetEntitySearch's cursor parameter was a no-op because the generated query never declared/passed$cursor. That PR has merged and shipped in client-go v2.93.2 -go.modnow points at the real release instead of the temporary commit-pinned replace directive, so this is ready for review.Test plan
internal/fleetcontrol/fleet_management_search_test.go: 5 unit tests against a mock NerdGraph server - match on page 1, match only on page 2+ (the regression test for this bug), no match across all pages, error on a later page propagates (no partial results),--name-containsspanning multiple pages.make test-unit- 526 tests passing.gofmt/golangci-lintclean.--name-equalsfinds fleets at page 2+ that a pre-fix build returnsnullfor. Details in the PR comments.