Q3: Preserve unknown session usage and expose cost read failures #797
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
toasterson/Anima!797
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/q3-honest-costs-20261019"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Q3 — Honest session counts, usage and read failures
The old view counted a left-join placeholder as a session, summed BIGINT values through incompatible driver types, and converted all-null usage into zero totals.
get_work_item_detailthen erased query/decode errors and returned a false empty census.Migration 154 follows applied migration 089: session-ID counts exclude placeholders, token operands/sums use NUMERIC without BIGINT addition overflow, and all-null usage stays unknown. The reader preserves exact values, reports coverage/partial usage, and emits explicit unavailable/query/decode/missing-row states instead of fabricated zeros. Normal fields retain JSON integer encoding; values beyond JavaScript's safe integer range use exact decimal strings, declared by
numeric_encoding. Consumers must honor that additive encoding contract. Seedocs/ai/contracts/session-cost-summary.md.The associated dashboard SUM(bigint) decoder now deliberately uses double precision for its existing floating-point ratio. Historical model/usage remains unknown; no executor-alias backfill.
Validation:
cargo test -p anima-server --lib --locked: 558 passed, 6 environment-dependent tests ignored.Dependencies: none. S3 may add future typed usage observations; this read contract remains truthful before that arrives. No production DB write, live repair, claim/hold/lifecycle/budget change, merge, deployment or canary.
Solstice exact-head CI and independent AI review pending at creation. Local validation is distinct from CI/runtime acceptance. Do not merge: operator human gate.
Consumer compatibility: session_cost_summary now returns explicit availability/usage states and coverage counts. Unknown or unavailable totals are null. JSON-safe exact values remain numbers; values above2^53-1 are decimal strings with numeric_encoding indicating mixed encoding. Consumers must branch on availability, preserve null, and accept number|string rather than defaulting null/error to zero. See docs/ai/contracts/session-cost-summary.md. Independent Fable review approved; exact-head Solstice receipt remains pending.
toasterson referenced this pull request2026-10-19 11:42:32 +00:00