Skip to content

test(cli): add missing offline report coverage#402

Merged
junhoyeo merged 2 commits intomainfrom
test/offline-report-coverage
Apr 7, 2026
Merged

test(cli): add missing offline report coverage#402
junhoyeo merged 2 commits intomainfrom
test/offline-report-coverage

Conversation

@junhoyeo
Copy link
Copy Markdown
Owner

@junhoyeo junhoyeo commented Apr 7, 2026

Summary

Follow-up to #375 — addresses the test coverage gaps identified during review:

  • Add totalCost assertions to existing offline-no-cache tests (models, monthly, graph) — verifies embedded source costs (0.10) are preserved when pricing is unavailable
  • Add stale-cache tests for monthly and graph commands — verifies pricing override produces expected cost (0.0209)
  • Add test proving submit still fails offline — confirms strict pricing guard is intact

Test proof

  • cargo test -p tokscale-cli --test cli_tests81 passed, 0 failed
  • All 7 offline tests pass: no-cache (3) + stale-cache (3) + submit-fails (1)

Test 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 != 0
  • No regressions in existing 74 tests

Open with Devin

Summary by cubic

Adds offline coverage for CLI reports to validate cost calculation with no pricing cache and with stale caches. Tightens the offline submit guard to ensure failures come from pricing when offline.

  • Tests
    • Added totalCost assertions to offline no-cache tests (models, monthly, graph) to confirm embedded costs (0.10).
    • Added stale-cache tests for monthly and graph to confirm pricing override totalCost (0.0209).
    • Hardened submit offline 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.

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
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
tokscale Ignored Ignored Preview Apr 7, 2026 2:41am

Request Review

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

cubic-dev-ai[bot]

This comment was marked as resolved.

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
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review

@junhoyeo junhoyeo merged commit 6844e26 into main Apr 7, 2026
16 checks passed
@junhoyeo junhoyeo deleted the test/offline-report-coverage branch April 7, 2026 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant