← Back to Pull requests

feat(install): warn about hooks that won't run with the installed shims #2205

Closed
unknown closed this pull request without merging on Nov 02, 2026 20:25 UTC
View on GitHub
unknown unknown commented on Jun 11, 2026 20:34 UTC
Author

This PR was written in part with the assistance of generative AI.

Closes #2056

What

prek install only installs shims for the hook types you ask for — --hook-type, or default_install_hook_types, falling back to pre-commit. If the config has hooks pinned to a different stage (the classic case being a slower stages: [pre-push] hook), those hooks just silently never run after a plain prek install, and it's easy not to notice.

This adds a warning at install time that names the hooks whose stages aren't covered and points at the fix:

warning: The following hooks won't run automatically because their stages aren't being installed:
  - `push-only` (pre-push)
hint: install the missing hook type(s) with `prek install --hook-type <type>`, or set `default_install_hook_types` in your config.

Notes on the approach

  • Config only, no hook init. Each hook's stages are resolved straight from config (stages → default_stages → all), so install stays offline and fast. The trade-off is that a remote hook narrowed only by its manifest (not by the project config) won't be flagged — that's the conservative choice: no false positives, no new network I/O, and it covers the case from the issue.

  • manual is skipped, since manual-only hooks have no Git shim and aren't meant to run automatically.

  • Pulled the hook-stage resolution into Stages::resolve so install and HookSpec::apply_project_defaults share one implementation instead of duplicating the fallback rules.

  • No behaviour change to anything that runs — it's purely an extra warning.
  • Tests

    Added integration coverage in tests/install.rs: an unmatched hook warns (while an all-stages sibling does not), installing the matching --hook-type silences it, manual-only never warns, and default_stages inheritance is taken into account.

    Diff: 231 lines (+173 / -58) across 2 files Reviewer: BitWeaverDev Review duration: 207350m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 231 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.326
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #2205"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 37% (MEDIUM) · Higher = larger blast radius
    37%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.6% · Safe to merge
    14.6%
    Repository