Skip to content

Conversation

@lmmx
Copy link
Contributor

@lmmx lmmx commented Dec 2, 2025

  • As discussed in Feature request - cooldown period on autoupdate #1152
  • Default cooldown: 1 day, secure by default
  • Minimum cooldown: 0 days (no cooldown), making it opt-out
  • Maximum cooldown: 255 days (u8::MAX), this is more than is typical (Dependabot's is 90 days).
    • No particular handling exists (yet?) for users attempting to put an excessive/invalid number of days

It works 🎉

  • I ensured the existing tests will still work by passing cooldown as 0 days.

Demo

If I rewind the crate-ci/typos hook in the prek repo itself to the last tagged release before 1.40

  • v1.40.0 of the typos hook was released on 2025-11-26, 5½ days ago from today 2025-12-02
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 82ee65a..80e9539 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -15,7 +15,7 @@ repos:
         exclude: docs/cli.md # Exclude generated doc
 
   - repo: https://github.com/crate-ci/typos
-    rev: v1.40.0
+    rev: v1.39.0
     hooks:
       - id: typos
  • 7 day cooldown would mean it had another day to cool off
  • 6 day cooldown would mean it would be ready today (at the exact hour)
    • The exact time was 8:26PM GMT, current time is 11:55AM GMT (so it would still be cooling off)
  • 5 day cooldown would mean it would have been ready yesterday (so will definitely update)
louis 🌟 ~/dev/prek $ prek auto-update --cooldown-days 7
[https://github.com/crate-ci/typos] already up to date
[https://github.com/pre-commit/pre-commit-hooks] already up to date
louis 🌟 ~/dev/prek $ prek auto-update --cooldown-days 6
[https://github.com/crate-ci/typos] already up to date
[https://github.com/pre-commit/pre-commit-hooks] already up to date
louis 🌟 ~/dev/prek $ prek auto-update --cooldown-days 5
[https://github.com/crate-ci/typos] updating v1.39.0 -> v1.40.0
[https://github.com/pre-commit/pre-commit-hooks] already up to date

@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

❌ Patch coverage is 91.61677% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.77%. Comparing base (b5be7c6) to head (853c728).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
src/cli/auto_update.rs 91.41% 28 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1172      +/-   ##
==========================================
+ Coverage   89.73%   89.77%   +0.03%     
==========================================
  Files          78       78              
  Lines       14767    15077     +310     
==========================================
+ Hits        13251    13535     +284     
- Misses       1516     1542      +26     

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

@github-actions
Copy link

github-actions bot commented Dec 2, 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.3% 106.7KiB          prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.6%   1.3% 100.4KiB           prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.7%  54.6KiB           prek prek::archive::unpack::{{closure}}
 0.3%   0.7%  53.0KiB             h2 h2::proto::connection::Connection<T,P,B>::poll
 0.3%   0.6%  48.6KiB           prek prek::run::{{closure}}
 0.2%   0.5%  40.0KiB           prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.5%  39.2KiB          prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.2%   0.5%  37.3KiB regex_automata regex_automata::meta::strategy::new
 0.2%   0.4%  35.2KiB           prek prek::workspace::Workspace::discover
 0.2%   0.4%  31.4KiB           std? <core::marker::PhantomData<T> as serde_core::de::DeserializeSeed>::deserialize
 0.2%   0.4%  30.1KiB           prek prek::cli::run::run::run::{{closure}}
 0.2%   0.4%  28.8KiB           prek prek::languages::node::installer::NodeInstaller::install::{{closure}}
 0.2%   0.4%  28.1KiB             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.1KiB           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.4KiB           std? <core::marker::PhantomData<T> as serde_core::de::DeserializeSeed>::deserialize
 0.1%   0.3%  24.3KiB     hyper_util hyper_util::client::legacy::client::Client<C,B>::connect_to::{{closure}}::{{closure}}::{{closure}}
 0.1%   0.3%  24.2KiB           prek prek::hook::HookBuilder::build::{{closure}}
 0.1%   0.3%  23.9KiB          hyper hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_loop
41.2%  88.8%   6.9MiB                And 10645 smaller methods. Use -n N to show more.
46.3% 100.0%   7.7MiB                .text section size, the file size is 16.7MiB

Base Branch Results

 File  .text     Size          Crate Name
 0.6%   1.3% 104.8KiB          prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.6%   1.3% 100.4KiB           prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.7%  54.6KiB           prek prek::archive::unpack::{{closure}}
 0.3%   0.7%  53.0KiB             h2 h2::proto::connection::Connection<T,P,B>::poll
 0.3%   0.6%  48.6KiB           prek prek::run::{{closure}}
 0.2%   0.5%  40.0KiB           prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.5%  39.2KiB          prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.2%   0.5%  37.3KiB regex_automata regex_automata::meta::strategy::new
 0.2%   0.4%  35.2KiB           prek prek::workspace::Workspace::discover
 0.2%   0.4%  31.4KiB           std? <core::marker::PhantomData<T> as serde_core::de::DeserializeSeed>::deserialize
 0.2%   0.4%  30.1KiB           prek prek::cli::run::run::run::{{closure}}
 0.2%   0.4%  28.8KiB           prek prek::languages::node::installer::NodeInstaller::install::{{closure}}
 0.2%   0.4%  28.1KiB             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.1KiB           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.4KiB           std? <core::marker::PhantomData<T> as serde_core::de::DeserializeSeed>::deserialize
 0.1%   0.3%  24.3KiB     hyper_util hyper_util::client::legacy::client::Client<C,B>::connect_to::{{closure}}::{{closure}}::{{closure}}
 0.1%   0.3%  24.2KiB           prek prek::hook::HookBuilder::build::{{closure}}
 0.1%   0.3%  23.9KiB          hyper hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_loop
41.1%  88.8%   6.8MiB                And 10633 smaller methods. Use -n N to show more.
46.3% 100.0%   7.7MiB                .text section size, the file size is 16.7MiB

@lmmx lmmx force-pushed the autoupdate-cooldown branch from 3495780 to 2ee43d6 Compare December 2, 2025 11:19
@lmmx lmmx changed the title feat: implement cooldown (default: 1 day) feat(autoupdate): implement cooldown (default: 1 day) Dec 2, 2025
@lmmx lmmx changed the title feat(autoupdate): implement cooldown (default: 1 day) feat(autoupdate): add cooldown-days option (default: 1) Dec 2, 2025
@lmmx lmmx changed the title feat(autoupdate): add cooldown-days option (default: 1) feat(autoupdate): --cooldown-days flag (default: 1) Dec 2, 2025
@lmmx lmmx changed the title feat(autoupdate): --cooldown-days flag (default: 1) feat(auto-update): --cooldown-days flag (default: 1) Dec 2, 2025
@lmmx lmmx force-pushed the autoupdate-cooldown branch 2 times, most recently from 9ae99da to c9bf8cf Compare December 2, 2025 11:48
@lmmx lmmx force-pushed the autoupdate-cooldown branch 2 times, most recently from 21c8c10 to 3db5ff4 Compare December 4, 2025 14:24
@j178 j178 added the enhancement New feature or request label Dec 7, 2025
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