Skip to content

feat(ci): Static Analysis runs the commit hygiene hooks - #7929

Merged
dan-petty merged 5 commits into
mainfrom
feat/4779-static-analysis-runs-the-commit-hygiene
Dec 1, 2026
Merged

dan-petty merged 5 commits into
mainfrom
feat/4779-static-analysis-runs-the-commit-hygiene

Conversation

@devops-cli-service

@devops-cli-service devops-cli-service Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Static Analysis runs the nine commit hygiene hooks over every tracked file. Before, no CI job ran them, so a bad file could reach main. The new hooks row of devops ci runs the pre-commit manual stage and prints the diff of each file that a hook changes. A hygiene hook has no check-only mode, so the row changes files also with --check.

ruff-check and check-added-large-files stay out of the manual stage. trailing-whitespace, end-of-file-fixer and check-added-large-files no longer run at a push: their manifest ran them there with no time limit and before branch-current.

The tooling cache holds ~/.cache/pre-commit, and its key reads .pre-commit-config.yaml.

Closes #4779

Change: openspec/changes/archive/2026-12-01-4779-static-analysis-runs-the-commit-hygiene/

@devops-cli-service devops-cli-service Bot added scope/ci GitHub Actions workflows, pre-commit hooks, CI gates, and runners type/feature Type feature: a new function labels Nov 30, 2026
@devops-cli-service

Copy link
Copy Markdown
Contributor Author

The steps of the job:

Stopped at group 2. The stop report is on #4779: #4779 (comment).

devops-cli-service Bot and others added 5 commits December 1, 2026 13:05
Nine hygiene hooks run in the manual stage, which the hooks row of
devops ci starts. check-added-large-files stays out of it. The stages
lines also take trailing-whitespace, end-of-file-fixer and
check-added-large-files out of pre-push. Their manifest ran them there
with no time limit and before branch-current.

The tooling cache holds ~/.cache/pre-commit, and its key reads
.pre-commit-config.yaml. The help of --check says that the hooks row
still changes files.
Two premises of the plan are false.

The manifest of pre-commit-hooks v6.0.0 gives check-added-large-files the
manual stage, so default_stages cannot keep it out. It needs a stages
line, which task 2.1 forbade.

devops ci drops PRE_COMMIT_HOME from the environment of a row, so a cache
at that path stays empty. A cache of the default ~/.cache/pre-commit,
which the issue names, replaces it.
@dan-petty
dan-petty force-pushed the feat/4779-static-analysis-runs-the-commit-hygiene branch from dee3997 to 25fbde0 Compare December 1, 2026 13:06
@dan-petty dan-petty changed the title feat(ci): Run the commit hygiene hooks in Static Analysis feat(ci): Static Analysis runs the commit hygiene hooks Dec 1, 2026
@dan-petty

Copy link
Copy Markdown
Owner

Finished by hand (head 25fbde04c)

The implement job stopped at group 2. No job takes a feature item now (#7975), so an agent finished the branch. The item is still wanted: no CI job ran the hooks on main, and its dependency #4776 is closed.

Plan errors that the change corrects

  1. check-added-large-files ran in the manual stage. Its manifest names manual, so default_stages cannot keep it out. Task 2.1 forbade the stages line that does.
  2. The cache of the plan stayed empty. devops ci drops PRE_COMMIT_HOME from the environment of a row. With the variable set, devops ci --only hadolint made no such directory, and a direct pre-commit run made it. The change caches ~/.cache/pre-commit, which the issue names, and sets no variable. ci.yml does not change.

For a person to judge

  • Push hooks. Before this change, trailing-whitespace, end-of-file-fixer and check-added-large-files ran at a push, from their manifest. pre-commit resolves these stages:
Stage main This branch
manual trailing-whitespace, end-of-file-fixer, check-added-large-files the 9 hygiene hooks
pre-push the 3 hooks above, branch-current, the 2 devops ci hooks branch-current, the 2 devops ci hooks
  • A test changed. test_workflow_contracts.py refused each stages: [pre-commit] entry as redundant. It now names check-added-large-files as the one entry that overrides a manifest.
  • --check changes files. The hooks have no check-only mode. The help of --check and docs/SDLC.md say so.
  • The cache key now also reads .pre-commit-config.yaml.

Checks

Check Result
devops ci --check --only lint,format,docs,constructs,openspec,test-settings,test-tree,startup-imports,swallowed-failures,actionlint,zizmor,hooks pass
mypy on the 5 changed source files pass
pytest -n 4 on the covering tests, tests/invariants, tests/ai/mcp, tests/lang, tests/docs 2211 passed
Scratch repository, file with no final newline hooks row exits 1 and prints the diff
Scratch repository, file with an unused import row exits 0, file unchanged
devops ci hooks on the tree pass, no file changed, no file needed a repair
CI all required checks pass

Not yet verified

The criterion "at most 10 s more with a warm cache". The CI run had a cold cache: the hooks row took 54 s beside the other rows, and the gate took 2 min 3 s, set by test-tree (2 min 2 s). That run saved the cache. A local warm run takes 4 to 7 s. Read the hooks row of the next Static Analysis run.

@dan-petty
dan-petty marked this pull request as ready for review December 1, 2026 13:19
@dan-petty
dan-petty merged commit 07e7be6 into main Dec 1, 2026
41 checks passed
@dan-petty
dan-petty deleted the feat/4779-static-analysis-runs-the-commit-hygiene branch December 1, 2026 13:45
dan-petty-release Bot added a commit that referenced this pull request Dec 1, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.270.0](v0.269.1...v0.270.0)
(2026-12-01)


### Features

* **ci:** Static Analysis runs the commit hygiene hooks
([#7929](#7929))
([07e7be6](07e7be6))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/ci GitHub Actions workflows, pre-commit hooks, CI gates, and runners type/feature Type feature: a new function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ci): Static Analysis runs the commit hygiene hooks

1 participant