Skip to content

test(core): the data directory, run store and gitignore tests start no git and reach git through the git fake #2174

Closed

Description

@dan-petty

What happened

#2143 records the owner's rule of 2026-10-24: a test of src/ starts no program. The data directory, run store and gitignore tests still start a real git. The test-suite audit of 2026-10-24 at df8e2ee recorded every program a test started, with a PEP 578 audit hook on subprocess.Popen. It saw 142 tests in these files start git:

File Tests that started git
tests/test_data_dir_worktrees.py 88
tests/test_gitignore_evaluation.py 22
tests/test_run_store.py 18
tests/test_run_comparison.py 14

Most of them build a repository under tmp_path with a git helper or fixture, and the code under test then starts git through the process runner. A test that starts only git has a median time of 0.194 s, against 0.026 s for a test that starts nothing (the audit's cost summary).

What should happen

These tests reach git through the git fake of #2146 and start no program. A helper that builds a repository with git goes: the test writes its files under tmp_path and states the git answers it needs. A test that needs an answer that #2146 did not record adds the transcript with the recording row of #2146.

Evidence

  • .data/agent/scratch/audit/full_list.txt of the 2026-10-24 audit, section 1.git.

At b170358:

  • tests/test_data_dir_worktrees.py:46: init_repo, over the root git fixture (tests/conftest.py:1131).
  • tests/test_gitignore_evaluation.py:24-26: make_repo runs git init.
  • tests/test_run_store.py:484: git init.

Acceptance criteria

  • No test in the files above starts git or another program. The hermetic floor fails any of them that starts git, as it fails a test that starts gh.
  • The tests reach git only through the fake of test(git): one git seam answers tests from recorded git transcripts, with a contract suite that replays them #2146, and patch no devops_cli name (docs/TESTING.md).
  • Each test still checks the behaviour it checked before. The pull request names each test it deletes and why.
  • The pull request gives the summed time of these files before and after (uv run pytest <files> -n 0 --durations=0).
  • uv run devops ci passes.

Order: after #2146. Follows ADR 0007 as #2143 amends it. Related: #1333 (the core and config tests move onto edge fakes).

Source: #2146

Proposed design

Problem statement

Four test files start 142 real git processes, violating the owner's rule that tests of src/ start no program. The data directory, run store, and gitignore tests build repositories with git helpers or fixtures, and the code under test then starts git through the process runner. A test that starts only git has a median time of 0.194 s, against 0.026 s for a test that starts nothing. These tests must reach git through the git fake of #2146 and start no program.

Acceptance criteria

  • Criterion 1: No test in the four files starts git or another program. The hermetic floor fails any test that starts git.
    Verification: Run the hermetic floor check on the four files. No test is reported as starting a program.
  • Criterion 2: The tests reach git only through the fake of test(git): one git seam answers tests from recorded git transcripts, with a contract suite that replays them #2146 and patch no devops_cli name.
    Verification: Search the four test files for subprocess.run, subprocess.Popen, or monkeypatch.setattr on devops_cli names. No matches are found.
  • Criterion 3: Each test still checks the behaviour it checked before. The pull request names each test it deletes and why.
    Verification: Review the pull request description for a list of deleted tests with reasons. Run the full test suite and confirm no regression.
  • Criterion 4: The pull request gives the summed time of the four files before and after.
    Verification: The pull request body contains two lines of uv run pytest -n 0 --durations=0 output, one before and one after the change.
  • Criterion 5: uv run devops ci passes.
    Verification: Run uv run devops ci on the pull request branch. All checks pass.

Key questions

  • What git operations do the affected tests currently perform?: git init, git add ., git commit, git worktree add, git clone, git submodule add, and git check-ignore. The test_data_dir_worktrees.py file uses init, add, commit, worktree add, clone, and submodule add. The test_gitignore_evaluation.py file uses init and check-ignore. The test_run_store.py file uses init. [sources: tests/test_data_dir_worktrees.py:46-52, tests/test_gitignore_evaluation.py:24-26, tests/test_run_store.py:484]
  • How should the tests be restructured to use the git fake?: The test writes its files under tmp_path and states the git answers it needs. A helper that builds a repository with git is replaced by file creation and a stated set of git responses. A test that needs an answer not recorded in test(git): one git seam answers tests from recorded git transcripts, with a contract suite that replays them #2146 adds the transcript with the recording row of test(git): one git seam answers tests from recorded git transcripts, with a contract suite that replays them #2146. (proposed)
  • What is the git fixture that the test_data_dir_worktrees.py tests use?: A root-level fixture at tests/conftest.py:1131 that provides a callable accepting a directory and git arguments, running the git command in that directory. The init_repo fixture at tests/test_data_dir_worktrees.py:46 wraps it to create a repository with one commit. [sources: tests/conftest.py:1131, tests/test_data_dir_worktrees.py:46-52]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#2146

Activity

  1. added
    type/test
    source/agent
    on Oct 24, 2026
  2. dan-petty commented on Oct 24, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.

    • Type: type/test. The candidate is about test changes and behavior, not a feature or bug fix.
    • Priority: P2-Medium. This improves test performance and consistency but is not critical to core functionality.
    • Value: Medium. Improves test suite performance and reduces flakiness by using the git fake instead of real git processes.
    • Effort: High. Requires rewriting tests to use the git fake, which may involve significant changes to test setup and expectations.
    • Related: docs(testing): adr 0007 and docs/testing.md say that a test of src starts no program, and real processes stay in the process runner's contract suite #2143, which asks for a different change. Both items relate to tests that should start no program, but the candidate specifically asks for using the git fake while #2143 sets the general rule about starting no program.
  3. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    Status set to Ready at bb46660 (see proposed design in issue body).

  4. added
    priority/p2-medium
    status/ready
    value/medium
    effort/high
    status/in-progress
    and removed
    status/ready
    on Oct 28, 2026
  5. added a commit that references this issue on Oct 31, 2026
    8432c13
  6. added
    status/in-review
    and removed
    status/in-progress
    on Oct 31, 2026
  7. removed
    status/in-review
    on Oct 31, 2026
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/highpriority/p2-mediumsource/agenttype/testvalue/medium

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions