Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1919 +/- ##
==========================================
- Coverage 92.09% 92.07% -0.02%
==========================================
Files 112 112
Lines 22913 22936 +23
==========================================
+ Hits 21101 21119 +18
- Misses 1812 1817 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e57b84a550
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Improves prek auto-update’s handling of pinned commit SHAs by detecting whether the commit is actually present in the locally fetched (partial) repository view, preventing “impostor”/branch-only commits from being treated as available during auto-update evaluation.
Changes:
- Add a commit-presence check using
git --no-lazy-fetch cat-file -eto avoid partial-clone lazy fetching during auto-update diagnostics. - Adjust frozen-comment mismatch diagnostics to reflect “present vs not present” semantics and remove dry-run-specific phrasing from warning notes.
- Update and extend integration tests/snapshots, including a new branch-only pinned commit case.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
crates/prek/src/cli/auto_update.rs |
Implements commit presence detection without lazy fetching and updates frozen-comment warning rendering. |
crates/prek/tests/auto_update.rs |
Updates snapshots for new warning text and adds coverage for branch-only pinned commits. |
📦 Cargo Bloat ComparisonBinary size change: +0.00% (25.7 MiB → 25.7 MiB) Expand for cargo-bloat outputHead Branch ResultsBase Branch Results |
⚡️ Hyperfine BenchmarksSummary: 0 regressions, 0 improvements above the 10% threshold. Environment
CLI CommandsBenchmarking basic commands in the main repo:
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base --version |
2.2 ± 0.1 | 2.1 | 2.5 | 1.03 ± 0.05 |
prek-head --version |
2.2 ± 0.1 | 2.0 | 2.4 | 1.00 |
prek list
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base list |
9.1 ± 0.3 | 8.6 | 10.0 | 1.02 ± 0.05 |
prek-head list |
9.0 ± 0.4 | 8.5 | 10.7 | 1.00 |
prek validate-config .pre-commit-config.yaml
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base validate-config .pre-commit-config.yaml |
3.2 ± 0.1 | 3.0 | 3.4 | 1.07 ± 0.04 |
prek-head validate-config .pre-commit-config.yaml |
3.0 ± 0.1 | 2.8 | 3.2 | 1.00 |
prek sample-config
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base sample-config |
2.5 ± 0.1 | 2.4 | 2.6 | 1.03 ± 0.03 |
prek-head sample-config |
2.5 ± 0.1 | 2.4 | 2.7 | 1.00 |
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 |
142.4 ± 5.3 | 137.4 | 153.6 | 1.01 ± 0.05 |
prek-head run --all-files |
141.3 ± 3.8 | 135.2 | 146.1 | 1.00 |
prek run --all-files (warm - with cache)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run --all-files |
141.2 ± 3.5 | 135.7 | 146.6 | 1.00 |
prek-head run --all-files |
143.2 ± 2.8 | 138.8 | 150.2 | 1.01 ± 0.03 |
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 |
141.4 ± 3.4 | 133.3 | 148.1 | 1.01 ± 0.03 |
prek-head run --all-files |
140.3 ± 3.4 | 133.1 | 147.4 | 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 |
20.7 ± 0.8 | 19.7 | 22.9 | 1.00 |
prek-head run trailing-whitespace --all-files |
21.0 ± 1.0 | 19.3 | 23.2 | 1.02 ± 0.06 |
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 |
33.9 ± 20.9 | 23.8 | 109.7 | 1.28 ± 0.80 |
prek-head run end-of-file-fixer --all-files |
26.4 ± 2.1 | 23.4 | 30.4 | 1.00 |
prek run check-json --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-json --all-files |
11.6 ± 0.5 | 10.8 | 12.9 | 1.03 ± 0.05 |
prek-head run check-json --all-files |
11.2 ± 0.3 | 10.7 | 11.9 | 1.00 |
prek run check-yaml --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-yaml --all-files |
11.2 ± 0.5 | 10.7 | 13.5 | 1.02 ± 0.05 |
prek-head run check-yaml --all-files |
11.0 ± 0.2 | 10.7 | 11.7 | 1.00 |
prek run check-toml --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-toml --all-files |
11.3 ± 0.6 | 10.7 | 13.8 | 1.01 ± 0.06 |
prek-head run check-toml --all-files |
11.1 ± 0.3 | 10.6 | 11.8 | 1.00 |
prek run check-xml --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-xml --all-files |
11.6 ± 0.8 | 10.9 | 15.3 | 1.05 ± 0.07 |
prek-head run check-xml --all-files |
11.0 ± 0.3 | 10.6 | 11.7 | 1.00 |
prek run detect-private-key --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run detect-private-key --all-files |
17.4 ± 1.2 | 15.4 | 20.2 | 1.02 ± 0.10 |
prek-head run detect-private-key --all-files |
17.2 ± 1.2 | 15.5 | 20.1 | 1.00 |
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 |
22.5 ± 1.5 | 19.4 | 24.7 | 1.03 ± 0.10 |
prek-head run fix-byte-order-marker --all-files |
21.9 ± 1.6 | 19.2 | 24.7 | 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 |
4.5 ± 0.1 | 4.4 | 4.6 | 1.03 ± 0.02 |
prek-head install-hooks |
4.4 ± 0.1 | 4.3 | 4.5 | 1.00 |
prek install-hooks (warm - with cache)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base install-hooks |
4.6 ± 0.1 | 4.5 | 4.7 | 1.05 ± 0.02 |
prek-head install-hooks |
4.4 ± 0.0 | 4.3 | 4.4 | 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 |
49.0 ± 1.2 | 47.1 | 51.4 | 1.01 ± 0.04 |
prek-head run |
48.7 ± 1.3 | 46.9 | 51.5 | 1.00 |
prek run --files '*.json' (specific file type)
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run --files '*.json' |
8.3 ± 0.1 | 8.1 | 8.6 | 1.00 |
prek-head run --files '*.json' |
8.3 ± 0.1 | 8.0 | 8.5 | 1.00 ± 0.02 |
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 |
13.1 ± 0.5 | 12.7 | 14.4 | 1.02 ± 0.04 |
prek-head run --dry-run --all-files |
12.9 ± 0.2 | 12.5 | 13.4 | 1.00 |
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 |
13.1 ± 0.2 | 12.8 | 13.7 | 1.00 |
prek-head run check-hooks-apply --all-files |
13.2 ± 0.2 | 12.8 | 13.4 | 1.00 ± 0.02 |
prek run check-useless-excludes --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run check-useless-excludes --all-files |
12.8 ± 0.7 | 11.7 | 13.8 | 1.09 ± 0.06 |
prek-head run check-useless-excludes --all-files |
11.8 ± 0.1 | 11.6 | 12.1 | 1.00 |
prek run identity --all-files
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
prek-base run identity --all-files |
10.4 ± 0.1 | 10.2 | 10.5 | 1.00 |
prek-head run identity --all-files |
10.5 ± 0.2 | 10.1 | 10.9 | 1.02 ± 0.02 |
|
Unsure of the performance impact of this, but just an idea -- it would be ideal if this check could automatically happen during hook installation. Most folks probably won't manually execute this to check if they have a malicious config file, but if it's surfaced during normal workflows, everyone will reap the benefit. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e9ef05f849
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if no_lazy_fetch_unsupported(&output.stderr) { | ||
| let _ = GIT_SUPPORTS_NO_LAZY_FETCH.set(false); | ||
| return Ok(CommitPresence::Unknown); | ||
| } |
There was a problem hiding this comment.
Preserve frozen-comment checks when no-lazy-fetch is unsupported
On Git versions like 2.43, git --no-lazy-fetch ... returns unknown option, and this branch forces CommitPresence::Unknown; that flows into collect_frozen_mismatches as FrozenMismatch::NoReplacement, so stale frozen comments for valid, untagged pinned SHAs are no longer removed and --check can pass even when the frozen marker is stale. I verified the command behavior locally on Git 2.43 and traced it to this return path, so this is not just theoretical compatibility drift.
Useful? React with 👍 / 👎.
|
@shaanmajid Good idea. I started with During installation we currently use shallow clones ( Adding the check in |
Detect pinned commits without lazy fetching during auto-update.
git --no-lazy-fetch cat-file -eCloses #1864