Skip to content

Implement priority based parallel execution#1232

Merged
j178 merged 18 commits intomasterfrom
concurent/priority
Dec 20, 2025
Merged

Implement priority based parallel execution#1232
j178 merged 18 commits intomasterfrom
concurent/priority

Conversation

@j178
Copy link
Owner

@j178 j178 commented Dec 17, 2025

Closes #1242

@j178 j178 added the internal Internal changes label Dec 17, 2025
@j178 j178 changed the title concurent/priority Implement priority based parallel exeuction Dec 17, 2025
@github-actions
Copy link

github-actions bot commented Dec 17, 2025

📦 Cargo Bloat Comparison

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

Expand for cargo-bloat output

Head Branch Results

 File  .text     Size          Crate Name
 0.6%   1.4% 107.3KiB          prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.6%   1.4% 107.2KiB           prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.7%  54.7KiB           prek prek::archive::unpack::{{closure}}
 0.3%   0.7%  52.8KiB             h2 h2::proto::connection::Connection<T,P,B>::poll
 0.2%   0.5%  39.2KiB          prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.2%   0.5%  38.4KiB           prek prek::run::{{closure}}
 0.2%   0.5%  38.3KiB           prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.5%  37.3KiB          hyper hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_loop
 0.2%   0.5%  36.9KiB regex_automata regex_automata::meta::strategy::new
 0.2%   0.5%  36.5KiB           prek prek::workspace::Workspace::discover
 0.2%   0.4%  30.8KiB           std? <core::marker::PhantomData<T> as serde_core::de::DeserializeSeed>::deserialize
 0.2%   0.4%  30.7KiB           prek prek::cli::run::run::run::{{closure}}
 0.2%   0.4%  29.8KiB           prek prek::languages::rust::installer::RustInstaller::install::{{closure}}
 0.2%   0.4%  28.4KiB           prek prek::languages::node::installer::NodeInstaller::install::{{closure}}
 0.2%   0.4%  27.9KiB             h2 h2::proto::connection::DynConnection<B>::recv_frame
 0.2%   0.3%  27.6KiB           prek prek::identify::by_extension::{{closure}}
 0.2%   0.3%  25.7KiB           prek prek::cli::run::run::run_hooks::{{closure}}
 0.1%   0.3%  25.3KiB           prek prek::main
 0.1%   0.3%  24.4KiB     hyper_util hyper_util::client::legacy::client::Client<C,B>::send_request::{{closure}}
 0.1%   0.3%  24.3KiB        globset globset::GlobSetBuilder::build
41.2%  88.6%   6.9MiB                And 10633 smaller methods. Use -n N to show more.
46.5% 100.0%   7.7MiB                .text section size, the file size is 16.7MiB

Base Branch Results

 File  .text     Size          Crate Name
 0.6%   1.4% 107.3KiB          prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.6%   1.3% 100.6KiB           prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.7%  54.7KiB           prek prek::archive::unpack::{{closure}}
 0.3%   0.7%  52.8KiB             h2 h2::proto::connection::Connection<T,P,B>::poll
 0.2%   0.5%  39.2KiB          prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.2%   0.5%  38.4KiB           prek prek::run::{{closure}}
 0.2%   0.5%  38.3KiB           prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.5%  37.3KiB          hyper hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_loop
 0.2%   0.5%  36.9KiB regex_automata regex_automata::meta::strategy::new
 0.2%   0.5%  36.5KiB           prek prek::workspace::Workspace::discover
 0.2%   0.4%  30.8KiB           std? <core::marker::PhantomData<T> as serde_core::de::DeserializeSeed>::deserialize
 0.2%   0.4%  30.7KiB           prek prek::cli::run::run::run::{{closure}}
 0.2%   0.4%  29.8KiB           prek prek::languages::rust::installer::RustInstaller::install::{{closure}}
 0.2%   0.4%  28.4KiB           prek prek::languages::node::installer::NodeInstaller::install::{{closure}}
 0.2%   0.4%  27.9KiB             h2 h2::proto::connection::DynConnection<B>::recv_frame
 0.2%   0.3%  27.6KiB           prek prek::identify::by_extension::{{closure}}
 0.1%   0.3%  25.4KiB           prek prek::main
 0.1%   0.3%  24.4KiB     hyper_util hyper_util::client::legacy::client::Client<C,B>::send_request::{{closure}}
 0.1%   0.3%  24.3KiB        globset globset::GlobSetBuilder::build
 0.1%   0.3%  24.2KiB     hyper_util hyper_util::client::legacy::client::Client<C,B>::connect_to::{{closure}}::{{closure}}::{{closure}}
41.1%  88.7%   6.9MiB                And 10614 smaller methods. Use -n N to show more.
46.4% 100.0%   7.7MiB                .text section size, the file size is 16.7MiB

@j178 j178 force-pushed the concurent/priority branch from db475ed to cf503c4 Compare December 17, 2025 10:41
@j178 j178 marked this pull request as draft December 17, 2025 13:59
@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

❌ Patch coverage is 96.95431% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.03%. Comparing base (93926c9) to head (e2f1293).
⚠️ Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
crates/prek/src/cli/run/run.rs 97.70% 6 Missing ⚠️
crates/prek/src/cli/auto_update.rs 16.66% 5 Missing ⚠️
crates/prek/src/languages/mod.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1232      +/-   ##
==========================================
+ Coverage   89.84%   90.03%   +0.18%     
==========================================
  Files          79       80       +1     
  Lines       15264    15627     +363     
==========================================
+ Hits        13714    14069     +355     
- Misses       1550     1558       +8     

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

@j178 j178 force-pushed the concurent/priority branch from aadac61 to f4cd927 Compare December 18, 2025 17:21
@j178 j178 marked this pull request as ready for review December 19, 2025 04:31
@j178 j178 force-pushed the concurent/priority branch from adb756a to fc5faaf Compare December 19, 2025 05:17
@j178 j178 force-pushed the concurent/priority branch from fc5faaf to 9a88892 Compare December 19, 2025 11:14
@j178 j178 changed the base branch from concurrent to master December 19, 2025 13:07
@j178 j178 added enhancement New feature or request and removed internal Internal changes labels Dec 19, 2025
@j178 j178 force-pushed the concurent/priority branch from a2523a4 to 9d6a84f Compare December 20, 2025 03:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements priority-based parallel execution for hooks, allowing hooks with the same priority value to run concurrently while maintaining sequential execution for hooks with different priorities. When no priority is specified, hooks automatically receive a unique priority based on their index in the configuration file, preserving backward-compatible sequential behavior.

Key changes:

  • Added priority field to hook configuration (type u32, defaults to hook index)
  • Hooks with same priority run in parallel, subject to global concurrency limits
  • New grouped output UI for parallel hooks that modify files
  • Enhanced progress reporting during hook execution

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
docs/proposals/concurrency.md New design proposal documenting priority-based parallel execution model
docs/diff.md Added documentation about parallel execution by priority
docs/configuration.md Added priority field documentation with examples
docs/README.md Added feature note about parallel hook execution
crates/prek/src/config.rs Added priority field to HookOptions struct
crates/prek/src/hook.rs Added priority field to Hook struct with auto-assignment logic
crates/prek/src/cli/run/run.rs Refactored hook execution to support priority groups and parallel execution
crates/prek/src/cli/reporter.rs Added HookRunReporter for progress tracking during hook execution
crates/prek/src/languages/*.rs Updated all language implementations to accept reporter parameter
crates/prek/src/run.rs Simplified result collection using try_collect
crates/prek/tests/run.rs Added comprehensive tests for priority ordering, fail-fast, and grouped output
Cargo.toml Moved textwrap to dev-dependencies (no longer used in production)
crates/prek/Cargo.toml Updated dependency configuration
Various test files Updated snapshots for new output format

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@j178 j178 changed the title Implement priority based parallel exeuction Implement priority based parallel execution Dec 20, 2025
j178 and others added 2 commits December 20, 2025 11:55
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@j178 j178 merged commit 1c9d1f5 into master Dec 20, 2025
21 checks passed
@j178 j178 deleted the concurent/priority branch December 20, 2025 04:09
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.

Support priority-based parallel hook execution

1 participant