Repository navigation
fix(api): reject implausible usage at ingest and make aggregates over… - #9
Merged
Merged
Conversation
…flow-safe (#143) Fabricated uploads on 2026-10-05 stored rows with cost_usd up to 2.7e296 and 8.6e15 tokens through the normal CLI ingest, overflowed the public layout, and pushed sum(total_tokens) past int64 so /internal returned 500. - Plausibility limits per usage_days row, for every CLI version: tokens are non-negative safe integers up to 1T per field; cost is finite, non-negative and at most min($1M, billable tokens x $0.002 + $250). Calibrated against legitimate prod rows (max 110.7B tokens, $131k, $60/M). Offending rows are dropped one by one, logged with user and device, and counted on the device (devices.rejected_usage_rows, shown on /internal). The response contract is unchanged. - The cost freeze never keeps a stored cost above that ceiling. - Usage aggregates use SQLite total() instead of sum(), which threw "integer overflow" past int64. - www formatters compact large values ($1.2M, 4.5B) and cap absurd ones at >$999T / >999T so they cannot stretch the layout. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
HappyGamblingAddict
merged commit Oct 11, 2026
79fcb3b
into
HappyGamblingAddict:main
16 checks passed
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.
…flow-safe (851-labs#143)
Fabricated uploads on 2026-10-05 stored rows with cost_usd up to 2.7e296 and 8.6e15 tokens through the normal CLI ingest, overflowed the public layout, and pushed sum(total_tokens) past int64 so /internal returned 500.