test(cli): add missing offline report coverage#402
Merged
Conversation
Add totalCost assertions to existing offline-no-cache tests, stale-cache tests for monthly and graph commands, and a test proving submit still fails offline with strict pricing guard. Constraint: embedded costs from OpenCode fixtures (0.05+0.03+0.02=0.10) are preserved when pricing is None Constraint: stale-cache pricing overrides embedded costs (totalCost=0.0209) Confidence: high Scope-risk: narrow
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 26ad04517e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The test was passing because --no-spinner is not a valid submit flag, causing an argument parse error instead of a pricing failure. Removed --no-spinner (submit doesn't have it), added stderr assertions to verify failure is from pricing/network error path, not auth or args. Confidence: high Scope-risk: narrow
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.
Summary
Follow-up to #375 — addresses the test coverage gaps identified during review:
totalCostassertions to existing offline-no-cache tests (models, monthly, graph) — verifies embedded source costs (0.10) are preserved when pricing is unavailablemonthlyandgraphcommands — verifies pricing override produces expected cost (0.0209)submitstill fails offline — confirms strict pricing guard is intactTest proof
cargo test -p tokscale-cli --test cli_tests→ 81 passed, 0 failedTest plan
test_models_json_offline_without_pricing_cache_still_succeeds— totalCost = 0.10 (embedded)test_monthly_json_offline_without_pricing_cache_still_succeeds— totalCost = 0.10 (embedded)test_graph_offline_without_pricing_cache_still_succeeds— totalCost = 0.10 (embedded)test_monthly_json_offline_uses_stale_pricing_cache_when_available— totalCost = 0.0209 (recalculated)test_graph_offline_uses_stale_pricing_cache_when_available— totalCost = 0.0209 (recalculated)test_submit_offline_without_pricing_cache_fails— exit code != 0Summary by cubic
Adds offline coverage for CLI reports to validate cost calculation with no pricing cache and with stale caches. Tightens the offline
submitguard to ensure failures come from pricing when offline.totalCostassertions to offline no-cache tests (models,monthly,graph) to confirm embedded costs (0.10).monthlyandgraphto confirm pricing overridetotalCost(0.0209).submitoffline test: removed invalid flag, wrote fake creds, and assert pricing/network error (not auth or arg parsing); still exits non-zero.Written for commit c614861. Summary will update on new commits.