Skip to content

perf(ci): cache cargo deps and drop the duplicate Windows full test run (#404) - #413

Merged
2233admin merged 1 commit into
mainfrom
perf/issue-404-ci-cargo-cache
Oct 1, 2026
Merged

2233admin merged 1 commit into
mainfrom
perf/issue-404-ci-cargo-cache

Conversation

@2233admin

@2233admin 2233admin commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Advances #404 (measurement + first two changes). Required check names are unchanged.

Baseline (before): last 5 successful code-intel-ci runs

Source: gh run view <id> --json jobs. Durations are completedAt - startedAt per job/step, in minutes.

Run Event windows-build-test-package cross-platform-smoke (windows-latest) cross-platform-smoke (macos-latest) cross-platform-smoke (ubuntu-latest)
36836998948 workflow_dispatch 23.9 18.2 15.4 10.4
36836937358 pull_request 25.2 26.6 18.0 8.8
36835523404 workflow_dispatch 23.9 25.4 8.6 8.2
36833593926 pull_request 18.9 22.9 15.6 11.6
36625559254 pull_request 26.6 25.9 15.4 10.7
median 23.9 25.4 15.4 10.4
Step (median min, 5 runs) windows-build-test-package cross-platform-smoke (windows-latest) cross-platform-smoke (macos-latest) cross-platform-smoke (ubuntu-latest)
Rust check 0.5 0.5 0.5 0.3
Rust tests and core cross-contract gate 12.7 13.1 7.1 4.0
Build Rust CLI 4.5 4.6 3.5 2.4
Install packaged release via bootstrap.py – 2.5 1.2 1.0
Packaged sentrux-shim and legacy-entrypoint install smoke – 0.1 0.1 0.0
Pipeline smoke 1.5 1.5 1.2 1.0

Where the time goes (log of run 36836937358, Windows jobs): the cargo test step is about 3.5 min of compile (Finished test profile ... in 3m 28s / 3m 32s) plus about 9.5 min of test execution. Both Windows jobs ran that same step in the same run. Build Rust CLI is about 4.7 min, almost all of it the workspace crate under lto = "thin" and codegen-units = 1. Packaging is not the cost: Package and Verify beta package each take under 20 s.

Changes

  1. Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 is added right after Setup Rust in windows-build-test-package and in every leg of cross-platform-smoke. It is pinned by commit SHA with a version comment, the same style as actions/checkout, setup-python and upload-artifact. It caches ~/.cargo and the dependency artifacts in target/; the workspace crate is always rebuilt. The key includes the job id, the runner OS/arch, rustc, and the Cargo.lock/toolchain hashes. The cache is saved only on success, and PRs read caches saved on main.
  2. cross-platform-smoke (windows-latest) no longer runs cargo test -p code-intel --locked. The step now carries if: runner.os != 'Windows', so macOS and Ubuntu still run it.
  3. The pr-gate.yml header comment said ci.yml has no cache action. It is updated to match (no behaviour change). A CHANGELOG entry is added.

Why coverage holds

  • windows-build-test-package runs the identical command, cargo test -p code-intel --locked, on the same windows-latest image. Before it, both jobs run the same steps: checkout fetch-depth: 0, Python 3.14, layout tests, rustup toolchain install, choco ripgrep 14.1.0, pinned ast-grep, fmt, check. Neither job sets job-level env. The test set and its environment are therefore the same; the second run was pure duplication.

  • Everything the Windows smoke leg checks uniquely still runs there:

    • the package → bootstrap.py --local-asset install
    • the two install_smoke --ignored tests (packaged_install_runs_relocated_sentrux_shim, packaged_install_deploys_legacy_pipeline_entrypoint, DR-0001)
    • the packaged installer stale-home smoke
    • the packaged Sentrux capability closure
    • the Windows PATH/CODE_INTEL_HOME persistence assert
    • the merge-queue contract and the hardcoded-path scan

    Those install_smoke tests now compile their own test target in that step instead of reusing the full-suite build.

  • No test, gate, job name, matrix entry or timeout changed. Branch protection (gh api .../branches/main/protection) requires windows-build-test-package and cross-platform-smoke (windows-latest|macos-latest|ubuntu-latest); all four still report.

Local checks (AU-5090, this branch)

  • code-intel lint hardcoded-paths → Hardcoded path scan: OK (297 files)
  • code-intel repin --repo . → repin: clean — no stale pins
  • code-intel sentrux gate . → No degradation detected (Quality 6236 -> 6238, Coupling 63.33 -> 63.33)
  • legacy/scripts/tests/test-retirement-packets.ps1 → 8 packets, 2 audits, 0 known-blocked
  • python tests/test_repository_layout.py → 5 OK; both workflows parse with yaml.safe_load

After: measured on this PR

Run 36895945909. Attempt 1 is cold: no v0-rust-* cache existed in the repo, and every job logged No cache found. Attempt 2 is warm, started with gh run rerun 36895945909: every job logged Cache hit for: v0-rust-<job>-<OS>-... and restored about 108 MB (Ubuntu about 130 MB). Durations come from gh api repos/2233admin/code-intel-pipeline/actions/runs/36895945909/attempts/<n>/jobs, in minutes. Both attempts passed all four jobs.

Job Before (median of 5) Cold (attempt 1) Warm (attempt 2)
windows-build-test-package 23.9 24.9 24.1
cross-platform-smoke (windows-latest) 25.4 13.8 11.7
cross-platform-smoke (macos-latest) 15.4 17.6 13.7
cross-platform-smoke (ubuntu-latest) 10.4 10.6 8.8
Windows runner-minutes per trigger (both Windows jobs) 49.4 38.7 35.9
All four jobs, summed runner-minutes 75.2 66.9 58.3
code-intel-ci wall clock (first job start → last job end) 25.4 24.1 24.1
Step Job Before (median) Cold Warm
Cache cargo registry and dependency builds windows-build-test-package – 0.1 0.3
Rust check windows-build-test-package 0.5 0.5 0.3
Rust tests and core cross-contract gate windows-build-test-package 12.7 13.5 13.2
Build Rust CLI windows-build-test-package 4.5 4.5 3.9
Post Cache cargo registry and dependency builds windows-build-test-package – 0.1 0.0
Cache cargo registry and dependency builds cross-platform-smoke (windows-latest) – 0.1 0.1
Rust check cross-platform-smoke (windows-latest) 0.5 0.6 0.2
Rust tests and core cross-contract gate cross-platform-smoke (windows-latest) 13.1 skipped skipped
Build Rust CLI cross-platform-smoke (windows-latest) 4.6 4.8 4.0
Packaged sentrux-shim and legacy-entrypoint install smoke cross-platform-smoke (windows-latest) 0.1 0.9 0.7
Post Cache cargo registry and dependency builds cross-platform-smoke (windows-latest) – 0.1 0.0
Cache cargo registry and dependency builds cross-platform-smoke (macos-latest) – 0.1 0.1
Rust check cross-platform-smoke (macos-latest) 0.5 0.6 0.2
Rust tests and core cross-contract gate cross-platform-smoke (macos-latest) 7.1 7.7 6.2
Build Rust CLI cross-platform-smoke (macos-latest) 3.5 4.1 3.0
Packaged sentrux-shim and legacy-entrypoint install smoke cross-platform-smoke (macos-latest) 0.1 0.1 0.1
Post Cache cargo registry and dependency builds cross-platform-smoke (macos-latest) – 0.2 0.0
Cache cargo registry and dependency builds cross-platform-smoke (ubuntu-latest) – 0.0 0.1
Rust check cross-platform-smoke (ubuntu-latest) 0.3 0.4 0.1
Rust tests and core cross-contract gate cross-platform-smoke (ubuntu-latest) 4.0 3.7 3.1
Build Rust CLI cross-platform-smoke (ubuntu-latest) 2.4 2.5 2.1
Packaged sentrux-shim and legacy-entrypoint install smoke cross-platform-smoke (ubuntu-latest) 0.0 0.0 0.0
Post Cache cargo registry and dependency builds cross-platform-smoke (ubuntu-latest) – 0.1 0.0

What the numbers say

  • The duplicate removal is the main gain. cross-platform-smoke (windows-latest) dropped from 25.4 to 13.8 (cold) and 11.7 (warm) min, leaving about 16–18 min of headroom under its timeout-minutes: 30. That leg previously hit the timeout on PR docs: land DR-0013/DR-0014 and the issue-queue verdict layer #406. Only the install_smoke step got more expensive, and only slightly (0.1 → 0.9 / 0.7 min). The reason: it now compiles its own debug test target (Finished test profile ... in 50.13s cold, 35.80s warm) and no longer reuses the full-suite build. Both --ignored DR-0001 tests still ran and passed: packaged_install_runs_relocated_sentrux_shim ... ok and packaged_install_deploys_legacy_pipeline_entrypoint ... ok.
  • The cache helps but is small, as perf(ci): cargo 缓存缺失,Windows 每次触发跑两遍全量测试 #404 already predicted. rust-cache restores only dependencies. Warm runs saved about 0.2–0.4 min on cargo check and 0.4–1.1 min on the release build. The Windows test-profile compile did not change (2m 54s cold vs 2m 52s warm), because the code-intel workspace crate and its 70+ integration-test binaries dominate it. Restore takes ≤ 0.3 min and save takes ≤ 0.25 min, so the cache is net positive on every leg.
  • Wall clock is still set by windows-build-test-package (about 24 min). Its ~13 min cargo test step is about 3 min of compile plus about 9.5 min of test execution. This PR does not change that. The next lever is test execution time, for example the slow integration targets that take 50–105 s each in the baseline log. That is out of scope here because it changes how the tests run.
  • Single cold/warm pair: baseline job totals varied by ±4 min across runs, so the per-step rows are the reliable comparison, not the job totals.

Required checks on this PR

windows-build-test-package, cross-platform-smoke (windows-latest), cross-platform-smoke (macos-latest), cross-platform-smoke (ubuntu-latest): success on both attempts. change-risk, agent-gate, sentrux-capability-gate: pass.

@coderabbitai

coderabbitai Bot commented Oct 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 54 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 1e4bed6f-f1d2-468a-b469-3d4b90f02148

📥 Commits

Reviewing files that changed from the base of the PR and between b17d401 and 5a990c6.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • .github/workflows/pr-gate.yml
  • CHANGELOG.md
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Cache Cargo dependencies and skip duplicate Windows CI tests

⚙️ Configuration changes ✨ Enhancement 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Cache Cargo dependencies in both CI jobs to reduce repeated compilation.
• Run the full Windows Rust suite once while retaining cross-platform packaged-install checks.
• Document the optimization and clarify that the separate PR gate remains uncached.
Diagram

graph TD
  CI["CI workflow"] --> Win["Windows package"] --> WinCache["Windows cache"] --> Tests["Full Rust tests"]
  CI --> Matrix["Smoke matrix"] --> MatrixCache["Matrix caches"] --> Smoke["Install smoke"]
  MatrixCache -->|macOS/Linux| Tests
Loading
High-Level Assessment

The scoped change preserves the existing jobs and checks while removing only a demonstrably duplicate test invocation. Sharing Windows build artifacts or merging jobs could save more work, but would add job coupling and risk changing check behavior; neither is warranted for this first optimization.

Files changed (3) +23 / -5

Documentation (2) +5 / -5
pr-gate.ymlClarify the PR gate's uncached Rust build +4/-5

Clarify the PR gate's uncached Rust build

• Replaces an outdated comment claiming the main CI workflow has no dependency cache. The comment now notes that the PR gate still builds on an uncached runner.

.github/workflows/pr-gate.yml

CHANGELOG.mdRecord the CI performance optimization +1/-0

Record the CI performance optimization

• Documents the pinned dependency cache, removal of the duplicate Windows full test run, retained packaged-install checks, and unchanged required check names.

CHANGELOG.md

Other (1) +18 / -0
ci.ymlCache Rust dependencies and avoid the second Windows full test run +18/-0

Cache Rust dependencies and avoid the second Windows full test run

• Adds a SHA-pinned Rust cache action after toolchain setup in the Windows package job and every smoke-matrix leg. Limits the matrix's full Rust test step to non-Windows runners; the Windows package job still runs that suite, and packaged-install smoke checks remain in the matrix.

.github/workflows/ci.yml

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can keep summaries lean with Findings visible per group, which tucks the rest behind a View link

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

Code Intel change risk

Score Percentile Level
53/100 29th (vs last 49 commits) 🟢 low

Top signals

  • Diff shape: 3 file(s), +23/-5 (max file share 0.64)
  • Test asymmetry: source changed, tests touched
  • Bug-magnet: 45 fix commit(s) in touched files (180d)
  • Churn: 93 commit(s) touching these files (90d)

revspec: origin/main..HEAD · threshold: score >= 80 blocks unless labeled risk-accepted; percentile is reported, not gated (#201) · code-intel change risk

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

Code Intel Quality Signal

Completeness: complete · snapshot 4272307b9081 · commit ef4ff7cf4e03

Total Baseline Delta
6238 6236 [OK] 2

Bottleneck: none

Root cause Baseline Current Delta
Coupling 63.33 63.33 0
Complex functions 7 7 0
God files 33 33 0
Max complexity 80 80 0
Import cycles 0 0 0

The verified sentrux.scan payload has no upstream root_causes.<id> shape yet (#385 pending); projecting this engine's own currently-measured proxy metrics instead.

@2233admin
2233admin merged commit 109053a into main Oct 1, 2026
13 checks passed
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