Skip to content

Refine dotnet SDK version handling and tests#1870

Merged
j178 merged 5 commits into
dotnet-supportfrom
refine-dotnet
Mar 30, 2026
Merged

Refine dotnet SDK version handling and tests#1870
j178 merged 5 commits into
dotnet-supportfrom
refine-dotnet

Conversation

@j178

@j178 j178 commented Mar 30, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings March 30, 2026 11:57
@j178 j178 added the enhancement New feature or request label Mar 30, 2026
@codecov

codecov Bot commented Mar 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.47368% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.15%. Comparing base (39618ab) to head (f6f298f).
⚠️ Report is 1 commits behind head on dotnet-support.

Files with missing lines Patch % Lines
crates/prek/src/languages/dotnet/installer.rs 85.16% 23 Missing ⚠️
crates/prek/src/languages/dotnet/dotnet.rs 82.92% 14 Missing ⚠️
crates/prek/src/languages/dotnet/version.rs 97.50% 4 Missing ⚠️
crates/prek/src/languages/mod.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                 @@
##           dotnet-support    #1870      +/-   ##
==================================================
- Coverage           92.29%   92.15%   -0.15%     
==================================================
  Files                 112      112              
  Lines               22544    22457      -87     
==================================================
- Hits                20807    20695     -112     
- Misses               1737     1762      +25     

☔ View full report in Codecov by Sentry.
📢 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ca7d757e6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/prek/src/languages/dotnet/dotnet.rs Outdated
Comment thread crates/prek/src/languages/dotnet/installer.rs
Comment thread crates/prek/src/languages/dotnet/installer.rs

Copilot AI 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.

Pull request overview

Refines prek’s .NET language backend to better handle SDK version “channel” requests (including feature bands and LTS/STS), and updates documentation/tests to match the new parsing/installation behavior.

Changes:

  • Expand .NET language_version parsing to support channels (8, 8.0), feature bands (8.0.1xx), TFM aliases (net8.0), and tracks (lts/sts).
  • Rework the .NET installer to resolve/match requests via channel vs exact version, and add a dotnet-binary-name override env var for tests.
  • Update docs and integration tests/snapshots around .NET behavior and system-version failure cases.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
docs/languages.md Documents expanded dotnet language_version formats and behavior.
crates/prek/tests/run.rs Adds a system-dotnet system-language-version snapshot case.
crates/prek/tests/languages/dotnet.rs Replaces ad-hoc assertions with snapshots; adds more dotnet version-format coverage.
crates/prek/src/languages/mod.rs Minor enum/match reordering.
crates/prek/src/languages/dotnet/version.rs Implements richer dotnet request/channel parsing and matching + tests.
crates/prek/src/languages/dotnet/installer.rs Refactors installer to support channel/exact installs and probing via dotnet --version.
crates/prek/src/languages/dotnet/dotnet.rs Wires new installer/request handling into hook install/run logic.
crates/prek/src/languages/deno/deno.rs Uses toolchain_dir() helper for consistency.
crates/prek-consts/src/env_vars.rs Adds internal env var for overriding dotnet binary name.

Comment thread docs/languages.md
Comment thread crates/prek-consts/src/env_vars.rs Outdated
Comment thread crates/prek/src/languages/dotnet/dotnet.rs
Comment thread crates/prek/src/languages/dotnet/dotnet.rs Outdated
Comment thread crates/prek/src/languages/dotnet/installer.rs
@prek-ci-bot

prek-ci-bot Bot commented Mar 30, 2026

Copy link
Copy Markdown

📦 Cargo Bloat Comparison

Binary size change: +0.00% (25.5 MiB → 25.5 MiB)

Expand for cargo-bloat output

Head Branch Results

 File  .text     Size             Crate Name
 1.3%   2.6% 332.0KiB        aws_lc_sys aws_lc_0_39_0_aes_gcm_encrypt_avx512
 1.3%   2.6% 332.0KiB        aws_lc_sys aws_lc_0_39_0_aes_gcm_decrypt_avx512
 0.3%   0.7%  86.6KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.6%  79.7KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.6%  69.2KiB             prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.2%   0.5%  57.0KiB              prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.4%  51.0KiB annotate_snippets annotate_snippets::renderer::render::render
 0.2%   0.4%  47.7KiB              prek prek::run::{{closure}}
 0.2%   0.3%  42.2KiB              prek prek::cli::run::run::run::{{closure}}
 0.1%   0.3%  33.3KiB             prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.2%  28.0KiB        aws_lc_sys aws_lc_0_39_0_edwards25519_scalarmuldouble_alt
 0.1%   0.2%  27.8KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2%  27.5KiB        aws_lc_sys aws_lc_0_39_0_edwards25519_scalarmuldouble
 0.1%   0.2%  26.6KiB              prek prek::cli::try_repo::try_repo::{{closure}}
 0.1%   0.2%  26.6KiB               std core::ptr::drop_in_place<prek::languages::<impl prek::config::Language>::install::{{closure}}>
 0.1%   0.2%  23.9KiB             prek? <prek::config::_::<impl serde_core::de::Deserialize for prek::config::Config>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2%  22.4KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2%  22.3KiB         [Unknown] Lp384_montjscalarmul_alt_p384_montjadd
 0.1%   0.2%  21.5KiB              prek prek::workspace::Project::init_hooks::{{closure}}
 0.1%   0.2%  21.5KiB      clap_builder clap_builder::parser::parser::Parser::get_matches_with
41.5%  86.2%  10.6MiB                   And 23960 smaller methods. Use -n N to show more.
48.2% 100.0%  12.3MiB                   .text section size, the file size is 25.5MiB

Base Branch Results

 File  .text     Size             Crate Name
 1.3%   2.6% 332.0KiB        aws_lc_sys aws_lc_0_39_0_aes_gcm_encrypt_avx512
 1.3%   2.6% 332.0KiB        aws_lc_sys aws_lc_0_39_0_aes_gcm_decrypt_avx512
 0.3%   0.7%  88.6KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.7%  82.4KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.6%  69.2KiB             prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.2%   0.5%  62.6KiB              prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.4%  51.0KiB annotate_snippets annotate_snippets::renderer::render::render
 0.2%   0.4%  47.9KiB              prek prek::run::{{closure}}
 0.2%   0.3%  41.8KiB              prek prek::cli::run::run::run::{{closure}}
 0.1%   0.3%  33.3KiB             prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.2%  28.0KiB        aws_lc_sys aws_lc_0_39_0_edwards25519_scalarmuldouble_alt
 0.1%   0.2%  27.8KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2%  27.7KiB               std core::ptr::drop_in_place<prek::languages::<impl prek::config::Language>::install::{{closure}}>
 0.1%   0.2%  27.5KiB        aws_lc_sys aws_lc_0_39_0_edwards25519_scalarmuldouble
 0.1%   0.2%  26.6KiB              prek prek::cli::try_repo::try_repo::{{closure}}
 0.1%   0.2%  24.6KiB             prek? <prek::config::_::<impl serde_core::de::Deserialize for prek::config::Config>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2%  22.4KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2%  22.3KiB         [Unknown] Lp384_montjscalarmul_alt_p384_montjadd
 0.1%   0.2%  21.5KiB      clap_builder clap_builder::parser::parser::Parser::get_matches_with
 0.1%   0.2%  21.5KiB         [Unknown] Lp384_montjscalarmul_p384_montjadd
41.5%  86.1%  10.6MiB                   And 23948 smaller methods. Use -n N to show more.
48.3% 100.0%  12.3MiB                   .text section size, the file size is 25.5MiB

@prek-ci-bot

prek-ci-bot Bot commented Mar 30, 2026

Copy link
Copy Markdown

⚡️ Hyperfine Benchmarks

Summary: 0 regressions, 0 improvements above the 10% threshold.

Environment
  • OS: Linux 6.17.0-1008-azure
  • CPU: 4 cores
  • prek version: prek 0.3.8+12 (b82b4f8 2026-03-30)
  • Rust version: rustc 1.94.1 (e408947bf 2026-03-25)
  • Hyperfine version: hyperfine 1.20.0
CLI Commands

Benchmarking basic commands in the main repo:

prek --version

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base --version 2.4 ± 0.2 2.1 3.1 1.08 ± 0.11
prek-head --version 2.2 ± 0.1 2.1 3.3 1.00

prek list

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base list 8.8 ± 0.3 8.3 10.1 1.00
prek-head list 8.9 ± 0.4 8.3 9.7 1.02 ± 0.06

prek validate-config .pre-commit-config.yaml

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base validate-config .pre-commit-config.yaml 3.0 ± 0.1 2.9 3.2 1.04 ± 0.04
prek-head validate-config .pre-commit-config.yaml 2.9 ± 0.1 2.8 3.1 1.00

prek sample-config

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base sample-config 2.5 ± 0.1 2.4 2.8 1.03 ± 0.04
prek-head sample-config 2.4 ± 0.0 2.4 2.6 1.00
Cold vs Warm Runs

Comparing first run (cold) vs subsequent runs (warm cache):

prek run --all-files (cold - no cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --all-files 139.5 ± 4.5 131.4 148.1 1.00
prek-head run --all-files 141.8 ± 5.5 133.6 148.4 1.02 ± 0.05

prek run --all-files (warm - with cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --all-files 142.8 ± 3.9 135.9 152.7 1.00
prek-head run --all-files 143.1 ± 4.5 134.1 149.3 1.00 ± 0.04
Full Hook Suite

Running the builtin hook suite on the benchmark workspace:

prek run --all-files (full builtin hook suite)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --all-files 145.8 ± 3.3 137.0 153.7 1.00
prek-head run --all-files 146.7 ± 20.6 134.5 286.0 1.01 ± 0.14
Individual Hook Performance

Benchmarking each hook individually on the test repo:

prek run trailing-whitespace --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run trailing-whitespace --all-files 21.0 ± 0.8 19.7 22.8 1.00
prek-head run trailing-whitespace --all-files 21.5 ± 1.4 19.9 26.2 1.03 ± 0.08

prek run end-of-file-fixer --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run end-of-file-fixer --all-files 27.5 ± 2.5 24.3 32.8 1.01 ± 0.13
prek-head run end-of-file-fixer --all-files 27.1 ± 2.6 23.7 32.4 1.00

prek run check-json --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-json --all-files 13.1 ± 0.3 12.5 13.8 1.07 ± 0.04
prek-head run check-json --all-files 12.2 ± 0.4 11.6 13.3 1.00

prek run check-yaml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-yaml --all-files 12.0 ± 0.3 11.4 12.5 1.01 ± 0.05
prek-head run check-yaml --all-files 11.9 ± 0.4 11.0 12.9 1.00

prek run check-toml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-toml --all-files 11.8 ± 0.4 11.2 12.6 1.00
prek-head run check-toml --all-files 12.4 ± 0.4 11.7 13.5 1.05 ± 0.05

prek run check-xml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-xml --all-files 12.0 ± 0.4 11.3 12.8 1.00
prek-head run check-xml --all-files 12.3 ± 0.4 11.4 13.0 1.03 ± 0.05

prek run detect-private-key --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run detect-private-key --all-files 18.7 ± 1.4 15.9 21.8 1.06 ± 0.10
prek-head run detect-private-key --all-files 17.7 ± 1.1 15.9 20.0 1.00

prek run fix-byte-order-marker --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run fix-byte-order-marker --all-files 22.8 ± 1.8 20.0 26.2 1.00
prek-head run fix-byte-order-marker --all-files 23.9 ± 1.6 21.2 26.7 1.05 ± 0.11
Installation Performance

Benchmarking hook installation (fast path hooks skip Python setup):

prek install-hooks (cold - no cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base install-hooks 4.7 ± 0.1 4.6 4.8 1.00
prek-head install-hooks 4.9 ± 0.1 4.7 5.1 1.03 ± 0.03

prek install-hooks (warm - with cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base install-hooks 5.0 ± 0.1 4.8 5.2 1.02 ± 0.03
prek-head install-hooks 4.9 ± 0.1 4.8 5.1 1.00
File Filtering/Scoping Performance

Testing different file selection modes:

prek run (staged files only)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run 49.7 ± 1.4 46.5 52.1 1.00
prek-head run 51.5 ± 1.9 48.9 55.9 1.04 ± 0.05

prek run --files '*.json' (specific file type)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --files '*.json' 8.9 ± 0.5 8.1 9.5 1.00
prek-head run --files '*.json' 9.1 ± 0.2 8.8 9.4 1.03 ± 0.06
Workspace Discovery & Initialization

Benchmarking hook discovery and initialization overhead:

prek run --dry-run --all-files (measures init overhead)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --dry-run --all-files 13.7 ± 0.3 13.1 14.1 1.01 ± 0.03
prek-head run --dry-run --all-files 13.6 ± 0.3 13.2 14.2 1.00
Meta Hooks Performance

Benchmarking meta hooks separately:

prek run check-hooks-apply --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-hooks-apply --all-files 14.4 ± 0.3 13.6 15.0 1.03 ± 0.06
prek-head run check-hooks-apply --all-files 14.0 ± 0.8 12.8 15.0 1.00

prek run check-useless-excludes --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-useless-excludes --all-files 12.5 ± 0.3 12.1 13.1 1.01 ± 0.05
prek-head run check-useless-excludes --all-files 12.4 ± 0.5 11.8 13.5 1.00

prek run identity --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run identity --all-files 10.9 ± 0.4 10.3 11.7 1.02 ± 0.05
prek-head run identity --all-files 10.6 ± 0.3 10.1 11.2 1.00

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a2d3204a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/prek-consts/src/env_vars.rs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 48c5a853d2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/prek/src/languages/dotnet/installer.rs Outdated
@j178 j178 merged commit ad30852 into dotnet-support Mar 30, 2026
55 of 56 checks passed
@j178 j178 deleted the refine-dotnet branch March 30, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants