Skip to content

fix(cli): reject invalid date bounds - #1604

Merged
ryoppippi merged 2 commits into
mainfrom
codex/fix-date-bound-clean
Aug 15, 2026
Merged

fix(cli): reject invalid date bounds#1604
ryoppippi merged 2 commits into
mainfrom
codex/fix-date-bound-clean

Conversation

@ryoppippi

@ryoppippi ryoppippi commented Aug 15, 2026

Copy link
Copy Markdown
Member

Summary

  • Validate --since and --until against the documented YYYY-MM-DD and YYYYMMDD formats, including real calendar dates.
  • Apply the same validation to config-file bounds and document the accepted formats and non-zero rejection behavior.

Testing

  • Focused Rust tests for ccusage-cli, ccusage-cli-parser, ccusage-config, and ccusage-core
  • Full pre-push validation: clippy, formatting, gitleaks, cargo test, and Node tests

Closes #1483


Summary by cubic

Rejects invalid date bounds in the CLI and config to prevent silent mis-filtering. Previously we accepted any string and stripped dashes; now we accept only real calendar dates in YYYY-MM-DD or YYYYMMDD and exit non-zero otherwise.

  • Applies the same validation to config-file since/until; non-string values and invalid dates error via config_error for any command that applies shared options. Named pi-store errors remain gated to relevant commands.
  • Fixes command detection to account for root options with values (e.g., --last, --sections) so per-command config cannot bypass date checks.
  • Exports DATE_BOUND_FORMATS from ccusage-cli; normalize_date_bound now returns Option<String> and is used by ccusage-cli-parser and ccusage-config.
  • Docs clarify bounds are inclusive and invalid values cause a non-zero exit.

Migration

  • Use zero-padded YYYY-MM-DD or YYYYMMDD only; remove slashes/timestamps and fix impossible dates.
  • Ensure config since/until are strings; numeric values like 20260710 will now fail.
  • Expect failures on invalid CLI flags and config bounds with messages that state: Expected YYYY-MM-DD or YYYYMMDD.

Written for commit 5fc0736. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Date filters accept YYYY-MM-DD and YYYYMMDD formats.
    • Dates are normalized consistently, with both boundary dates included.
    • Configuration files apply the same date validation as command-line options.
  • Bug Fixes

    • Invalid formats, impossible dates, and non-calendar dates now produce descriptive errors and a non-zero exit code.
    • Leap-year dates are validated correctly.
  • Documentation

    • Updated CLI documentation with supported formats, inclusivity, and validation behavior.

Validate --since and --until as documented full-date formats, reject impossible calendar dates, and apply the same validation to config-file bounds. Keep the accepted formats and non-zero rejection behavior documented for scripts and users.

Co-authored-by: dok123 <[email protected]>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 15, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ccusage-guide 5fc0736 Commit Preview URL

Branch Preview URL
Aug 15 2026, 12:52 PM

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ff9a4d0a-2fc1-4c12-b347-391cb7a0c7c1

📥 Commits

Reviewing files that changed from the base of the PR and between fb1593e and 5fc0736.

📒 Files selected for processing (1)
  • rust/crates/ccusage-config/src/config.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • rust/crates/ccusage-config/src/config.rs

📝 Walkthrough

Walkthrough

--since and --until now accept only valid YYYY-MM-DD and YYYYMMDD dates. CLI and configuration values normalize to YYYYMMDD, reject invalid dates, and return errors. The shared format constant is publicly exported and documented.

Changes

Date-bound validation

Layer / File(s) Summary
Date normalization contract
rust/crates/ccusage-cli/src/types.rs, rust/crates/ccusage-cli/src/lib.rs, rust/crates/ccusage-cli/README.md, docs/guide/cli-options.md
normalize_date_bound now validates both supported formats and real calendar dates. Valid values normalize to YYYYMMDD; invalid values return None. The format constant is publicly exported and documented.
CLI date-bound parsing
rust/crates/ccusage-cli-parser/src/parser.rs, rust/crates/ccusage-cli-parser/src/tests.rs
--since and --until use validated parsing and return descriptive errors. Tests cover valid formats, malformed values, and impossible dates.
Configuration date-bound validation
rust/crates/ccusage-config/src/config.rs, rust/crates/ccusage-core/src/summary.rs
Configuration maps validate date bounds independently of Pi-store parsing. Shared options apply only successful normalizations. Configuration tests cover error gating, command parsing, invalid values, and normalized bounds.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 5fc07

The change rejects invalid date bounds and applies the same validation to configuration files; no actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant CLIParser
  participant normalize_date_bound
  participant ConfigContext
  CLIParser->>normalize_date_bound: validate CLI since/until value
  normalize_date_bound-->>CLIParser: YYYYMMDD or parse error
  ConfigContext->>normalize_date_bound: validate configured since/until value
  normalize_date_bound-->>ConfigContext: YYYYMMDD or configuration error
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #1483 by validating formats and calendar dates, reporting flag-specific errors, returning non-zero status, and validating configuration bounds.
Out of Scope Changes check ✅ Passed The documentation, tests, public constant, parser, configuration, and helper changes directly support date-bound validation.
Docstring Coverage ✅ Passed Docstring coverage is 85.19% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: rejecting invalid CLI date bounds.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-date-bound-clean

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

This PR still allows some invalid config bounds to bypass rejection. Please address the inline findings before merging.

Reviewed changes — Reviewed the complete date-bound validation change across the CLI parser, shared normalization, config loading, tests, and documentation.

  • CLI bound validation — Restricts --since and --until to the two documented formats and real calendar dates, then normalizes them to YYYYMMDD.
  • Config bound validation — Adds config-file validation and normalization while keeping named pi-store errors command-gated.
  • Regression coverage and documentation — Adds parser, CLI helper, config, and core test coverage and documents rejection behavior.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔Fix 👍s ➔View workflow run | Using GPT Luna (free via Pullfrog for OSS) | 𝕏

Comment thread rust/crates/ccusage-config/src/config.rs Outdated
Comment thread rust/crates/ccusage-config/src/config.rs

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 8 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="rust/crates/ccusage-config/src/config.rs">

<violation number="1" location="rust/crates/ccusage-config/src/config.rs:70">
P2: When an invalid `since`/`until` sits in `defaults` but a command-specific map in the same config overrides it with a valid value, the effective bound is valid yet `detect_date_bound_error` flags the overridden default first and `config_error()` rejects the whole invocation. It returns on the first invalid map instead of skipping values that a later, higher-precedence map overrides, while `apply_config_to_shared` lets that later map win. Consider validating the final effective bound (or skipping invalid values that a subsequent map overrides) so a valid command override is not spuriously rejected.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread rust/crates/ccusage-config/src/config.rs Outdated
Comment thread rust/crates/ccusage-config/src/config.rs
/// so the check runs here and surfaces through `config_error` for every
/// command that applies shared options, not just the pi-store readers.
fn detect_date_bound_error(&self) -> Option<String> {
self.option_maps().into_iter().find_map(|options| {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: When an invalid since/until sits in defaults but a command-specific map in the same config overrides it with a valid value, the effective bound is valid yet detect_date_bound_error flags the overridden default first and config_error() rejects the whole invocation. It returns on the first invalid map instead of skipping values that a later, higher-precedence map overrides, while apply_config_to_shared lets that later map win. Consider validating the final effective bound (or skipping invalid values that a subsequent map overrides) so a valid command override is not spuriously rejected.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At rust/crates/ccusage-config/src/config.rs, line 70:

<comment>When an invalid `since`/`until` sits in `defaults` but a command-specific map in the same config overrides it with a valid value, the effective bound is valid yet `detect_date_bound_error` flags the overridden default first and `config_error()` rejects the whole invocation. It returns on the first invalid map instead of skipping values that a later, higher-precedence map overrides, while `apply_config_to_shared` lets that later map win. Consider validating the final effective bound (or skipping invalid values that a subsequent map overrides) so a valid command override is not spuriously rejected.</comment>

<file context>
@@ -29,25 +29,57 @@ pub struct ConfigContext {
+    /// so the check runs here and surfaces through `config_error` for every
+    /// command that applies shared options, not just the pi-store readers.
+    fn detect_date_bound_error(&self) -> Option<String> {
+        self.option_maps().into_iter().find_map(|options| {
+            let options = SharedOptions::from_map(options);
+            [("since", options.since), ("until", options.until)]
</file context>

@pkg-pr-new

pkg-pr-new Bot commented Aug 15, 2026

Copy link
Copy Markdown

Open in StackBlitz

ccusage

npx https://pkg.pr.new/ccusage@1604

@ccusage/ccusage-darwin-arm64

npx https://pkg.pr.new/@ccusage/ccusage-darwin-arm64@1604

@ccusage/ccusage-darwin-x64

npx https://pkg.pr.new/@ccusage/ccusage-darwin-x64@1604

@ccusage/ccusage-linux-arm64

npx https://pkg.pr.new/@ccusage/ccusage-linux-arm64@1604

@ccusage/ccusage-linux-x64

npx https://pkg.pr.new/@ccusage/ccusage-linux-x64@1604

@ccusage/ccusage-win32-x64

npx https://pkg.pr.new/@ccusage/ccusage-win32-x64@1604

commit: 5fc0736

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: fb1593ebf1ee
Base SHA: bd7f89b469ae

This compares the Rust PR release binary against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 374.0ms 2.69 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 314.0ms 3.21 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 121.4ms 8.29 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 93.4ms 10.78 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 35.9ms 7.9ms 4.53x 55.25 MiB 24.96 MiB 0.45x 0.04 MiB/s 0.19 MiB/s
claude session --offline --json 0.00 MiB 30.9ms 8.1ms 3.80x 55.00 MiB 24.96 MiB 0.45x 0.05 MiB/s 0.19 MiB/s
codex daily --offline --json 0.00 MiB 30.2ms 7.5ms 4.04x 55.00 MiB 24.96 MiB 0.45x 0.03 MiB/s 0.11 MiB/s
codex session --offline --json 0.00 MiB 28.4ms 7.6ms 3.73x 55.00 MiB 24.96 MiB 0.45x 0.03 MiB/s 0.11 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 359.9ms 337.8ms 1.07x 968.84 MiB 951.10 MiB 0.98x 2.80 GiB/s 2.98 GiB/s
codex --offline --json 1.01 GiB 120.5ms 96.1ms 1.25x 437.14 MiB 417.42 MiB 0.95x 8.35 GiB/s 10.48 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 19.09 KiB 19.09 KiB -0.00 KiB 1.00x
installed native package binary 4244.66 KiB 4246.34 KiB +1.69 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: fb1593ebf1ee
Base SHA: bd7f89b469ae

This compares the PR package against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 347.3ms 2.90 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 307.4ms 3.27 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 140.0ms 7.19 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 112.8ms 8.93 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 40.6ms 29.9ms 1.36x 55.00 MiB 55.00 MiB 1.00x 0.04 MiB/s 0.05 MiB/s
claude session --offline --json 0.00 MiB 32.1ms 28.6ms 1.12x 55.00 MiB 55.00 MiB 1.00x 0.05 MiB/s 0.05 MiB/s
codex daily --offline --json 0.00 MiB 28.5ms 31.0ms 0.92x 55.00 MiB 55.00 MiB 1.00x 0.03 MiB/s 0.03 MiB/s
codex session --offline --json 0.00 MiB 28.6ms 31.8ms 0.90x 55.00 MiB 54.75 MiB 1.00x 0.03 MiB/s 0.03 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 365.5ms 342.7ms 1.07x 920.84 MiB 953.10 MiB 1.04x 2.75 GiB/s 2.94 GiB/s
codex --offline --json 1.01 GiB 117.5ms 144.9ms 0.81x 421.16 MiB 419.16 MiB 1.00x 8.57 GiB/s 6.95 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 19.09 KiB 19.09 KiB -0.00 KiB 1.00x
installed native package binary 4244.66 KiB 4246.34 KiB +1.69 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

Reject non-string config bounds and keep command detection aligned with root options that consume values. Add regressions for both paths so invalid date-bound configuration cannot be silently ignored.

Co-authored-by: dok123 <[email protected]>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes — Reviewed the commits since the prior Pullfrog review, focusing on raw config-bound validation and command detection around root options.

  • Rejected wrong-typed config bounds — Validated raw JSON values before typed option conversion so present non-string since and until values now fail through config_error.
  • Preserved command-specific validation — Classified root value-taking --last and --sections options so command maps remain correctly selected when those options precede the report command.
  • Retained date validation behavior — Confirmed the shared normalization, parser rejection, config handling, and regression tests remain consistent for documented formats and real calendar dates.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using GPT Luna (free via Pullfrog for OSS) | 𝕏

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 5fc0736d4f84
Base SHA: bd7f89b469ae

This compares the Rust PR release binary against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 363.2ms 2.77 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 314.9ms 3.20 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 124.8ms 8.07 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 97.6ms 10.31 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 39.0ms 8.3ms 4.70x 55.00 MiB 24.96 MiB 0.45x 0.04 MiB/s 0.19 MiB/s
claude session --offline --json 0.00 MiB 28.6ms 8.0ms 3.58x 55.00 MiB 24.97 MiB 0.45x 0.05 MiB/s 0.19 MiB/s
codex daily --offline --json 0.00 MiB 31.1ms 7.7ms 4.05x 55.00 MiB 24.71 MiB 0.45x 0.03 MiB/s 0.11 MiB/s
codex session --offline --json 0.00 MiB 29.2ms 14.9ms 1.96x 55.25 MiB 24.71 MiB 0.45x 0.03 MiB/s 0.06 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 369.2ms 332.3ms 1.11x 948.84 MiB 971.09 MiB 1.02x 2.73 GiB/s 3.03 GiB/s
codex --offline --json 1.01 GiB 117.6ms 95.9ms 1.23x 419.16 MiB 417.18 MiB 1.00x 8.56 GiB/s 10.50 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 19.09 KiB 19.09 KiB +0.00 KiB 1.00x
installed native package binary 4244.66 KiB 4246.34 KiB +1.69 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 5fc0736d4f84
Base SHA: bd7f89b469ae

This compares the PR package against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 356.1ms 2.83 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 328.4ms 3.07 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 126.3ms 7.97 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 97.0ms 10.38 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 40.5ms 36.7ms 1.10x 55.00 MiB 55.25 MiB 1.00x 0.04 MiB/s 0.04 MiB/s
claude session --offline --json 0.00 MiB 35.8ms 29.2ms 1.23x 55.00 MiB 55.00 MiB 1.00x 0.04 MiB/s 0.05 MiB/s
codex daily --offline --json 0.00 MiB 29.0ms 29.1ms 1.00x 54.75 MiB 55.00 MiB 1.00x 0.03 MiB/s 0.03 MiB/s
codex session --offline --json 0.00 MiB 31.1ms 29.4ms 1.06x 55.00 MiB 55.00 MiB 1.00x 0.03 MiB/s 0.03 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 358.4ms 338.9ms 1.06x 952.84 MiB 944.85 MiB 0.99x 2.81 GiB/s 2.97 GiB/s
codex --offline --json 1.01 GiB 123.4ms 118.2ms 1.04x 417.16 MiB 413.17 MiB 0.99x 8.16 GiB/s 8.52 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 19.09 KiB 19.09 KiB +0.00 KiB 1.00x
installed native package binary 4244.66 KiB 4246.34 KiB +1.69 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@ryoppippi
ryoppippi merged commit d40d20e into main Aug 15, 2026
41 checks passed
@ryoppippi
ryoppippi deleted the codex/fix-date-bound-clean branch August 15, 2026 13:14
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.

--since/--until accept invalid dates and silently return wrong results

1 participant