You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current PurchaseHistoryFilter.ExternalIDs []string treats all external account numbers (e.g. AWS account IDs, Azure subscription IDs) as a flat list with no provider context. This means a filter for account number 123456789012 could in principle match rows from any provider that happens to share that number, rather than only matching the intended provider's rows.
Proposed change
Replace ExternalIDs []string with ExternalIDsByProvider map[string][]string (provider key -> list of external IDs). The predicate builder would then emit:
(cloud_account_id = ANY($u)
OR (provider = $p1 AND account_id = ANY($ids_for_p1))
OR (provider = $p2 AND account_id = ANY($ids_for_p2))
...)
This ensures a filter for aws/123456789012 never pulls azure/123456789012 rows.
Summary
The current
PurchaseHistoryFilter.ExternalIDs []stringtreats all external account numbers (e.g. AWS account IDs, Azure subscription IDs) as a flat list with no provider context. This means a filter for account number123456789012could in principle match rows from any provider that happens to share that number, rather than only matching the intended provider's rows.Proposed change
Replace
ExternalIDs []stringwithExternalIDsByProvider map[string][]string(provider key -> list of external IDs). The predicate builder would then emit:This ensures a filter for
aws/123456789012never pullsazure/123456789012rows.Scope
internal/config/types.go:PurchaseHistoryFilter.ExternalIDs->ExternalIDsByProvider map[string][]stringinternal/config/store_postgres.go:appendAccountPredicategains provider groupinginternal/api/analytics_postgres.go:accountFilterClausegains provider grouping (the full version reverted in PR fix(api): filter purchases by account UUID AND external id (closes #701, #498, #866) #956 is the target shape)internal/api/scoping.go:resolveAccountFilterIDs/resolveSingleAccountFilterIDsreturnmap[string][]stringinstead of[]stringinternal/api/handler_dashboard.go,handler_history.go,handler_analytics.go: update callersNotes
fix/account-filter-id-representationbranch but reverted (PR fix(api): filter purchases by account UUID AND external id (closes #701, #498, #866) #956) because it was build-breaking and outside the PR's focused scope. The fullsortedProviderKeys+ per-provider predicate logic is the intended end state.ExternalIDs []stringflat form (landed in PR fix(api): filter purchases by account UUID AND external id (closes #701, #498, #866) #956) is the correct interim shape while this refactor is pending.aws-scoped filter does not match a row whoseprovider = 'azure'andaccount_idhappens to be the same string.