Repository navigation
fix(api): canonicalise account_ids and forward multi-account selections - #1497
Conversation
parseAccountIDs now trims and lowercases each id, so history and analytics callers compare canonical UUIDs: an uppercase id no longer yields an empty admin result or a refused scoped user. mergeAccountFilter reuses appendMissing and addExternalIDForProvider instead of its own copy, and the stale single-account comment in the analytics handler is corrected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The savings history chart and the trends view sent account_ids only when exactly one account was selected, so a multi-selection widened to all accounts for admins and returned 400 for scoped users. Both now forward every selected id as account_ids; getAnalyticsTrends takes accountIDs instead of the singular accountID. Closes #1452 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 11 billable files and costs up to $2.75.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 41 minutes for your next included review. View limit details
Comment |
|
Independent review 1 (cold, fresh context): VERDICT: APPROVE 3256bbe Findings:
Attacked:
|
Group scope entries match account ids only since #1116, so the scoped case of the uppercase account_ids test now lists ids, not display names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent review 1, delta (same cold reviewer): VERDICT: APPROVE b9f8cf4
|
|
Independent review 2 (claude-fleet, cold): APPROVE b9f8cf4 Scope: first reviewed at 3256bbe, then extended to b9f8cf4 (merge of main f67564b plus a one-line fixture fix). The production diff is the same 11 files, +96/-40, at both heads. Findings:
Attacked:
Verified locally (GOTOOLCHAIN=go1.26.10, no creds):
Reviewed by an independent agent with no author context (second reviewer). Review only: nothing was pushed, and the GitHub review state is unchanged. |
|
Local verification at
|
Closes #1452.
Problem:
parseAccountIDsaccepted uppercase UUIDs but kept them as given, and the IDs were compared case-sensitively afterwards. A scoped user's own uppercase ID was refused, and an admin silently got an empty result. This affected/historyand the analytics routes.account_id.mergeAccountFilterduplicated the/historymerge helpers.Change:
internal/api/validation.go,handler_analytics.go):parseAccountIDstrims and lowercases IDs, so every caller gets canonical IDs. The 200-ID cap and the 400 on garbage are unchanged.mergeAccountFilterreusesappendMissingandaddExternalIDForProvider.modules/savings-history.tsandtrends.tssend the full selection asaccount_ids.AnalyticsTrendsFilter.accountIDsinapi/analytics.ts.account_ids, since fix(analytics): honour account_ids on the savings analytics routes #1448.Tests:
TestParseAccountIDs_Canonical;TestAnalytics_AccountIDs_UppercasePaddedCanonical, covering 3 routes for both admin and scoped users;TestHandler_getHistory_FilterParamssubtest.Local:
go build ./...passes, andgo test -raceand the integration tests pass on api.🤖 Generated with Claude Code