Skip to content

test(repos): the repos, branches, github, ssh, devcontainer, tf and openspec tests start no git and reach git through the git fake #2183

Closed

Description

@dan-petty

What happened

#2143 records the owner's rule of 2026-10-24: a test of src/ starts no program. The repos, branches, GitHub, SSH, devcontainer, tf and OpenSpec 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 62 tests in these files start git:

File Tests that started git
tests/test_repos.py 20
tests/test_repos_worktrees.py 6
tests/test_branches.py 2
tests/test_github_pr_monitor.py 2
tests/test_github_metrics.py 2
tests/test_ssh.py 5
tests/test_devcontainer.py 4
tests/test_tf.py 8
tests/test_openspec_command.py 12
tests/test_openspec_scaffold.py 1

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_repos.py:985: git init.
  • tests/test_repos_worktrees.py:20-24: the git_repo fixture.

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. #2174 migrates the data directory, run store and gitignore tests in the same way. Follows ADR 0007 as #2143 amends it. Related: #1324 (devops repos), #1321 (github/), #1325 (devcontainer), #1327 (tf), #1332 (ssh).

Source: #2146

Proposed design

Problem statement

62 tests across 10 test files start a real git process, which violates the rule that a test of src/ starts no program. These tests must reach git only through the git fake of #2146 and start no program. The affected files are test_repos.py, test_repos_worktrees.py, test_branches.py, test_github_pr_monitor.py, test_github_metrics.py, test_ssh.py, test_devcontainer.py, test_tf.py, test_openspec_command.py, and test_openspec_scaffold.py.

Acceptance criteria

  • Criterion 1: No test in the 10 listed files starts git or another program.
    Verification: The hermetic floor (PEP 578 audit hook on subprocess.Popen) fails any test in these files that starts git, as it fails a test that starts gh. Run: uv run pytest tests/test_repos.py tests/test_repos_worktrees.py tests/test_branches.py tests/test_github_pr_monitor.py tests/test_github_metrics.py tests/test_ssh.py tests/test_devcontainer.py tests/test_tf.py tests/test_openspec_command.py tests/test_openspec_scaffold.py -n 0
  • Criterion 2: 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: Code review confirms no patch("devops_cli...") calls remain in the 10 files, and the git fake from test(git): one git seam answers tests from recorded git transcripts, with a contract suite that replays them #2146 is the sole path to git answers.
  • Criterion 3: Each test still checks the behaviour it checked before.
    Verification: The pull request description names each test it deletes and the reason for deletion.
  • Criterion 4: The pull request gives the summed time of these files before and after.
    Verification: The PR description contains the output of: uv run pytest -n 0 --durations=0, showing both the before and after totals.
  • Criterion 5: uv run devops ci passes.
    Verification: The CI check on the pull request completes with a passing status.

Key questions

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

    The owner decided on 2026-10-24 that this item is separate from #2174: each of #2174 and #2178 to #2183 moves a different group of test files to the git fake, and each gives its own pull request. Intake judged it a duplicate of #2174 (recorded as a case on #1989), so it was placed by hand with the values of #2174: Priority P2-Medium, Value Medium; Effort Medium.

  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/medium
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Oct 28, 2026
  5. 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/mediumpriority/p2-mediumsource/agenttype/testvalue/medium

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions