Repository navigation
Conversation
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.
Models absent from the built-in price table require manual price entry before usage costs can be calculated. This adds an explicit
pricing synccommand to import reference text-model prices from models.dev.--overwriteto replace or restore them. Import each selected batch atomically.These are base USD-per-million reference prices, not actual provider bills. Context tiers and discounts are not represented. Sync is manual; this does not add background network traffic, schema changes, or TUI controls. English and Chinese usage documentation is included.
Validation (Linux, pinned Rust 1.91.1):
cargo fmt --checkpassed.cargo test --locked pricing_sync --lib: 10 passed.cargo test --locked services::usage_stats::tests --lib: 24 passed.cargo test --locked --bin cc-switch update_and_completions_skip_startup_state: 1 passed.cargo clippy --lockedis blocked by the existing zero-length range insrc/cli/tui/ui/home_chart.rs:806(BAR_AXIS_INSET_ROWS = 0, also present in the base).cargo clippy --locked -- -A clippy::reversed_empty_rangespassed with existing warnings.cargo +stable check --lockedpassed. Windows unit tests are blocked by existing unguardedstd::os::uniximports in TUI tests, so the relevant tests were run on Linux instead.Regression coverage includes local-price/deletion preservation, atomic rollback, optional cache-aware backfill, historical rows older than retention, exact-ID precedence, a database-free preview, and HTTP/JSON/size failures. Two independent review rounds completed with no remaining in-scope findings.
Existing limitation retained: the shared backfill helper selects eligible rows before starting its transaction, so concurrent independent backfills can race. This PR reuses that behavior; it does not redesign global backfill concurrency.