Repository navigation
fix: filter-based bulk user delete no longer capped to first page of 20 users - #7067
Merged
Merged
Conversation
…20 users getUserIdsHonoringFilters applied the listing default page size (20) and the query builder then appended "limit ? offset ?", so a filter-based bulk delete only resolved the first 20 matching users. Force ShowAll so the delete applies to every matching user. Adds regression tests. Fixes #7066 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J5DesTG5XvPdmPCDuL6izq
|
Bito Automatic Review Skipped - Draft PR |
claude
Bot
requested review from
prakarsh-dt and
vivek-devtron
as code owners
October 23, 2026 12:19
|
vivek-devtron
approved these changes
Oct 23, 2026
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.



Requested by Shivam Nagar · Slack thread
Description
Fixes #7066
Before: a filter-based bulk delete (e.g.
{"listingRequest":{"searchKey":"abc"}}with no explicit ids) resolved only the first page of 20 matching users and silently left the rest in place.After: a filter-based bulk delete resolves every matching user, as the listing filter implies.
How:
getUserIdsHonoringFilters(pkg/auth/user/UserService.go) applies the listing normalization, which defaultsSizetobean.DefaultSize(20);GetQueryForUserListingWithFiltersthen appendslimit ? offset ?unlessShowAllis set. The fix setsrequest.ShowAll = trueafter the normalization calls and before the query is built, with an explanatory comment. The same fix landed in devtron-enterprise via devtron-labs/devtron-enterprise#3407.GetAllWithFilters, the query builder and the explicit-ids delete path are unchanged.How Has This Been Tested?
Extended
pkg/auth/user/UserService_bulkdelete_filter_test.go:TestGetUserIdsHonoringFilters_DoesNotPaginate(new): 25 matching users (more than the default page size of 20) all get resolved,ShowAllis forced true, and the query has nolimit ? offset ?and no bound page size. It also builds the pre-fix query (same input, noShowAll) and asserts it is paginated with the default page size, so the test fails if the fix is reverted.TestGetUserIdsHonoringFilters_MatchesListingQuery(updated): the listing path paginates by default while the delete path intentionally does not, so the expected listing query is now built withShowAll = true.TestGetUserIdsHonoringFilters_RejectsUnscopedFilter: unchanged.go build ./pkg/auth/user/...succeeds.go test ./pkg/auth/user/ -run TestGetUserIdsHonoringFilters -v -vet=offpasses all three tests, and temporarily removing theShowAll = trueline makes the new and updated tests fail. As with #7021,pkg/auth/user/UserService_test.goandUserFlows_test.goalready fail to compile onmain(staleNewUserCommonServiceImplsignature etc.), so I temporarily moved them aside to run the tests; they are restored and not part of this change.gofmt -lis clean.Checklist:
Does this PR introduce a user-facing change?
Generated by Claude Code