fix(warp): scan aggregate usage cache files - #662
Merged
IvGolovach merged 1 commit intoJun 5, 2026
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/tokscale-core/src/aggregator.rs">
<violation number="1" location="crates/tokscale-core/src/aggregator.rs:964">
P2: Regression test for cost-only active days uses fixture with non-zero messages count, undermining regression protection for the cost-only branch.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| totals: DailyTotals { | ||
| tokens: 0, | ||
| cost: 1.25, | ||
| messages: 3, |
Contributor
There was a problem hiding this comment.
P2: Regression test for cost-only active days uses fixture with non-zero messages count, undermining regression protection for the cost-only branch.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At crates/tokscale-core/src/aggregator.rs, line 964:
<comment>Regression test for cost-only active days uses fixture with non-zero messages count, undermining regression protection for the cost-only branch.</comment>
<file context>
@@ -938,6 +941,53 @@ mod tests {
+ totals: DailyTotals {
+ tokens: 0,
+ cost: 1.25,
+ messages: 3,
+ },
+ intensity: 0,
</file context>
Suggested change
| messages: 3, | |
| messages: 0, |
Validation * Validation tier: Tier 2R - post-review test-only correction for the cost-only active-day regression fixture. * git diff --check: PASS * git diff --cached --check: PASS * cargo test -p tokscale-core test_calculate_summary_counts_cost_only_days_as_active: PASS * cargo fmt --check: PASS * Ledger: not applicable - not required for selected validation tier/change family. * Version: not applicable - not required for selected validation tier/change family. * Not run: full workspace test suite - not required locally for selected validation tier; targeted aggregation regression test covers this correction and remote CI is expected to run final PR gates. Rollback * git revert HEAD
IvGolovach
force-pushed
the
codex/warp-cache-cost-days-20260601
branch
from
June 1, 2026 22:35
31f3711 to
3be1542
Compare
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
Why
Warp records aggregate usage in
usage*.jsoncache files, but the scanner only understood the CSV variant of that pattern. As a result, Warp cache files could be declared in the client registry but still never be found. Warp rows can also carry spend and request counts without token totals, so the summary active-day calculation should treat those rows as activity instead of dropping them from the active-day denominator.Diff scope
crates/tokscale-core/src/clients.rs: marks Warp as locally parseable while keepingsubmit_default: false.crates/tokscale-core/src/scanner.rs: adds deterministicusage*.jsonmatching forusage.jsonand per-accountusage.<account>.json, excluding archive and backup files.crates/tokscale-core/src/aggregator.rs: counts days with tokens, cost, or messages as active and adds regression coverage.Branch integrity
maina86e688d620939d2c973c6d5625baa815ea223d7origin/main:0 behind / 1 aheada86e688d620939d2c973c6d5625baa815ea223d7Commit integrity
31f3711 fix(warp): scan aggregate usage cache filesDiff hygiene
git diff --name-status origin/main...HEAD:M crates/tokscale-core/src/aggregator.rs,M crates/tokscale-core/src/clients.rs,M crates/tokscale-core/src/scanner.rsgit diff --check origin/main...HEAD: PASS, no outputValidation mode and proof
cargo test -p tokscale-core test_warp_client_registered_as_aggregate_cache_source: PASScargo test -p tokscale-core test_scan_directory: PASS, 11 testscargo test -p tokscale-core test_calculate_summary: PASS, 5 testscargo test -p tokscale-core warp: PASS, 2 testscargo fmt --check: PASSCI context confirmation
Runtime safety
scan_directory, andcalculate_summary.Migration notes
Not applicable — no DB migration changed.
Documentation integrity
Not applicable — no docs, commands, or user-facing CLI behavior changed.
Rollback plan
Rollback: revert this PR.
DB downgrade: not applicable.
Data repair: not applicable.
Operational caveats: none known.
Known residual risks
Summary by cubic
Enables local scanning of Warp aggregate cache files (
usage*.json) and counts cost-only or message-only days as active in summary stats. Warp stays out of default submit, but local reports/graphs can read its cache.usage.jsonandusage.<account>.json, skippingarchive/andusage.backup*.parse_local: truewhile keepingsubmit_default: false.Written for commit 3be1542. Summary will update on new commits.