Skip to content

fix(monitoring): unify source/identity cells with multi-key disambiguation#413

Merged
seakee merged 2 commits into
mainfrom
fix/monitoring-source-identity-cells
Jul 20, 2026
Merged

fix(monitoring): unify source/identity cells with multi-key disambiguation#413
seakee merged 2 commits into
mainfrom
fix/monitoring-source-identity-cells

Conversation

@seakee

@seakee seakee commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

Realtime source cells and account overview identity now prefer multi-key OpenAI-compatible source names (e.g. aaaa #1) over bare provider/channel labels and treat xai/x-ai/grok/codex as generic provider labels so the primary stays the masked email or ordinal key.

Scope

  • Frontend panel

Changes

  • sourceDisplay: add isKeyDisambiguatedLabel / isRedundantMonitoringLabel; extend GENERIC_PROVIDER_LABELS with xai/x-ai/grok; rewrite buildMonitoringSourceDisplay primary/meta selection.
  • realtimeSourceDisplay: reuse helpers so realtime cells match account overview identity.
  • eventRows: resolve sourceLabel via key disambiguation before channel fallbacks; relocate channelMeta lookup.
  • accountOverviewState / accountOverviewPresentation: suppress redundant secondary candidates when the primary is already a multi-key disambiguation of the candidate.
  • demoFixtures: add demo auth files + analytics rows for xai/codex email identities, multi-key aaaaaa, and aaaaaa.top #1 to exercise the new paths.

User Impact

Multi-key OpenAI-compatible providers no longer collapse to a single generic channel in monitoring. xAI / codex OAuth email accounts display the masked email as primary instead of the bare xai / codex label.

Compatibility / Runtime Notes

  • CPA panel mode: N/A
  • Manager Server mode: N/A
  • Full Docker / native packages: N/A

Display-only change in monitoring surfaces; no API or backend contract change.

Data / Security Notes

N/A — display layer only, no SQLite / admin key / auth file / raw usage changes.

Risk / Rollback

Risk level: Low

Rollback: revert the two commits; no data migration.

Verification

  • Tests — vitest run src/features/monitoring/model/sourceDisplay.test.ts src/features/monitoring/accountOverviewState.test.ts src/features/monitoring/model/eventRows.test.ts → 3 files, 42 tests passed.
  • Type check, lint, build — pending CI on PR.
  • Manual UI check — recommended before merge.
  • Docs/link check — N/A.
  • Demo fixtures reviewed.

Commands / evidence:

RUN  v4.1.5 /Users/seakee/WorkSpace/Node/CPA-Manager-Plus/apps/web
Test Files  3 passed (3)
Tests       42 passed (42)
Duration    700ms

Screenshots / Recordings

N/A — display change; demo fixtures added so the new identity cells are visible in the demo build.

Docs

  • Not needed — display behavior only, no user-visible capability change requiring README/docs update.

Related

N/A

seakee added 2 commits July 20, 2026 18:07
Prefer multi-key OpenAI-compatible source names (e.g. "kuaileshifu #1") over bare provider/channel labels in the realtime source cell and account overview identity cell so multi-key providers no longer collapse to a single generic channel.

What changed:

- sourceDisplay: add isKeyDisambiguatedLabel/isRedundantMonitoringLabel; treat xai/x-ai/grok/codex as generic provider labels so primary stays the masked email or ordinal key; rewrite buildMonitoringSourceDisplay primary/meta selection.

- realtimeSourceDisplay: reuse the same helpers so realtime cells match account overview identity.

- eventRows: resolve sourceLabel with key disambiguation before channel fallbacks; relocate channelMeta lookup.

- accountOverviewState/Presentation: suppress redundant secondary labels when the primary is already a multi-key disambiguation of the candidate.

Why: previously realtime source cells and account overview secondaries showed the bare provider name under its multi-key primary, hiding which API key produced each row and making multi-key providers look like a single account.

Impact/Risk: display-only change in monitoring surfaces; covered by new sourceDisplay tests plus regression tests in eventRows and accountOverviewState. No API or backend contract change.
Add demo auth files, accountStats rows, apiKeyHash entries, and recent events for the new monitoring identity variants surfaced by the previous fix: xai/codex OAuth-style email identities, multi-key kuaileshifu OpenAI-compatible provider, and anyrouter.top #1 channel that already contains an ordinal.

What changed:

- demoAuthFiles: add codex-email-user, xai-email-user, kuai-auth-1/2, anyrouter-auth-1; populate email/account_snapshot and bump total 13 -> 18.

- demoApiAliases: add aliases for the new email/multi-key rows.

- buildMonitoringAnalytics: extend accountStats (multi-key kuaileshifu, anyrouter #1, codex/xai email) plus matching authIndexRows and apiKeyHashRows; shift the trailing edge entry's accountStats index.

- recentEvents: append rows for the new auth files so the realtime and event panels render the new identities.

Why: without demo coverage the new monitoring identity behavior is invisible to reviewers and the demo build; these fixtures make the disambiguation rules inspectable end-to-end.

Impact/Risk: demo fixtures only; no production data or API contract changes. Index shift in accountStats is internal to the demo builder.
@seakee
seakee merged commit 6920929 into main Jul 20, 2026
9 checks passed
@seakee
seakee deleted the fix/monitoring-source-identity-cells branch July 21, 2026 01:46
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.

1 participant