Skip to content

test: cover platform-specific branches and Windows package managers - #519

Open
shenxianpeng wants to merge 2 commits into
mainfrom
claude/project-thread-hkr6q2
Open

shenxianpeng wants to merge 2 commits into
mainfrom
claude/project-thread-hkr6q2

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Raises coverage of the lines Codecov reported as missed on main (99.43%, 38 lines). No behavior change.

Platform branches (pypi.rs, static_dist.rs): these used std::env::consts / cfg!() inline, so CI (Linux and Windows on x86_64) could never run the macOS and arm64 arms. They are now small functions that take the OS and architecture as arguments, and a table test checks every combination:

  • PlatformTag::is_arch_compatible(sys_os, sys_arch)
  • StaticDistDownloader::asset_name(tool, major, os, arch) (the binary name now uses std::env::consts::EXE_SUFFIX)

Windows package managers (native_packages/windows.rs, 20 missed lines): winget is not on the CI runners, so its output parsing never ran, and installs never succeed there. The Chocolatey and winget parsing loops were duplicates, so they are now one is_listed() (header lines and name column depend on the manager), and the install result is check_install(). Unit tests use sample choco list / winget list output and fake Outputs. These tests only build on Windows; I checked them with cargo clippy --tests --target x86_64-pc-windows-gnu -- -D warnings, and the Windows CI job runs them.

clang-tidy: new test apply_fixes_without_matching_note: a fix whose diagnostic has no matching note is still applied, and the fix for another file is returned without a note.

Lines still not covered (all unreachable)

File Line Why
rest_client.rs 151, 186, 285 ? on make_comment() / SarifLog::new(), which only fail on a poisoned mutex. post_feedback() already returned that error from tally_tidy_advice() at the start.
common_fs.rs 385, 390 ? on writing a patch into a String (fmt::Write for String never fails).
progress_bar.rs 141 ? on a write! into the buffered stdout lock; it only buffers, and the following flush() reports errors.
pypi.rs the closing } of if let Some(parent) = extracted_bin.parent() A joined file path always has a parent.
utils.rs 21 Component::Prefix(..) => unreachable!()

Stable Rust coverage has no way to exclude single lines, and rewriting these just for the number seemed wrong. Happy to change any of them if you prefer.

Related Issues

Follows #486 and #491.

Summary by CodeRabbit

  • Bug Fixes
    • Windows package checks now more accurately identify installed packages and verify requested versions. Failed package manager commands are reported as unsuccessful, with installation errors including available error details.
    • Tool downloads now select assets based on the system’s operating system and architecture, improving compatibility across supported platforms.
  • Tests
    • Added coverage for Windows package listing and installation results, platform compatibility, download asset selection, and applying fixes when a related note is on another line.

- Move the wheel architecture check into PlatformTag::is_arch_compatible()
  and the static binary asset name into StaticDistDownloader::asset_name(),
  both taking the OS and architecture as arguments. Tests now check every
  supported OS and architecture, not only the one CI runs on.
- Windows: move the parsing of `choco list` / `winget list` output into
  is_listed() and the install result into check_install(), with unit tests
  using sample output. winget is not on the CI runners, so its parsing was
  never tested.
- clang-tidy: test a fix whose diagnostic has no matching note.
@shenxianpeng shenxianpeng self-assigned this Oct 22, 2026
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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 19 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
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d69109a0-415b-4799-8431-475eac6d9126
📥 Commits

Reviewing files that changed from the base of the PR and between 296102b and a2d19e1.

📒 Files selected for processing: 1
  • clang-tools-manager/src/downloader/native_packages/windows.rs

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cfdae84b-5c14-4000-a4c4-5c16c49bf2a4
📥 Commits

Reviewing files that changed from the base of the PR and between 2d7f2dc and 296102b.

📒 Files selected for processing: 4
  • clang-tools-manager/src/downloader/native_packages/windows.rs
  • clang-tools-manager/src/downloader/pypi.rs
  • clang-tools-manager/src/downloader/static_dist.rs
  • cpp-linter/src/clang_tools/clang_tidy/test.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

The pull request consolidates Windows package-list and installation-result handling, extracts Python wheel architecture compatibility checks, builds static distribution asset names from runtime platform values, and adds a clang-tidy fix test for a diagnostic without a matching note.

Changes: Windows package handling

Layer / File(s) Summary
Windows package command handling
clang-tools-manager/src/downloader/native_packages/windows.rs
Chocolatey and Winget list output use shared package and version parsing. Installation results use shared success and error handling. Tests cover list parsing and installation results for both managers.

PyPI platform compatibility

Layer / File(s) Summary
Wheel architecture matching
clang-tools-manager/src/downloader/pypi.rs
System architecture compatibility delegates to a helper that retains the existing platform mappings. Tests cover supported and rejected Windows, macOS, Linux, and other combinations.

Static distribution asset naming

Layer / File(s) Summary
Runtime asset selection
clang-tools-manager/src/downloader/static_dist.rs
A helper maps operating-system and architecture values to asset names. The downloader uses runtime values to form the asset path. Tests cover Linux, macOS, and Windows asset names.

Clang-tidy fix coverage

Layer / File(s) Summary
Fixes without a matching note
cpp-linter/src/clang_tools/clang_tidy/test.rs
A test checks that the source replacement applies when no diagnostic note matches, and that the other-file fix has no associated note.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 29610

No identified issue needs correction before merge; normal checks remain appropriate.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main changes: added coverage for platform-specific branches and Windows package-manager behavior. It is concise and related to the pull request.
Docstring Coverage Passed Docstring coverage is 82.61% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 4 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

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.

@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.88%. Comparing base (7c551a7) to head (a2d19e1).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #519      +/-   ##
==========================================
+ Coverage   99.43%   99.88%   +0.44%     
==========================================
  Files          28       28              
  Lines        6774     6860      +86     
==========================================
+ Hits         6736     6852     +116     
+ Misses         38        8      -30     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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.

2 participants