Skip to content

ci: define each check in pre-commit and make targets #8041

Backlog

Description

@dan-petty

Problem

Three places define the checks of this repository in different ways: the commit hooks, the devops ci rows of the push hooks, and the jobs of ci.yml. A local result and a CI result can differ. Many rows run custom Python from tests/gate/ that is brittle and works only here.

Owner decisions (2026-12-01)

  • pre-commit holds each static check. Make targets run the tests and the builds. GitHub CI runs the same hooks and targets.
  • A custom check of tests/gate/ stays only when a standard tool (ruff, ast-grep, kube-linter, kubeconform or a similar tool) expresses it. The pull request lists each rule that it drops.

Acceptance criteria

  • .pre-commit-config.yaml is the one definition of each static check. CI runs pre-commit run --all-files for the stages that hold them.
  • The Makefile has targets for install, lint, test and build, and CI calls them.
  • No hook and no workflow calls devops ci.
  • tests/gate/ is deleted. The pull request lists each dropped rule.
  • Each check stays inside the 5 minute limit of AGENTS.md rule 5.
  • No threshold is lower than before.

Order

Independent of #8039 and #8040.

Alternatives check of 2026-12-01: not-applicable.
Class: ci, no model call.
Tool: none found.

Proposed design

Problem statement

Three places define the checks of this repository: the pre-commit hooks, the devops ci rows of the push hooks, and the jobs of .github/workflows/ci.yml. A local result can differ from a CI result. Many rows run custom Python from tests/gate/, which is brittle and works only in this repository. The change makes .pre-commit-config.yaml the one definition of each static check. It adds Makefile targets for install, lint, test and build, and CI calls the same hooks and targets. The change deletes tests/gate/ and lists each dropped rule.

Acceptance criteria

Requirement: pre-commit holds each static check

Each static check of the repository SHALL run as a hook of .pre-commit-config.yaml.

Scenario: Each static stage passes

  • WHEN A person runs pre-commit run --all-files --hook-stage pre-commit, then pre-commit run --all-files --hook-stage pre-push, then pre-commit run --all-files --hook-stage manual.
  • THEN Each command exits 0 and its log names the hook of each static check.

Requirement: No hook calls devops ci

No hook of .pre-commit-config.yaml SHALL call devops ci.

Scenario: The push hooks name their tools

  • WHEN A person runs pre-commit run --all-files --hook-stage pre-push.
  • THEN The log names the tool of each hook and holds no devops ci command.

Requirement: The OpenSpec hook runs the gate directly

The openspec-gate hook SHALL call the openspec tool directly and SHALL set no time limit shorter than the 5 minute limit of AGENTS.md rule 5.

Scenario: The OpenSpec hook passes on a loaded host

  • WHEN A person runs pre-commit run openspec-gate --all-files --hook-stage pre-commit.
  • THEN The command exits 0 and its log holds no devops ci command and no exit 124.

Requirement: The Makefile holds the four targets

The Makefile SHALL hold an install, a lint, a test and a build target.

Scenario: Each target runs on the tree

  • WHEN A person runs make install, then make lint, then make test, then make build.
  • THEN Each command exits 0 and its log names the tool that it runs.

Requirement: The check jobs of CI run the hooks and the targets

Each check job of .github/workflows/ci.yml SHALL run pre-commit run --all-files or a Makefile target, and SHALL run no devops ci row.

Scenario: The check jobs of the pull request show the hooks and the targets

  • WHEN A person opens the run of .github/workflows/ci.yml on the pull request of the change.
  • THEN The Static Analysis job log shows pre-commit run --all-files, the test and build jobs show make test and make build, and no log shows a devops ci row.

Requirement: tests/gate/ is deleted

The change SHALL delete each file of tests/gate/.

Scenario: The directory holds no tracked file

  • WHEN A person runs git ls-files tests/gate.
  • THEN The command prints no path.

Requirement: The change lists each dropped rule

The change SHALL list each rule of tests/gate/ that it drops, with the reason that no standard tool expresses the rule.

Scenario: The list names each dropped rule

  • WHEN A person reads the Dropped rules section of the pull request body of the change.
  • THEN The section names each rule that the change drops and gives the reason for each rule.

Requirement: Each check stays inside the 5 minute limit

Each check that the change runs SHALL end within 5 minutes, as AGENTS.md rule 5 requires.

Scenario: The jobs of the pull request end in time

  • WHEN A person opens the run of .github/workflows/ci.yml on the pull request of the change.
  • THEN GitHub shows each job with a duration under 5 minutes and a passing conclusion.

Requirement: No threshold is lower than before

The change SHALL keep each threshold at or above its value before the change.

Scenario: The Ruff caps stay

  • WHEN A person runs uv run pytest tests/commands/test_ruff_complexity_cap.py.
  • THEN The command exits 0, and pyproject.toml holds max-complexity = 10 and max-nested-blocks = 4.

Existing Tool Considered

The alternatives check of 2026-12-01 in the issue body gives the verdict not-applicable for the class ci and names no tool. pre-commit covers the need of one definition of each static check: .pre-commit-config.yaml pins it at minimum version 4.4.0, it runs one hook per check in the stage that the manifest sets, and CI runs the same hooks with --all-files. GNU make covers the install, lint, test and build targets. pre-commit lacks a test runner, a build step and a shard matrix; the Makefile holds them, and make test takes SHARD=<n>/6. The change adds no new checker and no wrapper script.

Key questions

  • Which hooks of .pre-commit-config.yaml call devops ci today?: Three hooks call uv run devops ci: openspec-gate in the pre-commit stage, and devops-ci-pre-push and devops-ci-workflows-pre-push in the pre-push stage. Each hook sets pass_filenames: false. [sources: .pre-commit-config.yaml]
  • What does the openspec row of devops ci check?: The OpenSpec gate of ADR 0010 checks the change folders and the committed skills. It needs Node and the openspec that npm ci --ignore-scripts installs from package-lock.json. When a committed skill differs from what the pinned openspec writes, its regeneration gets the skills of the release from github.com with Git. [sources: .pre-commit-config.yaml]
  • How does the openspec-gate hook run the OpenSpec gate?: The hook runs the openspec tool directly, with no devops ci call and no short time limit. The reply of 2026-12-01 gives the evidence: timeout 90 uv run devops ci --only openspec stopped 3 commits of refactor(ci): check commit and PR titles with commitizen #8045 with exit 124 after about 85 s under a load of 15 to 35. The entry keeps the two gates of the row, the plans and the committed skills, and sets no limit shorter than the 5 minute limit of AGENTS.md rule 5. (best practice) [sources: .pre-commit-config.yaml, AGENTS.md]
    • Chosen: The hook calls the openspec tool directly, with no short time limit. The reply of 2026-12-01 shows that timeout 90 stopped 3 commits of refactor(ci): check commit and PR titles with commitizen #8045 with exit 124 under load, and it asks for a direct call.
    • Rejected: Keep timeout 90 uv run devops ci --only openspec. The short limit fails a commit under load, and the hook keeps a devops ci call that the owner decision excludes.
    • Rejected: Keep devops ci in the hook and raise its limit. The hook still calls devops ci, so the repository keeps two definitions of the same gate.
  • What does AGENTS.md rule 5 require of a check?: A check must average under 5 minutes plus 1 minute of tolerance. A check over that limit is a P0 bug. A threshold never goes lower unless the owner allows it. [sources: AGENTS.md]
  • Where does each static check live?: In .pre-commit-config.yaml, as one hook. CI runs the same hooks with --all-files. (best practice) [sources: .pre-commit-config.yaml, AGENTS.md]
    • Chosen: A hook of .pre-commit-config.yaml. The owner decision of 2026-12-01 makes pre-commit the one definition, and CI then runs the same hooks.
    • Rejected: A row of devops ci called from a hook. It keeps a second definition and the custom Python of tests/gate/.
    • Rejected: A shell script per check. It builds code that pre-commit already provides.
  • Which stage holds a check?: A check runs in the stage that fits its cost: pre-commit for a fast per-file check, pre-push for a fast check of the whole tree, and manual for a slow check that only CI runs. (best practice) [sources: .pre-commit-config.yaml, AGENTS.md]
    • Chosen: The stage that fits the cost of the check. A slow check never makes a commit or a push wait.
    • Rejected: Every check in the pre-commit stage. A slow check at commit makes a commit wait over the limit of rule 5.
    • Rejected: Every check in the manual stage. A defect reaches the push and CI before a hook finds it.
  • How does a check that reads the whole tree run as a hook?: The hook sets pass_filenames: false and always_run: true, and its entry wraps the tool in coreutils timeout. The branch-current hook shows the form. (best practice) [sources: .pre-commit-config.yaml]
    • Chosen: pass_filenames: false with always_run: true. pre-commit then gives the hook no file list and runs it on each push.
    • Rejected: A wrapper script under tests/. It builds code that the hook entry already expresses.
    • Rejected: A Make target only. CI would then run a different command from the hook.
  • What does each Makefile target run?: install runs uv sync and npm ci --ignore-scripts. lint runs pre-commit run --all-files for each stage. test runs the pytest suite, and SHARD=<n>/6 selects one shard. build runs uv build. (best practice) [sources: .pre-commit-config.yaml, openspec/specs/ci-test-shards/spec.md]
    • Chosen: Make targets that call the tools directly. CI and a person run the same command, and the workflow keeps its shard matrix.
    • Rejected: A single make check target. CI cannot then run the test and the build as separate jobs.
    • Rejected: No Makefile, and the commands live in the workflow. A person then repeats the workflow commands by hand.
  • What happens to devops ci and the custom rows of tests/gate/?: Each static row moves to a hook or to a Make target. A custom row that no standard tool expresses is dropped, and the pull request lists it. The devops ci command stays for the rows that read GitHub state, and no hook and no check job of ci.yml calls it. (best practice) [sources: AGENTS.md, .pre-commit-config.yaml, openspec/specs/ci-job-time/spec.md]
    • Chosen: Move each static row to a hook, drop the rest, and list each drop. The owner decision of 2026-12-01 allows the drop and asks for the list.
    • Rejected: Keep every custom row as a hook. It keeps the brittle Python that the issue removes.
    • Rejected: Delete devops ci with tests/gate/. The rows that read GitHub state stay and have no hook form.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/infra
    source/agent
    status/new
    value/medium
    effort/high
    on Dec 1, 2026
  2. dan-petty commented on Dec 1, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    owner/agent
    on Dec 1, 2026
  4. devops-cli-service commented on Dec 1, 2026

    @devops-cli-service
    Contributor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

  5. dan-petty commented on Dec 1, 2026

    @dan-petty
    OwnerAuthor

    Evidence for the move of the OpenSpec check: the hook openspec-gate runs timeout 90 uv run devops ci --only openspec. On 2026-12-01, in a 16-core devcontainer with a load of 15 to 35 from other test runs, 3 commits of #8045 failed in this hook with exit 124 (stopped after about 85 s), and the other hooks did not report a failure. Run openspec validate directly from the hook, with no short time limit.

  6. added
    status/ready
    and removed
    status/new
    on Dec 1, 2026
  7. devops-cli-service commented on Dec 1, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/highowner/agentpriority/p2-mediumsource/agentstatus/readytype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions