Repository navigation
ci: shorten the Windows native build critical path - #1924
Conversation
rust-toolchain.toml lists clippy, rustfmt, and llvm-tools for local development, so the first cargo call on the Windows runners downloaded six components. Install the same channel with the minimal profile instead and pin it through RUSTUP_TOOLCHAIN, which rustup prefers over the toolchain file. The compiler, standard library, and target are unchanged; only the ~50 MB of xz archives (~430 MB unpacked) the build never uses are skipped.
Every Windows run, pull requests included, saved a fresh ~130 MB entry keyed on the commit, and the 5-10 s post-job save sat on the critical path before the npm job. Workspace crates recompile on every run regardless, because checkout gives their sources fresh mtimes, so only the dependency build is worth caching. Key the cache on the toolchain, Cargo config, lockfile, and manifests, and save it explicitly only on main outside pull requests when that key has no entry yet. Pull requests now restore what main wrote and never save. The release x64 leg restores what CI saves; arm64, which CI does not build, remains the writer of its own cache. The single-use setup-native-build-cache action is folded into the Windows action so restore and save share one key.
Workspace crates rebuild on every run, so their rlibs, fingerprints, build script outputs, and the final binary in rust/target/release are dead weight that every restore has to unpack. In a local release target they are about a quarter of its size. Remove them right before the save; dependency units keep their fingerprints and stay fresh.
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 3
✨ Finishing Touches
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. Comment |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
ccusage-guide | 69ac221 | Commit Preview URL Branch Preview URL |
Oct 18 2026, 03:26 PM |
ccusage
@ccusage/ccusage-darwin-arm64
@ccusage/ccusage-darwin-x64
@ccusage/ccusage-linux-arm64
@ccusage/ccusage-linux-x64
@ccusage/ccusage-win32-x64
commit: |
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runtime diagnosticsCompares 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
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated 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
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runtime diagnosticsCompares 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
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated 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
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
There was a problem hiding this comment.
ℹ️ No blocking issues found — CI-only optimization, verified end to end. Not approving per automation policy, not per concern.
Reviewed changes
- Minimal Rust toolchain on Windows: installs the
rust-toolchain.tomlchannel with--profile minimaland pins it viaRUSTUP_TOOLCHAIN, skipping clippy, rustfmt, and llvm-tools with no compiler change. - Dependency-keyed Cargo cache with main-only saves: separate restore/save steps keyed on the toolchain, Cargo config, lockfile, and manifests; pull requests restore only, saves happen on
refs/heads/mainoutside PR events on exact-key miss. - Pruned workspace outputs before save and folded the single-use cache action into
build-windows-native-packagewith asave-cargo-cacheinput;release.yamlrestores CI's cache on x64 and lets the arm64 leg own its key.
Correctness checks performed: no git = dependencies (dropping ~/.cargo/git is safe), every workspace crate name starts with ccusage so the prune globs hold, no remaining references to the deleted setup-native-build-cache action, and the x64 restore key matches between CI and release runners (Windows/X64). The one-off cold cache after merge is acknowledged in the PR description. Save gating via the prune step outcome correctly suppresses PR saves.
muse-spark-1.3-contributor (free via Pullfrog for OSS) | 𝕏
Upstream tip: c76874e (2026-10-20, chore(pricing): update models.dev snapshot) Previous fork base: 0c58b88 (the upstream commit this fork was synced to) Synced 83 upstream commits on top of 0c58b88: 56 automated pricing snapshot refreshes and the following meaningful ones: 1cd29f5 chore(deps): update pnpm to v12.13.0 (ccusage#1907) e4f63ba chore(deps): update node.js to >=24.22.0 (ccusage#1908) 130e502 ci: regenerate bun.nix automatically (ccusage#1909) 259ec33 feat(adapter): report stored cost in JSON model breakdowns (ccusage#1903) c1eb448 chore: release v20.0.35 (ccusage#1901) 2a0875f ci(pricing): update snapshots on push to main and daily instead of hourly (ccusage#1914) b090428 chore(deps): update github/codeql-action action to v4.39.0 (ccusage#1912) 4dcf7f5 fix(nix): pin models-dev-gen remeda to models.dev's version and stop Renovate drift (ccusage#1915) 46edb28 fix(nix): stop the dev shell from copying the whole repository (ccusage#1917) 58ec8f1 fix(nix): let commits succeed in worktrees without a loaded dev shell (ccusage#1920) a570a6f fix(nix): vendor Cargo deps without import-from-derivation (ccusage#1918) f6d28c5 fix(antigravity): map model IDs 1418/1419 to gemini-4-argon (ccusage#1905) ce439e5 fix(antigravity): map model ID 1050 to gemini-3.1-flash-lite (ccusage#1902) e62a66f chore(deps): update pnpm to v12.14.0 (ccusage#1923) 117ae68 ci(nix): make the macOS Nix cache save a trimmed store with the Crane layers (ccusage#1921) 7a063a0 ci: shorten the Windows native build critical path (ccusage#1924) 85ebca3 perf(rust): move pricing snapshots into a leaf crate (ccusage#1922) 8fe3f47 perf(nix): build Crane layers with the binary's feature resolution (ccusage#1925) ac289aa perf(pricing): give the pricing refresh a verify-only TLS 1.3 rustls provider (ccusage#1927) d097f74 chore(deps): update rust crate rustls to 0.23.46 (ccusage#1928) f8aaf89 docs: use the compact pkg.pr.new URL for bunx previews [ci skip] (ccusage#1929) f56bb3d chore: release v20.0.36 (ccusage#1916) aaafb41 chore(deps): update dependency vitepress-plugin-group-icons to ^1.8.1 (ccusage#1931) 0861e7f fix(claude): count requestless resp_ content blocks once (ccusage#1935) 867c9f3 chore: release v20.0.37 (ccusage#1933) fa40bfd chore(deps): update songmu/tagpr action to v1.21.3 (ccusage#1937) de99d15 chore(deps): update rust crate zstd to 0.14.3 (ccusage#1936) Fork wins kept: the SQLite on-disk cache with --live-only and the per-namespace ledger, the pi adapter and its per-path namespaces, the OpenCode V2 loader, the FxHash/Cow hot paths, the table renderer, clear-cache, and the tag-only release workflow. Upstream's own release and tagpr machinery stays out. Hand-resolved conflicts: rust/adapters/claude/src/lib.rs: upstream's resp_ message-id dedupe (ccusage#1935) lands beside the fork's requestless replay and collapse_replays rules. rust/adapters/claude/src/README.md: upstream's wording for the msg_/resp_ exception. rust/Cargo.toml: zstd 0.14.3, keeping the fork's exact `=` pin style. .github/workflows/release.yaml: the fork's tag-only release, without upstream's tagpr job or the songmu/tagpr action bump. apps/ccusage/package.json, docs/package.json, package.json: keep 20.0.34; upstream's 20.0.37 bump is dropped. packages/ccusage-*/package.json (6 files): stay deleted; the fork ships no npm wrapper packages and the release workflow does not read them. rust/adapters/claude/src/daily.rs: stays deleted; the fork's daily path lives in lib.rs and shares the dedupe helper the fix changes. Fixes made while landing this sync, folded in so the merge stands green on its own: fix(ci): save the Nix store from the native build composites. The nested cache-nix-action read an empty primary-key at post-job and every native build failed; upstream's defer-save pattern is the fix. fix(rust): keep the agent-recorded cost for deleted sources. The recorded_cost ledger column carries it, so storedCost survives a deleted file. The ledger schema version stays at 2: the column is not a LedgerEntry field, so the blob layout is unchanged and the previously released binary keeps working. fix(rust): make the file fingerprint helper private, the one hawk finding. It is inherited from the pre-sync master, not introduced here. Keep 20.0.34 numbering; DO NOT push a v20.0.34 tag from this fork (release.yaml would publish fork bytes under upstream identity).

Stack created with GitHub Stacks CLI • Give Feedback 💬
Summary
Shortens the
build-windows-x64/build-windows-arm64legs inci.yamlandrelease.yamlwithout changing what rustc produces: same toolchain version, profile, target, flags and command.What Changed
rust-toolchain.tomland runsrustup toolchain install <channel> --profile minimal. It pins the build to that channel withRUSTUP_TOOLCHAIN, which rustup prefers over the toolchain file, so cargo no longer installs clippy, rustfmt and llvm-tools. Only rustc, cargo and rust-std (3 of the 6 components) are installed now.rust-toolchain.toml,.cargo/config.toml,rust/Cargo.lockandrust/**/Cargo.tomlinstead ofgithub.sha.actions/cachesteps (same pinned SHA). The save runs only onrefs/heads/main, never forpull_requestorpull_request_targetevents, and only when that key has no entry yet.~/.cargo/gitis dropped from the cached paths (there are no git dependencies).ccusage*,deps/*ccusage*,.fingerprint/ccusage*,build/ccusage*) are deleted fromrust/target/release.setup-native-build-cacheaction is folded intobuild-windows-native-package.Why
From recent run logs, timed from when the runner picks up the job:
Dropping clippy, rustfmt and llvm-tools skips about 50 of about 150 MB of xz archives on x86_64 Windows. Unpacked on macOS, the toolchain shrinks from 980 MB to 552 MB. Workspace outputs are about a quarter of a release target dir and are rebuilt every run, so caching them only slows restores.
Testing
treefmt --ci(actionlint and zizmor with the repo config) is clean. zizmor reports no findings for the new Windows action.RUSTUP_TOOLCHAINset, cargo installs nothing beyond the minimal profile. Without it, cargo downloads the 3 extra components from the toolchain file.cargo checkrebuilt only theccusage-*crates; dependencies stayed fresh.~/.cargo/gitfrom the cached paths changes theactions/cacheversion hash, so no existingcargo-Windows-*entry can be restored, even through the restore-key. That is a one-off cost, not a regression. The main-only save, the pruned entry and exact-key hits only appear after merge, on main pushes and the next release.