Skip to content

Chore(pre-commit): Remove the pytest hook #461

Closed

Description

Summary

This repository's .pre-commit-config.yaml runs the test suite as a
pytest hook. The hook was a stop-gap to stop local agent sessions
pushing code with failing tests. Tests now run in CI alone, which
already runs them on every pull request, so the hook goes from every
lfreleng-actions repository that has one (eight, each with its own
issue).

The ci.skip entry has to go as well. The organisation is moving
pre-commit execution from pre-commit.ci to the linting.yaml reusable
workflow in lfreleng-actions/generic-workflows, run from the
organisation .github repository through a ruleset. That workflow
fails any run whose ci.skip names a hook the configuration does not
define, rather than reporting a green check over a smaller selection
(see docs/linting.md there, Which hook stages a run reaches).

Findings

On the default branch as of 2026-11-22 (line numbers approximate):

  • .pre-commit-config.yaml (around line 248): a language: system pytest hook that runs the test suite on every commit.
  • ci.skip (around line 20): lists pytest, because pre-commit.ci cannot build the project environment.
  • CI already runs the tests on every pull request: .github/workflows/build-test.yaml.
  • The comment above the hook (around lines 243-245) and the paragraph inside ci: (around lines 11-12) both explain the pytest hook.
  • AGENTS.md, Repository specifics (around lines 36-38): says plain uv sync leaves "the pytest pre-commit hook" failing.
  • README.md, SETUP.md and CONTRIBUTING.md may describe the hook; check them.

Required changes

  1. Delete the pytest hook from .pre-commit-config.yaml. It is the only hook in its repo: local entry, so remove that whole entry, together with any comment directly above it that describes running the tests.
  2. Remove pytest from ci.skip and keep every other entry in place, in order. A ci.skip that names a hook the configuration does not define fails the new organisation linting workflow, so this is required, not tidying.
  3. Leave pytest alone wherever it appears in a type checker's additional_dependencies (mypy, basedpyright): those make the test imports resolve for type checking and run no tests.
  4. Delete the pytest paragraph inside ci: along with the entry. Reword AGENTS.md Repository specifics so it says plain uv sync leaves uv run pytest failing with ModuleNotFoundError; the uv sync --extra dev advice stays.
  5. Search the contributor documentation (README.md, AGENTS.md, CONTRIBUTING.md, docs/) for claims that tests run on commit or through pre-commit/prek, and update them to say tests run in CI and locally with uv run pytest.
  6. Change nothing under .github/workflows/, nothing in the test suite, and no pytest configuration in pyproject.toml. Do not add a linting workflow caller: the organisation-level one replaces it.

Acceptance criteria

  • No hook in .pre-commit-config.yaml runs pytest; prek list
    shows no pytest hook.
  • Every id under ci.skip names a hook the configuration defines.
  • prek run --all-files passes.
  • No contributor documentation says tests run on commit or through
    pre-commit/prek; it points at CI and uv run pytest.
  • The CI test workflows (.github/workflows/build-test.yaml) are unchanged and still run the
    tests.

Activity

  1. lf-releng-code-monkey-bot commented on Nov 23, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 An AI agent looked at this issue and did not attempt it: The required change removes the pytest hook and its ci.skip entry from the root .pre-commit-config.yaml and rewords AGENTS.md; both are protected files this workflow may not edit, so a maintainer needs to make this change by hand.

  2. lf-releng-code-monkey-bot commented on Nov 23, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 An AI agent has proposed a change for this issue: pull request #463 (head 5018f7a). The Copilot review of it is clean. An antagonistic review was requested from the review bot.

  3. lf-releng-code-monkey-bot commented on Nov 23, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 Round 1: an AI agent revised pull request #463 (head c02ee3c). Round 1: amended the single commit, kept on base_sha (no rebase was requested and the PR is mergeable). - Fixed the antagonistic-review thread on CONTRIBUTING.md: build-test.yaml skips PRs touching only .github/, root dotfiles or tox.ini. The text now names those filters and keeps the local uv run pytest instruction. The commit body's "every pull request" claim is corrected too. - Copilot's overview had no open findings and no suppressed ones. ## Antagonistic review - Body summary ("documentation overstates when CI runs the unit tests"): fixed in CONTRIBUTING.md; same finding as the inline thread. Checks: prek on the changed files, gitlint and uv run pytest all passed. Still open: AGENTS.md needs the rewording from requirement 4. It is a protected file the workflow cannot edit, so a maintainer must do it. It answers antagonistic review round 1 (#463 (review)). The Copilot review of it is clean. An antagonistic review was requested from the review bot.

  4. lf-releng-code-monkey-bot commented on Nov 23, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 An AI agent attempted this issue but its proposal failed a policy check (head moved from 5018f7a to c02ee3c since selection; nothing forced). Run: https://github.com/lfreleng-actions/github-code-monkey-bot/actions/runs/45149367271 This round does not count toward the round cap of its antagonistic review round: the branch moved after this run selected it.

  5. lf-releng-code-monkey-bot commented on Nov 23, 2026

    @lf-releng-code-monkey-bot
    Contributor

    🐒 Round 2: an AI agent handed pull request #463 back to a maintainer. It disputes every remaining finding and changed nothing: The only remaining finding asks for a change to AGENTS.md (Repository specifics, line 37), a protected file this workflow cannot edit. A maintainer needs to make that one-line rewording by hand; the rest of the change is complete and passes its checks. Round 2: no new commits; the branch stays on base_sha because nobody asked for a rebase and the PR is mergeable. The previous rejection said the head moved before publication. This round starts from the current head, c02ee3c. Copilot's review of c02ee3c is clean: no threads and no suppressed findings. ## Antagonistic review - Summary finding (AGENTS.md:37 still mentions the removed pytest pre-commit hook): the finding is valid, but I did not fix it. AGENTS.md is a protected file this workflow cannot add, edit or delete. A maintainer should change the sentence to say that plain uv sync leaves uv run pytest failing with ModuleNotFoundError, and keep the uv sync --extra dev advice (issue requirement 4). Checks on c02ee3c: uv run pytest passed (114 passed, 2 skipped). prek run --files .pre-commit-config.yaml CONTRIBUTING.md passed. prek list shows no pytest hook. It answers antagonistic review round 2 (#463 (review)). Its replies are on the threads, which stay open; the workflow revises this pull request again once a maintainer comments.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions