fix: reconstruct ProviderUsage subtypes on DB read and preserve StatusProviderUsage through pipeline#654
Open
rygel wants to merge 20 commits into
Open
fix: reconstruct ProviderUsage subtypes on DB read and preserve StatusProviderUsage through pipeline#654rygel wants to merge 20 commits into
rygel wants to merge 20 commits into
Conversation
- Add [JsonDerivedType] attributes for polymorphic serialization - Create QuotaProviderUsage (RequestsUsed, RequestsAvailable, etc.) - Create WindowedProviderUsage (window/group/card properties) - Create ModelScopedProviderUsage (per-model quota cards) - Create StatusProviderUsage (status-only, no quota data) - Bridge new ProviderUsage() calls to QuotaProviderUsage temporarily
The card_type column was written on every INSERT but never consulted on read — all four QueryAsync calls materialised every row as WindowedProviderUsage, silently losing ModelName (model-scoped) and type identity (status providers). Added HistoryRowDto for Dapper mapping and ToTypedUsage switch that reconstructs StatusProviderUsage / QuotaProviderUsage / ModelScopedProviderUsage / WindowedProviderUsage based on card_type. Updated WebProviderUsageMapper to check card_type for the Web path.
NormalizeUsage was converting StatusProviderUsage into QuotaProviderUsage with zero quota values, losing the type identity. Now creates the correct subtype and only sets quota fields when the candidate is a QuotaProviderUsage.
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.
Follow-up fixes to PR #653 (ProviderUsage shape contract).
Changes
DB read path: The \card_type\ discriminator column was written on every INSERT but never read. All \QueryAsync\ calls materialised every row as \WindowedProviderUsage, silently dropping \ModelName\ and \StatusProviderUsage\ type identity. Added \HistoryRowDto\ + \ToTypedUsage\ switch that reconstructs the correct subtype.
Web mapper: \WebProviderUsageMapper.Map\ always created \QuotaProviderUsage. Now checks \card_type\ and creates \StatusProviderUsage\ when appropriate.
Processing pipeline: \NormalizeUsage\ was converting \StatusProviderUsage\ into \QuotaProviderUsage\ with zero quota values. Now preserves the \StatusProviderUsage\ type and only sets quota fields for \QuotaProviderUsage\ subtypes.