fix(auth-index): recover historical auth account display#65
Merged
Conversation
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.
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.
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
Testing
Related
Fixes #64