Skip to content

Detect prek installed by the standalone installer#1545

Merged
j178 merged 1 commit intomasterfrom
installer-install
Feb 3, 2026
Merged

Detect prek installed by the standalone installer#1545
j178 merged 1 commit intomasterfrom
installer-install

Conversation

@j178
Copy link
Owner

@j178 j178 commented Feb 3, 2026

No description provided.

@j178 j178 added the enhancement New feature or request label Feb 3, 2026
Copilot AI review requested due to automatic review settings February 3, 2026 07:26
@j178 j178 force-pushed the installer-install branch from 7d100e8 to a2e4a41 Compare February 3, 2026 07:28
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 pull request adds detection for prek installations made via the standalone installer, enabling the tool to provide appropriate update instructions based on how it was installed. The PR adds a new StandaloneInstaller variant to the InstallSource enum and implements detection logic using the AxoUpdater receipt system.

Changes:

  • Added StandaloneInstaller variant to the InstallSource enum
  • Implemented receipt-based detection for standalone installer installations using AxoUpdater
  • Added corresponding update instructions ("prek self update") and description text
Comments suppressed due to low confidence (1)

crates/prek/src/install_source.rs:1

  • The import of axoupdater::AxoUpdater should be conditional on the self-update feature, just like its usage. Currently, this import will cause a compilation error when the crate is built without the self-update feature because axoupdater is an optional dependency.

The import should be changed to:

#[cfg(feature = "self-update")]
use axoupdater::AxoUpdater;
use std::ffi::OsStr;

Comment on lines +37 to +42
fn is_standalone_installer() -> anyhow::Result<bool> {
use axoupdater::AxoUpdater;

let mut updater = AxoUpdater::new_for("prek");
let updater = updater.load_receipt()?;
Ok(updater.check_receipt_is_for_this_executable()?)
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

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

The new standalone installer detection functionality lacks test coverage. The existing test suite has comprehensive coverage for Homebrew detection and unknown paths, but there are no tests for the new StandaloneInstaller variant or the is_standalone_installer() method.

Consider adding tests that verify the standalone installer detection behavior, including cases where the receipt is found and valid, not found, or invalid. This is especially important given that the detection logic differs from the path-based Homebrew detection.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.56%. Comparing base (3b0ea8c) to head (70643bc).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
crates/prek/src/install_source.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1545      +/-   ##
==========================================
- Coverage   91.57%   91.56%   -0.01%     
==========================================
  Files          91       91              
  Lines       17873    17875       +2     
==========================================
+ Hits        16367    16368       +1     
- Misses       1506     1507       +1     

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

@prek-ci-bot
Copy link

prek-ci-bot bot commented Feb 3, 2026

📦 Cargo Bloat Comparison

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

Expand for cargo-bloat output

Head Branch Results

 File  .text    Size             Crate Name
 0.3%   0.7% 72.1KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.7% 71.9KiB             prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.3%   0.7% 65.7KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.2%   0.5% 51.2KiB annotate_snippets annotate_snippets::renderer::render::render
 0.2%   0.5% 50.8KiB              prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.4% 43.4KiB              prek prek::identify::by_extension::{{closure}}
 0.2%   0.4% 43.0KiB              prek prek::run::{{closure}}
 0.2%   0.4% 41.5KiB              prek prek::cli::run::run::run::{{closure}}
 0.1%   0.3% 32.0KiB             prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.3% 28.4KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.3% 24.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.6KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2% 22.1KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 21.2KiB      clap_builder clap_builder::parser::parser::Parser::get_matches_with
 0.1%   0.2% 20.0KiB   cargo_metadata? <cargo_metadata::_::<impl serde_core::de::Deserialize for cargo_metadata::Package>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2% 19.8KiB              prek prek::archive::unzip::{{closure}}
 0.1%   0.2% 19.7KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 19.5KiB              prek prek::cli::run::filter::collect_files_from_args::{{closure}}
 0.1%   0.2% 19.3KiB               std core::ptr::drop_in_place<prek::languages::<impl prek::config::Language>::install::{{closure}}>
 0.1%   0.2% 19.3KiB              prek <prek::languages::ruby::ruby::Ruby as prek::languages::LanguageImpl>::install::{{closure}}
37.9%  91.2%  8.8MiB                   And 20437 smaller methods. Use -n N to show more.
41.5% 100.0%  9.6MiB                   .text section size, the file size is 23.2MiB

Base Branch Results

 File  .text    Size             Crate Name
 0.3%   0.7% 72.1KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.7% 71.9KiB             prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.3%   0.7% 65.7KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.2%   0.5% 51.2KiB annotate_snippets annotate_snippets::renderer::render::render
 0.2%   0.5% 50.8KiB              prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.4% 43.4KiB              prek prek::identify::by_extension::{{closure}}
 0.2%   0.4% 43.0KiB              prek prek::run::{{closure}}
 0.2%   0.4% 41.5KiB              prek prek::cli::run::run::run::{{closure}}
 0.1%   0.3% 32.0KiB             prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.3% 28.4KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.3% 24.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.6KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2% 22.1KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 21.2KiB      clap_builder clap_builder::parser::parser::Parser::get_matches_with
 0.1%   0.2% 20.0KiB   cargo_metadata? <cargo_metadata::_::<impl serde_core::de::Deserialize for cargo_metadata::Package>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2% 19.8KiB              prek prek::archive::unzip::{{closure}}
 0.1%   0.2% 19.7KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 19.5KiB              prek prek::cli::run::filter::collect_files_from_args::{{closure}}
 0.1%   0.2% 19.3KiB               std core::ptr::drop_in_place<prek::languages::<impl prek::config::Language>::install::{{closure}}>
 0.1%   0.2% 19.3KiB        serde_json serde_json::value::de::<impl serde_core::de::Deserialize for serde_json::value::Value>::deserialize
37.8%  91.2%  8.8MiB                   And 20444 smaller methods. Use -n N to show more.
41.5% 100.0%  9.6MiB                   .text section size, the file size is 23.2MiB

@j178 j178 force-pushed the installer-install branch from a2e4a41 to 7bbeeb7 Compare February 3, 2026 07:36
Base automatically changed from install-hint to master February 3, 2026 10:11
@j178 j178 force-pushed the installer-install branch from 7bbeeb7 to 70643bc Compare February 3, 2026 10:12
@j178 j178 merged commit b14a3c2 into master Feb 3, 2026
49 checks passed
@j178 j178 deleted the installer-install branch February 3, 2026 10:29
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