Repository navigation
Description
User Story
As an OpenShell contributor, I need commit checks to complete promptly while still catching relevant problems, so that small changes do not incur the cost of unrelated repository-wide checks.
Description
Measure the local pre-commit workflow and identify the best opportunities to reduce its elapsed time. Start with evidence from multiple representative commits and cache states before choosing optimizations. Preserve an explicit way to run the full checks and retain appropriate validation coverage.
Context
During work on #5569, the locally installed pre-commit hook ran mise run pre-commit for a change limited to a GitHub Actions workflow and Python test. It exceeded a four-minute command timeout while Rust lint was still running. In the captured log, rust:format and rust:format:check each completed in approximately 50 seconds while running concurrently. This is one interrupted run in a newly created worktree, so it does not establish typical timings or rank the bottlenecks.
The local hook exported the staged file list as STAGED, but the repository task definitions did not appear to consume it. tasks/ci.toml defines pre-commit as both fmt and lint; those include formatting and linting across Rust, Python, Helm, Markdown, protobuf, and TypeScript. tasks/rust.toml runs workspace and additional-manifest Clippy checks and both Rust formatting and formatting checks.
Mise prints timings for completed tasks, but this investigation did not find repository-managed collection or aggregation of hook timings. The log for the run above was captured manually and should not be treated as a retained dataset.
Suggested approach
- Establish a baseline over several representative runs, including small non-Rust changes and Rust changes, and distinguish cold and warm caches. Record total and per-task duration, completion status, and staged-file categories.
- Use the measurements to evaluate affected-area or staged-file filtering and whether duplicate formatting work can be avoided. Account for shared dependencies and changes that legitimately require broader checks.
- Compare results with the baseline and document the selected tradeoffs. Keep full checks available explicitly and in CI; do not assume that a single interrupted run represents normal performance.
Definition of Done
- Document the measurement method and representative baseline, including cache conditions and incomplete runs.
- Identify the dominant costs and evaluate the proposed optimizations against the data.
- If optimization is warranted, implement and verify scoped checks without silently dropping needed validation, and retain an explicit full-check path.
- Report before-and-after results or explain why optimization was deferred.
Activity
purp commentedon Dec 4, 2026
Proposed runtime budgets for discussion: target approximately 5 seconds for an ordinary commit, 10 seconds at p95, and treat runs exceeding 30 seconds as a workflow defect to investigate. These are usability targets, not measured baseline results or an agreed hard timeout. Dependency installation and cold Rust compilation need an explicit workflow outside that budget. A timeout must never be reported as a successful check.
Alternatives considered:
We will iterate: first open a small draft PR for #6095, preserving the existing check groups and an explicit full-check path. Once that draft is up, investigate the second approach. This does not yet decide to move Clippy or impose a hard runtime limit.
For measurement, start with local total/per-check timing records and optional exports from contributors. Include startup/selection time, task overlap, selected/skipped checks and reasons, outcomes (including interrupted runs), change categories/counts, platform/tool versions, and known cache conditions (or unknown). Export no source content, raw paths, usernames, or environment values. Consider centralized opt-in aggregation only after establishing that these records answer useful questions.
Baseline cases should include docs-only, Python-only, small Rust, and shared-config changes, with repeated warm runs and separately identified cold/new-worktree runs. Compare wall time as well as task durations; do not add overlapping task durations or infer p95 from a handful of runs.
Before deferring checks, verify equivalent CI coverage, including feature configurations and generated-code checks. Preserve correct behavior for partially staged files and report deferred or incomplete validation explicitly.
purp commentedon Dec 4, 2026
First iteration: draft PR #6220 implements #6095. It preserves the existing area checks and adds staged-path selection plus
pre-commit:full. Local verification passed 50 script tests, focused lint/type/license checks, and real Markdown/Mermaid checks. With only CONTRIBUTING.md staged, the actual hook selected only Markdown tasks: mise reported 14.01s including Mermaid dependency installation and 2.42s for the warm repeat. These are smoke observations, not a representative baseline or controlled before/after comparison.Initial findings for the next iteration (no additional implementation yet):
mise run --report-file PATH .... A successful Markdown trial produced total timing plus records for five scheduled tasks, including skipped dependencies, timestamps, status, exit code, and duration. Help documents failure/cancellation reporting too; those cases have not yet been exercised. The repository permits mise as old as 2026.9.9, so capability/version support needs verification. Reports include task arguments: export a sanitized projection instead of assuming raw reports are safe to share.pre-commitnow launches an inner mise run. Mise intentionally does not propagateMISE_TASK_REPORT_FILEinto tasks, so an outer report would capture the selector but miss its inner task details. A future opt-in measurement path needs explicit forwarding or separate outer/inner reports and startup timing.buf build/buf breaking, notbuf lint. The sandboxperf-harnessClippy pass is present locally but not in the corresponding CI Clippy commands.The next design to evaluate is a check-only commit hook containing fast relevant format/lint/header checks, with compiler-dependent validation available explicitly and potentially before push, backed by equivalent CI coverage. Formatter/check concurrency and partial-staging correctness should be addressed in that iteration rather than hidden by a timeout or a successful skipped check.