Repository navigation
Description
Problem or Motivation
The 10 hygiene hooks run only at a local commit or at a commit of a runner step. No CI job runs them: no workflow under .github/workflows runs pre-commit.
- One file on
mainfailsend-of-file-fixer. It ends with two newlines (from 707775f, fix(roadmap): count the title summary like the CI check #3286). - About 1 agent push a week uses
--no-verify(Claude Code transcripts, 7 days). - Cloud agent sessions install no hooks (feat(agents): remote agent sessions install the git hooks #4773).
Proposed Solution & Architectural Design
Mark trailing-whitespace, end-of-file-fixer, mixed-line-ending, check-yaml, detect-private-key, check-merge-conflict, check-toml, check-json and ruff-format with stages: [pre-commit, manual].
Keep these hooks out of the manual stage:
ruff-check: thelintrow runs it in CI. Its--fixdeleted an unused import with no message in a test.check-added-large-files: with--all-filesit checks only added files, so it checks nothing. With--enforce-all,CHANGELOG.md(862 KB) anduv.lock(761 KB) fail.
Add a devops ci row hooks that runs uv run pre-commit run --all-files --hook-stage manual --show-diff-on-failure. Static Analysis runs it with the other rows. Its limit comes from #4775.
Add ~/.cache/pre-commit to the tooling cache paths of .github/actions/setup-toolchain. #4727 also changes these paths.
The help text says that the row fixes files in a local run.
Fix the one file on main in the same pull request.
Target Subsystem
SDLC, Git & PR Governance (.pre-commit-config.yaml, src/devops_cli/commands/ci.py, .github/actions/setup-toolchain).
Existing Tool Considered
The pre-commit manual stage runs the same hooks in CI with no second definition. Rejected: pre-commit.ci and autofix.ci (a second service and a bot that pushes). Cost (estimate): about 100,000 tokens and 2 hours to build, near 0 to keep.
Acceptance Criteria
- Static Analysis shows the row and passes on
main. - In a test repository, a file with no final newline makes the row fail and show the diff.
- The Static Analysis job takes at most 10 s more with a warm cache (4.4-5.5 s measured for the run).
- The manual stage does not change a file that has an unused import.
Dependencies
Source: #4771
Alternatives check of 2026-11-24: in-use.
The repository already uses this tool.
Tool: pre-commit/pre-commit (https://github.com/pre-commit/pre-commit), MIT, last activity 2026-11-09, maintained.
Reason: Searches surfaced no better dedicated CI hook runner; pre-commit's manual stage runs the existing hooks in CI, but the project still needs its hooks row, workflow wiring, cache path and hook exclusions.
Covers:
- Runs the configured hooks with --hook-stage manual
- Uses the existing .pre-commit-config.yaml with no second definition
- Checks all tracked files and can show diffs on failure
Lacks:
- No devops ci hooks row or Static Analysis wiring
- No ~/.cache/pre-commit toolchain cache path
- No exclusion of ruff-check or check-added-large-files
Proposed design
Problem statement
No CI job runs the commit hygiene hooks. One tracked file on main ends with two newlines. About one agent push a week uses --no-verify, and cloud agent sessions install no hooks. This change runs the nine hygiene hooks in Static Analysis through the pre-commit manual stage, adds the devops ci hooks row, caches the hook environments, and fixes the bad file.
Acceptance criteria
Requirement: Manual stage runs the nine hygiene hooks
The hooks trailing-whitespace, end-of-file-fixer, mixed-line-ending, check-yaml, detect-private-key, check-merge-conflict, check-toml, check-json and ruff-format SHALL run in the manual stage as well as the pre-commit stage.
Scenario: Manual stage names the nine hooks
- WHEN
uv run pre-commit run --all-files --hook-stage manualruns onmain. - THEN The command exits 0 and its output names each of the nine hooks.
Requirement: Unsafe hooks stay out of the manual stage
The manual stage MUST NOT run ruff-check or check-added-large-files.
Scenario: Manual stage names neither unsafe hook
- WHEN
uv run pre-commit run --all-files --hook-stage manualruns onmain. - THEN The command exits 0 and its output names neither
ruff-checknorcheck-added-large-files.
Requirement: The hooks row is registered
The hooks row SHALL be a row of devops ci: it SHALL appear in get_check_specs() and in CONST_CI_CHECK_ROW_NAMES.
Scenario: The row tuple matches the registry
- WHEN A test imports
CHECK_ROW_NAMESandget_check_specsfromsrc/devops_cli/commands/ci.py. - THEN
hooksis inCHECK_ROW_NAMES,get_check_spec("hooks")returns the row, and the tuple equals the registry order.
Requirement: Hooks row command
The hooks row of devops ci SHALL run uv run pre-commit run --all-files --hook-stage manual --show-diff-on-failure.
Scenario: The check registry holds the hooks command
- WHEN A test imports
get_check_specfromsrc/devops_cli/commands/ci.pyand reads the command of thehooksrow. - THEN The command is
uv run pre-commit run --all-files --hook-stage manual --show-diff-on-failure.
Requirement: Static Analysis runs the hooks row
The Static Analysis job of .github/workflows/ci.yml SHALL run the hooks row with its other rows.
Scenario: Static Analysis log shows the hooks row
- WHEN The Static Analysis job runs on the pull request.
- THEN The job log shows the
hooksrow and the job passes.
Requirement: The tooling cache restores the pre-commit environments
The Static Analysis job SHALL set PRE_COMMIT_HOME to .data/cache/pre-commit and the tooling cache of .github/actions/setup-toolchain SHALL restore and save that path, so that a warm cache keeps the hooks row within 10 s.
Scenario: Second Static Analysis run reuses the pre-commit cache
- WHEN The Static Analysis job runs a second time with the tooling cache of the first run.
- THEN The setup-toolchain step reports a tooling cache hit for
.data/cache/pre-commitand thehooksrow finishes in at most 10 s.
Requirement: Help text states local fixes
The help text of the hooks row SHALL say that a local run fixes files.
Scenario: Hooks help text
- WHEN
uv run devops ci hooks --helpruns. - THEN The output states that a local run fixes files.
Requirement: The hooks row passes on main
uv run devops ci hooks SHALL pass on main and change no file.
Scenario: Hooks row on main
- WHEN
uv run devops ci hooksruns onmain. - THEN The command exits 0 and changes no file.
Requirement: Every tracked file ends with one newline
Every tracked file on main SHALL end with exactly one final newline.
Scenario: End-of-file fixer passes on main
- WHEN
uv run pre-commit run end-of-file-fixer --all-files --hook-stage manualruns onmain. - THEN The hook exits 0 and changes no file.
Requirement: A missing final newline fails with the diff
The hooks row SHALL fail and print the diff of a tracked file that has no final newline.
Scenario: File with no final newline
- WHEN A scratch repository holds a tracked file with no final newline and
uv run devops ci hooksruns there. - THEN The row exits non-zero and prints the diff of the file.
Requirement: An unused import stays unchanged
The manual stage MUST NOT change a file that has an unused import.
Scenario: File with an unused import
- WHEN A scratch repository holds a Python file with an unused import and
uv run devops ci hooksruns there. - THEN The row exits 0 and the file content is unchanged.
Existing Tool Considered
pre-commit/pre-commit (https://github.com/pre-commit/pre-commit), MIT, last activity 2026-11-09, maintained. The alternatives check of 2026-11-24 records the verdict in-use, and its block names what the tool lacks. The change builds no hook runner and no second hook definition.
Key questions
- Which pre-commit stage should run the hygiene hooks in CI?: Use the
manualstage.pre-commit run --all-files --hook-stage manualruns the existing hooks and needs no second hook definition.default_stagesis[pre-commit], so a hook runs inmanualonly when it names that stage, and the installed git hook types arepre-commitandpre-push, so a local commit keeps its behavior. (best practice) [sources: .pre-commit-config.yaml:2, .pre-commit-config.yaml:3, .pre-commit-config.yaml:22-43]- Chosen: manual stage. It runs the same hooks on demand and keeps one hook definition for local commits and CI.
- Rejected: pre-commit stage only. No CI job makes a commit, so the hooks still do not run in Static Analysis.
- Rejected: second hook set for CI. It duplicates the hook list and lets the local and CI checks drift.
- Should
ruff-checkrun in themanualstage?: No. Thelintrow runsruff-checkin CI, and the hook's entry isuv run --no-sync ruff check --config pyproject.toml --fix, so the manual stage would change files. Its--fixdeletes an unused import with no message. (best practice) [sources: .pre-commit-config.yaml:69-74, src/devops_cli/commands/ci.py:908-925]- Chosen: exclude
ruff-check. Thelintrow covers it, and the manual stage then changes no file. - Rejected: include
ruff-check. Its--fixchanges files and can delete an import with no message.
- Chosen: exclude
- Should
check-added-large-filesrun in themanualstage?: No. With--all-filesit checks only added files and finds nothing. With--enforce-allit fails onCHANGELOG.md(862 KB) anduv.lock(761 KB). (best practice) [sources: .pre-commit-config.yaml:34-37, CHANGELOG.md, uv.lock]- Chosen: exclude
check-added-large-files. The manual all-files run either checks nothing or fails on tracked large files. - Rejected: include it with
--all-files. It checks only added files, so it checks nothing in this run. - Rejected: include it with
--enforce-all. It fails onCHANGELOG.mdanduv.lock.
- Chosen: exclude
- Which CI job should run the
hooksrow?: Static Analysis. It is the aggregate required check that runs thedevops cigate, its stepuv run devops ci --check --no-cache --skip test,outdated,actionlintruns every other row, and the row adds no test suite. (best practice) [sources: .github/workflows/ci.yml:49-50, .github/workflows/ci.yml:115-117, docs/adr/0043-required-checks-and-main-ruleset-gate-merges.md:42]- Chosen: Static Analysis. The row is a static check and the job already runs the other static rows.
- Rejected: Tests & Coverage. The row runs no test and would lengthen the test job.
- Rejected: a new workflow job. A new job adds runner time and a required-check change for no extra coverage.
- Where should the pre-commit cache live for the CI toolchain?: Use
PRE_COMMIT_HOME=.data/cache/pre-commit: set it in the Static Analysis job and add that path to the tooling cache paths of.github/actions/setup-toolchain, next to.mypy_cacheand.ruff_cache. The project already keeps the hook environments under the data cache directory for the implement job, whosehook_environment()returnsPRE_COMMIT_HOME=<data cache>/pre-commit;.data/cacheis the defaultdata.cache_dir; and the tooling cache restores repo-relative directories. The Static Analysis job is the only job that uses the default path list, so the new path is restored and saved there. The same job already runs pre-commit through thehadolintrow, so its hook environments fill that cache. (best practice) [sources: src/devops_cli/roadmap/implement/implement_hooks.py:69-71, src/devops_cli/roadmap/implement/implement_hooks.py:139-142, openspec/specs/roadmap-implement-job/repair/spec.md:9, docs/CONFIGURATION.md:292, .github/actions/setup-toolchain/action.yml:13-20, .github/workflows/ci.yml:67-70, src/devops_cli/commands/ci.py:1036-1042]- Chosen:
PRE_COMMIT_HOME=.data/cache/pre-commit, restored by the tooling cache. It follows the project's record for the hook environments, uses the repo-relative paths that the tooling cache restores, and is the same path in the implement job and CI. - Rejected:
~/.cache/pre-commit, pre-commit's default. It needs no setting, but the tooling cache has restored no home-directory path and the project records the data cache directory for the hook environments. - Rejected: No cache. Each Static Analysis run would install the hook environments again and add avoidable time.
- Chosen:
- What should the help of the
hooksrow say?: Say that a local run fixes files._row_commandgives every generated row the helpRun the {name} check., which is false for this row: the manual stage runs the hooks with their default fix behavior. Give thehooksrow its own help text, as a hand-written command likelintor a per-row help in_row_command. (best practice) [sources: src/devops_cli/commands/ci.py:3148-3149, src/devops_cli/commands/ci.py:3153-3161, src/devops_cli/lang/en/help.py:1122]- Chosen: state that a local run fixes files. The manual stage runs the hooks with their default fix behavior, so the help must not call the row a check-only run.
- Rejected: keep the generated
Run the hooks check.help. That is false for a local run and hides the file changes.
- Where must a new
devops cirow be named?: Inget_check_specs()ofsrc/devops_cli/commands/ci.pyand inCONST_CI_CHECK_ROW_NAMESofsrc/devops_cli/config/constants.py.CHECK_ROW_NAMESreads the constant, a test keeps that tuple equal to the registry order,--onlyand--skipvalidate against it, and_register_row_commandsregisters a subcommand for each name. [sources: src/devops_cli/commands/ci.py:132, src/devops_cli/commands/ci.py:1726-1731, src/devops_cli/commands/ci.py:3153-3161, src/devops_cli/config/constants.py:6202-6231, tests/commands/test_ci_row_commands.py:96-99] - Does the Static Analysis job already run pre-commit?: Yes. Its gate skips only
test,outdatedandactionlint, so it runs thehadolintrow, which runsuv run pre-commit run hadolint --all-files. The job therefore already installs pre-commit and its hook environments. [sources: .github/workflows/ci.yml:115-117, src/devops_cli/commands/ci.py:1036-1042]
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(ci)scope of the title gives the scope.Adds CI coverage for hygiene hooks but does not block release or fix a broken flow.Catches formatting and hygiene issues in CI that local hooks miss.Candidate estimates about 2 hours to build with near-zero maintenance.Both touch pre-commit integration and cache paths, but 256 builds a caching engine while this adds a new hooks row to Static Analysis.dan-petty commentedon Nov 14, 2026
Blocked on #4776: the issue declares that dependency, and #4776 (faster commit hooks and more fast pre-push checks) is still open on 2026-11-14. The item also adds a manual hook stage, a devops ci hooks row, the Static Analysis row, a tooling-cache path and the one-file fix, which the issue itself estimates at 2 hours and 100,000 tokens, above effort/low. Return after #4776 merges; then build it as one PR against the settled hook list.
devops-cli-service commentedon Nov 14, 2026
Alternatives check: in-use
Reason: The searches found the pre-commit framework, which the project already uses (
.pre-commit-config.yaml), and its documentation confirms themanualstage that no git hook triggers and that is run on demand withpre-commit run --hook-stage manualin CI. That is exactly the solution the issue proposes, so the need is fully covered and the tool is already named in the issue.The repository already uses this tool.
Tool: pre-commit/pre-commit (https://github.com/pre-commit/pre-commit)
Covers:
pre-commit run --all-files --hook-stage manual, with no second hook definitionmanualstage is a special stage no git hook triggers, so the same.pre-commit-config.yamlserves both local commits and the CI run--all-fileschecks every tracked file, so a bad file onmainis caught--show-diff-on-failuresurfaces the diff of a file the hooks would changeLacks:
hooksrow to thedevops cicommand and the Static Analysis job~/.cache/pre-commit; that is.github/actions/setup-toolchainworkTools considered:
Searches run:
Sources:
Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 15, 2026
Refine cannot set this item to Ready at e5dfddb while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.
devops-cli-service commentedon Nov 26, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.
21 remaining items
devops-cli-service commentedon Nov 30, 2026
Owner question: The step "group 2" stopped with a plan defect: the plan does not hold. Amend the plan or split the item?
Options
Recommendation: Amend the plan: the step follows the plan, so a step that cannot follow it names a defect of the plan.
Evidence
devops-cli-service commentedon Nov 30, 2026
Stopped at group 2.
Failure class:
plan_defect.Action taken: none.
Action left:
wait: wait for a person.pytest on base: tests/commands/test_ci_row_commands.pyReason:
Last message of the agent (a claim that no check verified): Group 2 is not verified and no group-2 work is in place: the tree is clean and the plan needs the amendment below. Group 1 stays verified. Commands, each on its own, with its exit status: -
git status --short— no output, so the checkout holds no uncommitted change. -uv run devops ci test tests/commands/test_ci_row_commands.py tests/roadmap/test_roadmap_runner_tools.py— 50 passed, exit 0. -uv run devops ci --check --only hooks— exit 0, but its output names onlytrim trailing whitespace,fix end of filesandcheck for added large files: six of the nine hooks do not run in the manual stage at HEAD, andcheck-added-large-filesdoes run there. With the ninestages: [pre-commit, manual]lines added, the nine hooks ran andcheck-added-large-filesstill ran, which the task forbids me to fix. -git status --shortafter the run — no output, so the run changed no file. The blocker: pre-commit gives the stages of a hook's own manifest priority overdefault_stages(pre_commit/repository.py:124), andcheck-added-large-filesin pre-commit-hooks v6.0.0 namesstages: [pre-commit, pre-push, manual]. Only astagesline in our config keeps it out of the manual stage, and task 2.1 forbids that line. ```plan-request { "kind": "task", "group": 2, "defect": "Task 2.1 forbids astagesline on `check-added-large-files`, but that hook runs in the `manual` stage because its own manifest in pre-commit-hooks v6.0.0 names `manual`. `default_stages` cannot keep it out, sThe item is Blocked, and the job will not run it. Fix the cause. Then comment
implement: retry. The Service clears the stop on its own when a new runner image rolls out, but only if a retry can fix the class of the stop and the limits ofroadmap.implement.digest_clears_per_classandroadmap.implement.digest_clears_per_itemallow it.feat(ci): Static Analysis runs the commit hygiene hooks (#4779)
docs(spec): amend the plan of #4779
docs(spec): archive the change of #4779
devops-cli-service commentedon Dec 1, 2026
Released in v0.270.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.270.0
devops-cli-service commentedon Dec 1, 2026
Live since 2026-12-01 16:30 UTC