Repository navigation
fix(accounts): upstream billing rates resolve the page the account list shows - #241
Merged
Merged
Conversation
…st shows GET /admin/accounts/upstream-billing-rates answers for "the current list page", and the account page applies its snapshots only when the total and the ID order equal the list's; otherwise it reloads the whole list. The endpoint still read upstream's single-value filters and "group", while this fork's list reads "group_id" and the multi-value console filters, and the page sent the endpoint filter keys it no longer sets. With any platform, type, status, plan, proxy, folder, tag, group or account_ids filter active the two never agreed, so the refresh after a billing probe always reloaded the list. The endpoint now resolves accounts the way List does for the same query: group from group_id (the older group only when group_id is absent), and the console service when console filters are present. The page sends it the list request's filter parameters. The console query now breaks ties by account ID, as the plain list ordering does, so one query always yields one order: console pages do not overlap, and the rates request sees the page the list request saw. 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
GET /admin/accounts/upstream-billing-ratesreturns the billing-rate snapshots of "the current account-list page". The account page applies them in place only when the returned total and account ID order equal the list's; otherwise it reloads the whole list.The endpoint is still upstream's code, and this fork's list has moved on:
group_id, the endpoint readgroup;params.platform/type/status/group, keys it no longer sets.So with any of those filters active the endpoint answered for a wider set, and the refresh that follows a billing probe always fell back to a full list reload.
Correction to how this was first reported (to the owner and in the workspace notes): it was described as a reload "every 5 minutes". That is wrong. The page's 5-minute timer,
useIntervalFn(..., { immediate: false })with the return value discarded, is never started by @vueuse 10.11 — the same line is in upstream. The only live caller is the refresh after a billing probe. This PR does not change the timer.Change
GetUpstreamBillingRatesresolves accounts the wayListdoes for the same query: group fromgroup_id(same accepted values and the sameINVALID_GROUP_FILTER400), the oldergrouponly whengroup_idis absent, and the console service whenhasAccountConsoleFiltersis true. Response shape, ETag and Cache-Control are unchanged.Listis not modified.buildConsoleAPIParams(true), including the resolved search, so a key search sends the digest term). The legacy keys are no longer sent. No UI change.accountConsoleQuerynow breaks ties by account ID, as the plain list ordering already does. Without it one query could return tied rows in different orders, so console pages could overlap and the rates request could disagree with the list on order.Verification
go build ./...,go vet(handler package; repository package with the integration tag), and the new handler tests together with the existingListtests.Listand to the rates endpoint on one router, and the recorded service call must be equal (13 queries, both paths); invalid filters fail alike on both; the oldergroupname; response shape, ETag and 304 for a console-filtered request.group, and the unmodified handler each fail these tests.vue-tsc --noEmit, eslint on the touched files, and the three specs that reach this request (44 tests). New cases: the request carries the list request's filters at the current page; a matching answer is applied in place without a list request; a key search sends the digest term. Restoring the old filter builder fails the first case.Not run locally: the new integration case
TestAccountTaxonomyConsoleOrderBreaksTiesByIDIntegrationneeds Docker and runs in CI. No full suites, no real model calls.🤖 Generated with Claude Code