Skip to content

fix(dashboard): show account email/name in Utilization Account Split cards - #10939

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.50from
ZaimMarzuki:fix/utilization-account-split-display
Aug 21, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.50from
ZaimMarzuki:fix/utilization-account-split-display

Conversation

@ZaimMarzuki

Copy link
Copy Markdown
Contributor

Problem

In the Analytics > Utilization > Account Split view, each card displayed a raw internal key like antigravity:cd11b4b9-4718-43c7-b348-f126d83f8e6a as the card title. This made it impossible to identify which account was running low or exhausted without manually cross-referencing UUIDs against the Providers or Combos pages.

The root cause: getAggregatedSnapshots() returns provider:connection_id as the key when aggregateBy=connection. The frontend passed this directly to resolveProviderName(), which only knows about provider nodes — not connection-level email or display names.

Solution

Enrich the API response with connection metadata when in Account Split mode, then use it in the frontend to display a human-readable label.

API (/api/usage/utilization): when aggregateBy=connection, extract unique connection_ids from the result, fetch each via getConnection() from src/lib/db/connections, and include a connectionMeta map in the response.

Frontend (ProviderUtilizationTab): parse the provider:connectionId key, look up connectionMeta, and display:

  • Title: email → displayName → name → fallback short UUID (via existing getAccountDisplayName())
  • Subtitle: antigravity · account cd11b4b9…

ProviderIcon now receives only the provider portion of the key, not the full compound string.

Files changed

  • src/shared/types/utilization.ts — add ConnectionMetaEntry interface and connectionMeta field to ProviderUtilizationResponse
  • src/app/api/usage/utilization/route.ts — build and include connectionMeta when aggregateBy=connection
  • src/app/(dashboard)/dashboard/analytics/ProviderUtilizationTab.tsx — parse compound key, resolve display name, update card title/subtitle

Test plan

  • Open Analytics > Utilization > Account Split — cards should show email as the bold title
  • Subtitle shows <provider> · account <8-char UUID>…
  • Switch to Global View — no change in appearance (connectionMeta is undefined, code path skipped)
  • Change time range (1h / 7d / 30d) — email labels remain correct
  • Accounts without email fall back gracefully to displayName, name, or short UUID

…cards

In Account Split mode, cards showed raw `provider:connection_uuid` strings
instead of the account's email or display name. This made it impossible to
identify which account was exhausted without cross-referencing UUIDs manually.

Changes:
- Add `connectionMeta` field to `ProviderUtilizationResponse` type
- Enrich API response with email/name/displayName per connection when
  aggregateBy=connection, fetched from the connections DB via getConnection()
- Update card rendering to display email (or name/displayName as fallback)
  as the card title, with `provider . account <short-uuid>` as subtitle
- ProviderIcon now receives the provider name portion only (not the full key)
@diegosouzapw
diegosouzapw merged commit c0fd109 into diegosouzapw:release/v3.8.50 Aug 21, 2026
3 checks passed
backryun added a commit to backryun/OmniRoute that referenced this pull request Aug 21, 2026
…n route

PR diegosouzapw#10939 imported getConnection from '@/lib/db/connections' — a module
that does not exist in the repo. Turbopack failed every production build
with 'Module not found: Can't resolve @/lib/db/connections', turning
Build App, Publish to Docker Hub, and Release-Green red on
release/v3.8.50 (base-red issue diegosouzapw#9985).

Resolve connection metadata through the real DB domain module instead:
getProviderConnectionById() from src/lib/db/providers.ts (async, so the
call site now awaits it). The response shape is unchanged.

Regression test: tests/unit/usage-utilization-connection-meta.test.ts
covers the aggregateBy=connection metadata path end-to-end against a
seeded provider_connections row.
jonlwheat2-gif added a commit to jonlwheat2-gif/OmniRoute that referenced this pull request Aug 21, 2026
…oute

fix(api): replace non-existent @/lib/db/connections import with getProviderConnectionById from @/lib/db/providers in the usage utilization route — the module was never created while diegosouzapw#10939 added its import, breaking any production build.

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
backryun added a commit to backryun/OmniRoute that referenced this pull request Aug 21, 2026
…n route

PR diegosouzapw#10939 imported getConnection from '@/lib/db/connections' — a module
that does not exist in the repo. Turbopack failed every production build
with 'Module not found: Can't resolve @/lib/db/connections', turning
Build App, Publish to Docker Hub, and Release-Green red on
release/v3.8.50 (base-red issue diegosouzapw#9985).

Resolve connection metadata through the real DB domain module instead:
getProviderConnectionById() from src/lib/db/providers.ts (async, so the
call site now awaits it). The response shape is unchanged.

Regression test: tests/unit/usage-utilization-connection-meta.test.ts
covers the aggregateBy=connection metadata path end-to-end against a
seeded provider_connections row.
jonlwheat2-gif added a commit to jonlwheat2-gif/OmniRoute that referenced this pull request Aug 21, 2026
…oute

fix(api): replace non-existent @/lib/db/connections import with getProviderConnectionById from @/lib/db/providers in the usage utilization route — the module was never created while diegosouzapw#10939 added its import, breaking any production build.

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
diegosouzapw added a commit that referenced this pull request Aug 21, 2026
…provider docs, orphaned suppressions (#11038)

⭐5 — Drain de base-reds v3.8.50 (#9985): corrige build-break do #10939 (import fantasma @/lib/db/connections → reroteado por getProviderConnectionById real), headers Anthropic no fallback GLM, fallthrough do reject de listing CC-compatible, no-auth leak no auto-combo, retry de mesmo-account nos combo live tests, pin onnxruntime-node ~1.24.3; + alignments de teste + gates (env-doc, docs-counts 347→348, openapi floor, i18n vi/pt-BR).

Reconciliado com o tip: 5 conflitos de contagem gerada (SVGs + PROVIDER_REFERENCE — HEAD já em 348, branch em 347 stale) resolvidos ficando com o HEAD. typecheck limpo, gates verdes, 5/5 testes focados (#10939 regressão + utilização), lint limpo nos tocados.

Também rebaselined neste turno via push direto ao tip: config/quality/file-size-baseline.json modelCapabilities.ts 1016→1072 (drift de PRs ja mergeadas, ex: #11034), com changelog fragment — tip estava vermelho nesse gate e travava esta PR.
linhdmn pushed a commit to linhdmn/omniroute-INITIAL_PASSWORD-fix that referenced this pull request Aug 22, 2026
…uild

diegosouzapw#10939 added `import { getConnection } from "@/lib/db/connections"` to
the utilization route, but no such module exists in the repo — the Next
build fails with "Module not found: Can't resolve '@/lib/db/connections'".

Add the module following the existing db-helper pattern
(getDbInstance + prepared SELECT on provider_connections), returning the
email/name metadata the route maps into ConnectionMetaEntry. The route's
`conn?.displayName` read is replaced with a literal null: the
provider_connections table has no display-name column, and the Account
Split card already falls back through getAccountDisplayName
(displayName -> name -> email).
linhdmn pushed a commit to linhdmn/omniroute-INITIAL_PASSWORD-fix that referenced this pull request Aug 22, 2026
…uild

diegosouzapw#10939 added `import { getConnection } from "@/lib/db/connections"` to
the utilization route, but no such module exists in the repo — the Next
build fails with "Module not found: Can't resolve '@/lib/db/connections'".

Add the module following the existing db-helper pattern
(getDbInstance + prepared SELECT on provider_connections), returning the
email/name metadata the route maps into ConnectionMetaEntry. The route's
`conn?.displayName` read is replaced with a literal null: the
provider_connections table has no display-name column, and the Account
Split card already falls back through getAccountDisplayName
(displayName -> name -> email).
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…cards (diegosouzapw#10939)

Validado no worktree combinado: typecheck:core, changelog-integrity, complexity, cognitive-complexity, file-size, lint todos verdes. Fix de UX real e bem documentado (cards de Account Split mostravam UUID cru em vez de email/nome da conta). CI vermelho é o base-red já rastreado em diegosouzapw#9985. Obrigado!
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…provider docs, orphaned suppressions (diegosouzapw#11038)

⭐5 — Drain de base-reds v3.8.50 (diegosouzapw#9985): corrige build-break do diegosouzapw#10939 (import fantasma @/lib/db/connections → reroteado por getProviderConnectionById real), headers Anthropic no fallback GLM, fallthrough do reject de listing CC-compatible, no-auth leak no auto-combo, retry de mesmo-account nos combo live tests, pin onnxruntime-node ~1.24.3; + alignments de teste + gates (env-doc, docs-counts 347→348, openapi floor, i18n vi/pt-BR).

Reconciliado com o tip: 5 conflitos de contagem gerada (SVGs + PROVIDER_REFERENCE — HEAD já em 348, branch em 347 stale) resolvidos ficando com o HEAD. typecheck limpo, gates verdes, 5/5 testes focados (diegosouzapw#10939 regressão + utilização), lint limpo nos tocados.

Também rebaselined neste turno via push direto ao tip: config/quality/file-size-baseline.json modelCapabilities.ts 1016→1072 (drift de PRs ja mergeadas, ex: diegosouzapw#11034), com changelog fragment — tip estava vermelho nesse gate e travava esta PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants