Skip to content

fix(auth-index): recover historical auth account display#65

Merged
seakee merged 3 commits intomainfrom
fix/auth-index-history-snapshots
May 11, 2026
Merged

fix(auth-index): recover historical auth account display#65
seakee merged 3 commits intomainfrom
fix/auth-index-history-snapshots

Conversation

@seakee
Copy link
Copy Markdown
Owner

@seakee seakee commented May 11, 2026

Summary

Recover historical monitoring account display when CPA auth index generation changes.

Cause

CPA auth indexes are derived at runtime from current auth file metadata. After CPA changed the auth index seed rules, historical usage events can no longer be matched to current auth files by auth_index, so account summary rows fall back to masked account values.

Solution

  • Persist auth account snapshots on usage events during collection.
  • Enrich incoming usage events from CPA auth file metadata without storing tokens.
  • Add legacy auth index alias resolution for existing historical records.
  • Prefer current auth metadata, then stored account snapshots, then the existing fallback display.

Testing

  • go test ./internal/...
  • npm test -- legacyAuthIndexAliases useMonitoringData
  • npm test -- monitoring
  • npm run type-check
  • npx vite build
  • git diff --check

Related

Fixes #64

seakee added 3 commits May 11, 2026 10:54
Add snapshot fields to usage events and SQLite storage so collected records retain display account metadata.

Thread the fields through import/export and aggregate payloads for backwards-compatible reads.

Existing databases are migrated with additive nullable columns to keep upgrade risk low.
Fetch current CPA auth files during collection and cache auth_index metadata for incoming usage events.

Populate account, label, file, and provider snapshots before insert without storing tokens.

Fall back to raw usage data if CPA auth metadata cannot be fetched.
Add legacy auth_index aliases for CPA auth index changes and use account snapshots as display fallback.

Keep original event auth_index values intact while resolving aliases to current auth metadata.

This restores historical account grouping when current auth files still exist and reduces future display drift.
@seakee seakee merged commit c557f6d into main May 11, 2026
3 checks passed
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.

[Bug]: 请求监控历史账号因 CPA auth_index 变更显示为脱敏来源

1 participant