Skip to content

Isolate local hook environment installation - #2615

Merged
j178 merged 4 commits into
masterfrom
local-install-cwd
Aug 26, 2026
Merged

j178 merged 4 commits into
masterfrom
local-install-cwd

Conversation

@j178

@j178 j178 commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Closes #1603

Copilot AI lite review requested due to automatic review settings August 26, 2026 08:16
@j178 j178 added the bug Something isn't working label Aug 26, 2026

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.92308% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.97%. Comparing base (b24be22) to head (4328138).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
crates/prek/src/cli/run/install.rs 85.71% 1 Missing ⚠️
crates/prek/src/languages/haskell.rs 95.65% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2615   +/-   ##
=======================================
  Coverage   93.96%   93.97%           
=======================================
  Files         140      140           
  Lines       29659    29690   +31     
=======================================
+ Hits        27869    27900   +31     
  Misses       1790     1790           

☔ 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.

@prek-ci-bot

prek-ci-bot Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

📦 Cargo Bloat Comparison

.text size change: +0.00% (12.5 MiB → 12.5 MiB)

Expand for cargo-bloat output

Head Branch Results

File  .text     Size             Crate Name
0.1%   2.6% 332.0KiB        aws_lc_sys aws_lc_0_44_0_aes_gcm_encrypt_avx512
0.1%   2.6% 332.0KiB        aws_lc_sys aws_lc_0_44_0_aes_gcm_decrypt_avx512
0.0%   0.9% 113.5KiB              prek <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
0.0%   0.4%  50.6KiB              prek <<prek::config::hook::HookWire as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
0.0%   0.4%  48.7KiB annotate_snippets annotate_snippets::renderer::render::render
0.0%   0.3%  44.6KiB              prek prek::run::{closure#0}
0.0%   0.3%  44.1KiB              prek <<prek::config::Config as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
0.0%   0.3%  37.1KiB              prek <prek::cli::RunOptions as clap_builder::derive::Args>::augment_args
0.0%   0.3%  35.5KiB              prek <prek::languages::rust::rust::Rust as prek::languages::LanguageBackend>::install::{closure#0}
0.0%   0.3%  33.5KiB              prek prek::cli::run::run::run::{closure#0}
0.0%   0.2%  29.0KiB              prek prek::archive::unpack::<fs_err::tokio::file::File, &std::path::PathBuf>::{closure#0}
0.0%   0.2%  28.6KiB      serde_saphyr <granit_parser::scanner::Scanner<granit_parser::input::str::StrInput>>::fetch_more_tokens
0.0%   0.2%  28.0KiB        aws_lc_sys aws_lc_0_44_0_edwards25519_scalarmuldouble_alt
0.0%   0.2%  27.8KiB      serde_saphyr <granit_parser::scanner::Scanner<granit_parser::input::str::StrInput>>::fetch_more_tokens
0.0%   0.2%  27.5KiB        aws_lc_sys aws_lc_0_44_0_edwards25519_scalarmuldouble
0.0%   0.2%  27.3KiB              toml <toml::de::deserializer::value::ValueDeserializer as serde_core::de::Deserializer>::deserialize_any::<<prek::config::hook::HookWire as serde_core::de::Deserialize>::deserialize::__Visitor>
0.0%   0.2%  27.0KiB              prek prek::archive::unpack::<fs_err::tokio::file::File, &std::path::PathBuf>::{closure#0}
0.0%   0.2%  27.0KiB              prek prek::archive::unpack::<fs_err::tokio::file::File, &std::path::PathBuf>::{closure#0}
0.0%   0.2%  27.0KiB              prek prek::archive::unpack::<fs_err::tokio::file::File, &std::path::PathBuf>::{closure#0}
0.0%   0.2%  27.0KiB              prek prek::archive::unpack::<fs_err::tokio::file::File, &std::path::PathBuf>::{closure#0}
4.2%  86.6%  10.8MiB                   And 20271 smaller methods. Use -n N to show more.
4.9% 100.0%  12.5MiB                   .text section size, the file size is 256.9MiB

Base Branch Results

File  .text     Size             Crate Name
0.1%   2.6% 332.0KiB        aws_lc_sys aws_lc_0_44_0_aes_gcm_encrypt_avx512
0.1%   2.6% 332.0KiB        aws_lc_sys aws_lc_0_44_0_aes_gcm_decrypt_avx512
0.0%   0.9% 113.3KiB              prek <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
0.0%   0.4%  51.4KiB              prek <<prek::config::hook::HookWire as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
0.0%   0.4%  48.7KiB annotate_snippets annotate_snippets::renderer::render::render
0.0%   0.4%  47.5KiB              prek prek::run::{closure#0}
0.0%   0.3%  44.6KiB              prek <<prek::config::Config as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
0.0%   0.3%  36.6KiB              prek <prek::cli::RunOptions as clap_builder::derive::Args>::augment_args
0.0%   0.3%  33.8KiB              prek <prek::languages::rust::rust::Rust as prek::languages::LanguageBackend>::install::{closure#0}
0.0%   0.3%  33.6KiB              prek prek::cli::run::run::run::{closure#0}
0.0%   0.2%  28.6KiB      serde_saphyr <granit_parser::scanner::Scanner<granit_parser::input::str::StrInput>>::fetch_more_tokens
0.0%   0.2%  28.4KiB              prek prek::archive::unpack::<fs_err::tokio::file::File, &std::path::PathBuf>::{closure#0}
0.0%   0.2%  28.0KiB        aws_lc_sys aws_lc_0_44_0_edwards25519_scalarmuldouble_alt
0.0%   0.2%  27.8KiB      serde_saphyr <granit_parser::scanner::Scanner<granit_parser::input::str::StrInput>>::fetch_more_tokens
0.0%   0.2%  27.5KiB        aws_lc_sys aws_lc_0_44_0_edwards25519_scalarmuldouble
0.0%   0.2%  27.4KiB              toml <toml::de::deserializer::value::ValueDeserializer as serde_core::de::Deserializer>::deserialize_any::<<prek::config::hook::HookWire as serde_core::de::Deserialize>::deserialize::__Visitor>
0.0%   0.2%  27.0KiB              prek prek::archive::unpack::<fs_err::tokio::file::File, &std::path::PathBuf>::{closure#0}
0.0%   0.2%  27.0KiB              prek prek::archive::unpack::<fs_err::tokio::file::File, &std::path::PathBuf>::{closure#0}
0.0%   0.2%  27.0KiB              prek prek::archive::unpack::<fs_err::tokio::file::File, &std::path::PathBuf>::{closure#0}
0.0%   0.2%  26.9KiB              prek prek::archive::unpack::<fs_err::tokio::file::File, &std::path::PathBuf>::{closure#0}
4.2%  86.6%  10.8MiB                   And 20313 smaller methods. Use -n N to show more.
4.9% 100.0%  12.5MiB                   .text section size, the file size is 256.6MiB

@prek-ci-bot

prek-ci-bot Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

⚡️ Hyperfine Benchmarks

Summary: 6 regressions, 7 improvements above the 10% threshold.

Environment
  • OS: Linux 6.17.0-1022-azure
  • CPU: 4 cores
  • prek version: prek 0.4.14+33 (e093766 2026-08-26)
  • Rust version: rustc 1.98.0 (88d9e12ae 2026-08-18)
  • 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 1.8 ± 0.1 1.6 2.0 1.01 ± 0.08
prek-head --version 1.7 ± 0.1 1.6 2.0 1.00

prek list

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base list 10.9 ± 16.4 7.0 111.6 1.03 ± 2.16
prek-head list 10.6 ± 15.4 6.9 109.9 1.00

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

⏭️ Skipped: .pre-commit-config.yaml not found

prek sample-config

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base sample-config 2.3 ± 1.7 1.9 14.1 1.15 ± 0.87
prek-head sample-config 2.0 ± 0.1 1.8 2.2 1.00

✅ Performance improvement for prek sample-config: 13.2200% faster

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 27.0 ± 1.8 24.4 30.5 1.06 ± 0.08
prek-head run --all-files 25.5 ± 1.2 23.2 27.0 1.00

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

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --all-files 38.3 ± 53.5 24.2 265.4 1.36 ± 1.89
prek-head run --all-files 28.2 ± 1.4 26.0 31.3 1.00

✅ Performance improvement for prek run --all-files (warm - with cache): 26.3300% faster

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 29.5 ± 3.6 26.0 48.9 1.05 ± 0.14
prek-head run --all-files 28.0 ± 1.7 25.0 33.8 1.00
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 10.0 ± 2.5 8.5 23.2 1.07 ± 0.32
prek-head run trailing-whitespace --all-files 9.3 ± 1.4 8.3 16.2 1.00

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 8.3 ± 1.5 7.3 15.9 1.00
prek-head run end-of-file-fixer --all-files 25.4 ± 71.9 7.3 377.3 3.06 ± 8.69

⚠️ Warning: Performance regression for prek run end-of-file-fixer --all-files: 205.7400% slower

prek run check-json --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-json --all-files 24.4 ± 92.1 5.4 509.8 4.20 ± 15.85
prek-head run check-json --all-files 5.8 ± 0.3 5.3 6.3 1.00

✅ Performance improvement for prek run check-json --all-files: 76.2000% faster

prek run check-yaml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-yaml --all-files 6.4 ± 2.5 5.4 19.1 1.05 ± 0.51
prek-head run check-yaml --all-files 6.1 ± 1.8 5.2 13.7 1.00

prek run check-toml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-toml --all-files 5.8 ± 0.3 5.3 6.4 1.00
prek-head run check-toml --all-files 11.6 ± 25.4 5.3 141.2 2.02 ± 4.42

⚠️ Warning: Performance regression for prek run check-toml --all-files: 101.8900% slower

prek run check-xml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-xml --all-files 18.9 ± 42.0 5.3 184.7 2.92 ± 6.80
prek-head run check-xml --all-files 6.5 ± 4.5 5.2 30.2 1.00

✅ Performance improvement for prek run check-xml --all-files: 65.8100% faster

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

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run detect-private-key --all-files 9.2 ± 5.1 7.0 34.5 1.00
prek-head run detect-private-key --all-files 15.1 ± 23.7 7.2 111.4 1.64 ± 2.74

⚠️ Warning: Performance regression for prek run detect-private-key --all-files: 64.0200% slower

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 11.1 ± 3.0 9.2 25.5 1.06 ± 0.36
prek-head run fix-byte-order-marker --all-files 10.5 ± 2.0 9.1 20.9 1.00
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 3.5 ± 0.1 3.4 3.6 1.01 ± 0.03
prek-head install-hooks 3.5 ± 0.1 3.4 3.5 1.00

prek install-hooks (warm - with cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base install-hooks 3.6 ± 0.2 3.4 3.8 1.03 ± 0.07
prek-head install-hooks 3.5 ± 0.1 3.3 3.7 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 16.9 ± 0.4 16.2 17.8 1.00
prek-head run 20.3 ± 9.8 16.4 52.1 1.20 ± 0.58

⚠️ Warning: Performance regression for prek run (staged files only): 19.5300% slower

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

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --files '*.json' 4.1 ± 0.2 3.8 4.4 1.00
prek-head run --files '*.json' 6.0 ± 7.9 3.8 39.5 1.47 ± 1.94

⚠️ Warning: Performance regression for prek run --files '*.json' (specific file type): 47.2400% slower

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 11.0 ± 25.1 4.9 117.6 1.90 ± 4.41
prek-head run --dry-run --all-files 5.8 ± 2.5 4.8 16.2 1.00

✅ Performance improvement for prek run --dry-run --all-files (measures init overhead): 47.4900% faster

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 6.8 ± 1.2 6.4 11.2 1.12 ± 0.20
prek-head run check-hooks-apply --all-files 6.1 ± 0.3 5.6 6.6 1.00

✅ Performance improvement for prek run check-hooks-apply --all-files: 10.8200% faster

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

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-useless-excludes --all-files 7.7 ± 5.4 5.9 27.2 1.00
prek-head run check-useless-excludes --all-files 15.7 ± 26.5 5.8 104.7 2.03 ± 3.70

⚠️ Warning: Performance regression for prek run check-useless-excludes --all-files: 103.0700% slower

prek run identity --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run identity --all-files 26.3 ± 80.7 5.2 318.2 5.00 ± 15.32
prek-head run identity --all-files 5.3 ± 0.1 4.9 5.5 1.00

✅ Performance improvement for prek run identity --all-files: 80.0000% faster

Copilot AI review requested due to automatic review settings August 26, 2026 08:44

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 26, 2026 11:49

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 26, 2026 12:09

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@j178
j178 merged commit 70360ea into master Aug 26, 2026
36 checks passed
@j178
j178 deleted the local-install-cwd branch August 26, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Different cwd compared to pre-commit when installing additional_deps of repo: local

2 participants