Repository navigation
Description
What happened
#2143 records the owner's rule of 2026-10-24: a test of src/ starts no program. The analyze, AI tooling and security scanner 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 31 tests in these files start git:
| File | Tests that started git |
|---|---|
tests/test_analyze.py |
11 |
tests/test_ai_analyze_outlines.py |
2 |
tests/test_ai_repomap.py |
1 |
tests/test_ai_diagram.py |
1 |
tests/test_treesitter_engine.py |
1 |
tests/test_security_semgrep.py |
4 |
tests/test_scanner_tool_executor.py |
3 |
tests/test_secops.py |
2 |
tests/test_osv_scanner.py |
2 |
tests/test_security_bandit.py |
1 |
tests/test_scanner_contract.py |
1 |
tests/test_scan_complexity.py |
1 |
tests/test_url_credential_masking.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.txtof the 2026-10-24 audit, section 1.git.
At b170358:
tests/test_analyze.py:624,:672:git initthrough the rootgitfixture.tests/test_security_semgrep.py:204: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_cliname (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 cipasses.
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: #1326 (devops analyze), #1331 (the other AI modules) and #1332 (the security tests).
Source: #2146
Proposed design
Problem statement
Thirty-one tests in thirteen files start a real git process through subprocess. The owner's rule in #2143 states that a test of src/ starts no program. These tests must reach git only through the git fake of #2146. The audit of 2026-10-24 recorded every test that started git and its cost: a test that starts only git has a median time of 0.194 s, against 0.026 s for a test that starts nothing.
Acceptance criteria
- Criterion 1: No test in the thirteen files starts git or another program. The hermetic floor fails any test that starts git, as it fails a test that starts gh.
Verification: Runuv run pytest tests/test_analyze.py tests/test_ai_analyze_outlines.py tests/test_ai_repomap.py tests/test_ai_diagram.py tests/test_treesitter_engine.py tests/test_security_semgrep.py tests/test_scanner_tool_executor.py tests/test_secops.py tests/test_osv_scanner.py tests/test_security_bandit.py tests/test_scanner_contract.py tests/test_scan_complexity.py tests/test_url_credential_masking.py -n 0with the PEP 578 audit hook active. No test reports a subprocess start. - 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, per docs/TESTING.md.
Verification: Search the thirteen files forpatch(calls that name adevops_climodule. Confirm none remain. Confirm every git interaction goes through the git fake fixture from test(git): one git seam answers tests from recorded git transcripts, with a contract suite that replays them #2146. - Criterion 3: Each test still checks the behaviour it checked before. The pull request names each test it deletes and why.
Verification: Compare the test count and assertion coverage of the thirteen files before and after the change. Review the pull request description for a list of deleted tests and the reason for each. - Criterion 4: The pull request gives the summed time of the thirteen files before and after the change.
Verification: The pull request body contains two lines fromuv run pytest -n 0 --durations=0, one before and one after the change. - Criterion 5: The full CI pipeline passes.
Verification:uv run devops cicompletes with exit code 0.
Key questions
- Is this item separate from test(core): the data directory, run store and gitignore tests start no git and reach git through the git fake #2174?: Yes. The owner decided on 2026-10-24 that this item and test(core): the data directory, run store and gitignore tests start no git and reach git through the git fake #2174 each move a different group of test files to the git fake, and each gives its own pull request. (proposed)
- Which tests start git and through what mechanism?: Thirty-one tests across thirteen files start git. Most build a repository under tmp_path with a git helper or fixture, and the code under test then starts git through the process runner. Specific examples: tests/test_analyze.py:624 and :672 use the root git fixture for git init; tests/test_security_semgrep.py:204 calls subprocess.run(["git", "init", "--quiet", ...]). [sources: tests/test_analyze.py:624, tests/test_analyze.py:672, tests/test_security_semgrep.py:204]
- What does the hermetic floor check?: The hermetic floor fails any test that starts a program such as git or gh. It uses a PEP 578 audit hook on subprocess.Popen to detect every process start during a test. [sources: tests/test_analyze.py]
- What is the dependency order for this work?: This item runs after test(git): one git seam answers tests from recorded git transcripts, with a contract suite that replays them #2146, which delivers the git fake. test(core): the data directory, run store and gitignore tests start no git and reach git through the git fake #2174 migrates the data directory, run store and gitignore tests in the same way and is a separate item. [sources: tests/test_analyze.py]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady
- StatusShow more project fieldsNew
Activity
dan-petty commentedon Oct 24, 2026
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.
dan-petty commentedon Oct 28, 2026
Status set to Ready at bb46660 (see proposed design in issue body).