Repository navigation
fix(accounts): bulk-by-filter honours the group filter the account page sends - #240
Merged
Merged
Conversation
…ge sends The fork's account list reads its group filter as group_id, and the account page sends that name in the filters of bulk-by-filter requests as well. The bulk filter struct only bound the older name, group, so the group was dropped when the targets were resolved: a bulk edit of "all filtered results" could change more accounts than the list showed (with only a group selected, every account), and a bulk taxonomy update failed its match-count check. BulkUpdateAccountFilters now binds group_id next to group. The request uses group_id, or group when group_id is empty; two different values are rejected with INVALID_GROUP_FILTER instead of one being picked. Both filter shapes (scalar and console) and both handlers resolve through the same value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
On the account page, "apply to all filtered results" ignored the selected group.
group_id(upstream calls itgroup), and the page sendsgroup_idin thefiltersof bulk-by-filter requests too.BulkUpdateAccountFiltersonly boundgroup, so the value was dropped when the targets were resolved.POST /admin/accounts/bulk-updatethen changed more accounts than the list showed. With only a group selected, the filter object was empty for the server and the edit applied to every account.POST /admin/accounts/bulk-taxonomyresolved the same wider set and failed itsexpected_match_countcheck.Found on 2026-10-04 while mapping the account search for #239.
Change
BulkUpdateAccountFiltersbindsgroup_idnext togroup.bulkAccountFilterGrouppicks the request's group:group_id, orgroupwhengroup_idis empty. Two different values are rejected with400 INVALID_GROUP_FILTERrather than one being picked, since this filter decides which accounts a bulk operation changes.toServiceBulkUpdateAccountFiltersuses that one value for both filter shapes (scalar and console). Bulk update and bulk taxonomy share the resolver, so both are fixed.Backend only. The page already sends
group_id. Callers that sendgroupbehave as before.Verification
gofmt,go build ./internal/handler/....TestBulkUpdateFilterTargetResolvesWithinTheGroupFilter: posts real bulk requests and asserts the group passed to the target-resolving list call, for both filter shapes,ungrouped,group_idalone, the older name, both names agreeing, and no group; and that disagreeing or invalid values return 400 without resolving a target or creating a job. With thegroup_idbinding removed, 8 of its 12 subtests fail.Known, unchanged: in the scalar filter shape an invalid group value (
abc, a negative number) is still handled as it was forgroup(the page cannot send such values);GET /admin/accounts/upstream-billing-ratesstill readsgroupand does not receive the page's multi-value filters.Not run: full suites, integration tests (no data-layer change), real model calls.
🤖 Generated with Claude Code