Detect prek installed by the standalone installer#1545
Conversation
7d100e8 to
a2e4a41
Compare
There was a problem hiding this comment.
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
StandaloneInstallervariant to theInstallSourceenum - 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::AxoUpdatershould be conditional on theself-updatefeature, just like its usage. Currently, this import will cause a compilation error when the crate is built without theself-updatefeature becauseaxoupdateris an optional dependency.
The import should be changed to:
#[cfg(feature = "self-update")]
use axoupdater::AxoUpdater;use std::ffi::OsStr;
| 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()?) |
There was a problem hiding this comment.
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.
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
📦 Cargo Bloat ComparisonBinary size change: +0.00% (23.2 MiB → 23.2 MiB) Expand for cargo-bloat outputHead Branch ResultsBase Branch Results |
a2e4a41 to
7bbeeb7
Compare
7bbeeb7 to
70643bc
Compare
No description provided.