Repository navigation
Keep Piebald usage loading when no service-tier table exists - #284
Conversation
Tier detection treated a database without per-profile settings tables as an older one and joined the per-turn override tables instead. A database that has moved past both keeps neither, so every read failed with "no such table" and all Piebald usage disappeared, although the tier only adjusts pricing. Detect each tier source by its own storage: per-profile settings, then per-turn overrides, then the chat profile's custom `service_tier` request property, which Piebald merges into the request body as-is. Unusable property values price at the standard tier, as does a database with no tier source at all. Layouts with typed tier storage price exactly as before.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Why
On a current Piebald database every scan of
app.dbfails, and Piebald reports no usage at all:Tier detection knew only two places a service tier could live. It treated "the per-profile settings tables are missing" as "this is an older database" and joined the per-turn override tables instead. A database that has moved past both keeps neither. The tier only adjusts pricing, but the failed join aborted the whole query, so the TUI,
stats, and uploads all lost every Piebald message.What changed
custom_override_fieldscolumn on profiles. A missing source is never joined.service_tierproperty, which Piebald merges into the request body as-is. As before, the chat's own (possibly hidden) profile is used.Pricing note
A database that moved from typed settings to custom properties no longer records the earlier typed tiers, so those turns now price at standard, already-uploaded ones included (same
global_hash, new cost).Validation
cargo test(503 passed), with new fixtures for a custom-property tier, eight unusable property values, and a database with no tier storagecargo clippy -- -D warnings,cargo doc,cargo fmt --checkSummary by CodeRabbit