Repository navigation
Description
User Story
I maintain OpenShell and commit from a local checkout with the repository's pre-commit hook installed. I need the hook to run the checks that the staged change can affect, so that a documentation commit doesn't wait on Rust compilation.
Problem Statement
mise run pre-commit runs fmt and lint in full for every commit. A commit that changed one Markdown file under rfc/ ran rust:lint, which invokes Clippy across the workspace and more than a dozen additional manifests, plus Helm lint, proto lint, Python checks, and license checks. None of those could be affected by the change. Only the Markdown lint and format checks were relevant.
Impact / Why This Matters
The commit took several minutes, and one attempt failed on an unrelated compiler crash in rust:lint. Slow, irrelevant checks push contributors and agents toward skipping the hook, which removes the protection it provides. This is one part of the measurement and optimization work in #5571.
Proposed Design
The pre-commit hook would choose its checks from the staged paths. For example:
- Markdown-only changes run Markdown lint and format.
- Rust source, manifest, or lockfile changes run the Rust format, lockfile, and lint checks.
- Helm chart changes run Helm lint and docs checks.
- Proto changes run proto lint and the checks that depend on generated code.
- Changes to shared inputs such as task definitions or toolchain configuration run everything.
CI would keep running the full set, so the hook's selection only affects local feedback time.
Acceptance Criteria
- A commit that stages only Markdown runs no Rust, Helm, proto, or Python checks.
- A commit that stages Rust source runs the Rust checks.
- The mapping from paths to checks lives in one place and is documented for contributors.
- A change the mapping does not recognize runs the full set.
- There is a documented way to run the full set locally.
Alternatives Considered
- Keep running everything and make it faster. Caching helps, but a full Clippy pass is still wasted work for a docs change, and it exposes unrelated commits to unrelated failures.
- Move the slow checks out of the hook entirely and rely on CI. This loses fast local feedback for Rust changes, where it is most useful.
Activity
purp commentedon Dec 4, 2026
Implement staged-path selection as the first iteration of #5571. Keep the existing area checks, formatter behavior, and CI tasks; do not add runtime limits, telemetry, package-level Rust pruning, or move Clippy in this PR.
mise run pre-committhrough a dependency-free Python selector that reads the Git index directly with NUL-delimited paths. Do not parse the lossySTAGEDenvironment variable from older local hooks.mise run pre-commit:full. Report selected tasks and provide--dry-runfor inspecting selection. Empty staged sets run no checks.STAGED, full override, and failure propagation. Exercise task wiring without invoking unrelated compilers.