fix: normalize all routing prefixes in pricing lookup#13
fix: normalize all routing prefixes in pricing lookup#13Sagargupta16 wants to merge 8 commits intomm65x:masterfrom
Conversation
- Fixed an issue where the history sub-rows aggressively hardcoded the `Client` column to an empty string. - The history mode now routes through the exact same `GroupBy` matcher logic as the normal view, dynamically showing or hiding the Model/API/Client headers completely symmetrically with the main TUI tables. - Regroups the atomic models inside each historical period summary dynamically when the user cycles the `g` grouping hotkey.
|
Thanks for putting this together. The logic changes to reuse It looks like there is a small syntax error at the bottom of Could you clean up the duplicated lines and ensure the new tests are inside the test module? Once the CI is green, we can get this merged. |
|
Fixed -- removed the duplicate tests and added the missing closing brace. Should be clean now. |
|
close but there's still one extra closing brace on line 371 of src/cost.rs that breaks compilation. just delete that line and it should be good to go |
|
Fixed -- removed the extra closing brace on line 371. CI should be green now. |
|
clippy failure is from an outdated base - rebase on latest develop and it should pass |
dc03b60 to
1e8a2b7
Compare
|
Rebased and squashed into a single clean commit. The extra brace was already removed in the previous push -- just cleaned up the history now. |
|
sorry, that was on our end - just pushed a fix to develop. one more rebase should do it |
* fix: re-price records with zero cost instead of preserving them Source parsers (e.g. OpenCode) store cost: 0 for models they can't price. The apply_costs guard treated Some(0.0) as 'already priced', permanently locking these records at $0. Now only positive costs are preserved. * fix: stop silently truncating files on I/O errors and log skipped rows - Changed map_while(Result::ok) to filter_map with error counters in claude_code.rs, pi_agent.rs, and jsonl_source.rs so a single bad line doesn't abort the entire file parse. - Added skip counter to mark_preserved in cache.rs for row-level errors. --------- Co-authored-by: mm65x <mm65x@users.noreply.github.com>
Reuse strip_routing_prefix from display.rs to remove provider-specific prefixes (vertexai., bedrock/, openai/, azure/) before pricing lookup. Previously only vertexai. was stripped, causing misses for other providers. Also strip @deployment suffixes so hosted deployments like gpt-4o@my-deployment resolve correctly.
1e8a2b7 to
f4699f8
Compare
|
Rebased onto latest develop -- resolved the conflict with the new zero-cost repricing test. All three test additions are intact. Should be clean now. |
Summary
find_pricingto strip all routing prefixes before pricing lookup, not justvertexai.Root cause
find_pricing(cost.rs:147) only stripped thevertexai.prefix before looking up model pricing. Models from Bedrock (bedrock/anthropic.claude-*), OpenAI-compatible clients (openai/), or deployments (model@deploy) kept their routing prefix, causing lookup failures or fallback to prefix matching that could resolve to wrong pricing.Meanwhile,
display::strip_routing_prefixalready handled all these cases correctly for display purposes -- it just wasn't being used in the pricing path.Changes
display::strip_routing_prefixinfind_pricingto strip all routing prefixes (slash-based, dot-based, @Deploy suffixes) before the lookup cascadenormalize_model_nameso normalized lookups also work for prefixed modelsstrip_routing_prefixpublic for cross-module usetest_find_pricing_cross_provider_same_modelverifying the same model resolves to identical pricing across 5 provider variantstest_find_pricing_strips_deploy_suffixfor @Deploy handlingTest plan
Fixes #9