Repository navigation
Description
What happened
#2143 records the owner's rule of 2026-10-24: a test of src/ starts no program. The Kubernetes and Argo CD gate 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 38 tests in these files start git:
| File | Tests that started git |
|---|---|
tests/test_k8s.py |
21 |
tests/test_k8s_argocd_gate.py |
9 |
tests/test_k8s_argocd_overrides.py |
5 |
tests/test_k8s_argocd_apps.py |
2 |
tests/test_k8s_devops_runtime.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_k8s.py:1757-1790:_gitand_commit.tests/test_k8s_argocd_gate.py:17:_git_run.tests/test_k8s_argocd_overrides.py:184-193:_repo.
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: #1322 (k8s/), #1323 (the devops k8s commands).
Source: #2146
Alternatives check of 2026-11-02: not-applicable.
Class: test, no search.
Tool: none found.
Proposed design
Problem statement
The Kubernetes and Argo CD gate tests in five test modules start a real git. The owner's rule of 2026-10-24 says a test of src/ starts no program. The tests must reach git through the GitFake of #2146. A test writes its files under tmp_path and states the git answers it needs. A git answer with no transcript gets a new scenario and a recording.
Acceptance criteria
Requirement: No program starts in the five modules
Each of the five named test modules SHALL start no program when it runs.
Scenario: The five modules run inside the hermetic floor
- WHEN a person runs the five modules with
uv run pytest - THEN every test passes and no test starts a real program, because the floor and
git_fakerefuse it.
Requirement: Git answers come from the fake
A test in the five modules MUST reach git only through the git_fake fixture.
Scenario: A migrated test asks git for an answer
- WHEN the test runs a git command through the code under test
- THEN
GitFakeanswers it from a transcript oftests/fixtures/git/, and a command with no record fails the test and names the command.
Requirement: The git helpers are gone
The five modules MUST hold no helper that starts git.
Scenario: The modules are searched for the four helpers
- WHEN a person runs
! git grep -n -I -F '_git_run' tests/k8s/test_k8s_argocd_gate.pyand the same check for_git,_commitand_repoin the modules that hold them - THEN git finds no match for any of the four helpers in the five modules.
Requirement: A new git answer gets a recorded scenario
A test that needs a git command with no transcript MUST add a scenario to tests/support/git_scenarios.py and record it.
Scenario: The git row records every scenario again
- WHEN a person runs the
gitrow ofdevops ci - THEN the row passes and it fails on a transcript that differs from a new recording.
Requirement: Each migrated test keeps its behaviour
A migrated test SHALL assert the behaviour that it asserted before the migration.
Scenario: A migrated test reads the repository of its scenario
- WHEN the test runs over the recorded scenario, with the repository at the scenario name under
tmp_path - THEN it makes the same assertion as before the migration, and the pull request names each deleted test and the reason.
Requirement: The run time is reported
The pull request MUST give the summed time of the five modules before and after the change.
Scenario: The five modules are timed on both revisions
- WHEN a person runs
uv run pytest -n 0 --durations=0on the base and on the branch - THEN the pull request shows both summed times.
Requirement: The gate passes
The change MUST pass uv run devops ci.
Scenario: The full gate runs on the branch
- WHEN a person runs
uv run devops ci - THEN the command exits 0.
Existing Tool Considered
The alternatives check of 2026-11-02 returned not-applicable for an item of class test and made no search, so it named no tool. The need is covered by the project's own GitFake in tests/support/fakes/git.py behind the git_fake fixture, which #2146 delivered. The change builds no code: it adds git scenarios and their transcripts, edits the five modules, and keeps the fake that already has a contract suite. Building a second git double would add code to keep, a contract suite of its own and a recording row, and docs/TESTING.md forbids a test that builds its own double of an edge.
Key questions
- Which git commands do the five modules need from the fake?: The helpers make a repository.
_git_runrunsgit init,git config user.nameandgit config user.email._gitand_commitrungit addandgit commit._repobuilds a repository with git. A command with no transcript gets a new scenario intests/support/git_scenarios.pyand a recording. [sources: tests/k8s/test_k8s_argocd_gate.py:17, tests/k8s/test_k8s_argocd_gate.py:289, tests/commands/k8s/test_k8s.py:1884, tests/k8s/test_k8s_argocd_overrides.py, docs/TESTING.md] - Where do the five test modules sit at the refined commit?: They moved into the mirror directories.
test_k8s.pysits intests/commands/k8s/, and the Argo CD gate and overrides modules sit intests/k8s/. The acceptance criteria name each module by file name, so they hold at either path. [sources: tests/commands/k8s/test_k8s.py, tests/k8s/test_k8s_argocd_gate.py, tests/k8s/test_k8s_argocd_overrides.py] - How does a test add a git transcript that test(git): one git seam answers tests from recorded git transcripts, with a contract suite that replays them #2146 did not record?: Add a scenario to
tests/support/git_scenarios.pyand record it withuv run python -c "import sys; from tests.support.git_recording import main; sys.exit(main([]))". Thegitrow ofdevops cirecords every scenario again with the real git and fails when a transcript differs. [sources: docs/TESTING.md, tests/support/git_scenarios.py, tests/support/git_recording.py, tests/support/fakes/git.py] - Which issue must be delivered before this one?: test(git): one git seam answers tests from recorded git transcripts, with a contract suite that replays them #2146, which delivers
GitFakeand thegit_fakefixture. docs/TESTING.md lists both as existing at the refined commit, so the order is met and this item can start. [sources: docs/TESTING.md, tests/support/fakes/git.py] - Which fixture states the git answers of a migrated test?: The test asks for
git_fakeand names its scenarios withgit_fake.replay(...). It puts each repository of a scenario at the scenario name undertmp_path. It writes the files and reads them back fromtmp_path. (best practice) [sources: docs/TESTING.md, tests/support/fakes/git.py, docs/adr/0007-tests-double-only-process-edges.md]- Chosen: The
git_fakefixture with recorded scenarios. docs/TESTING.md gives one fake for the git edge, and a test names the scenarios it needs withgit_fake.replay(...). - Rejected: A git double built in each test module. docs/TESTING.md forbids a test that builds its own double of an edge and gives each edge one shared fake.
- Rejected: A real git for the setup, with the fake on the code under test. The hermetic floor refuses a real git, and the owner's rule of 2026-10-24 says a test of
src/starts no program.
- Chosen: The
- How does a test reach a program other than git?: Through the fake at the process seam. When the check reads committed files, it goes to a row of
devops ciinstead, and thek8srow renders the committed manifests withkubectl kustomizeonce each. A test keeps no real program. (best practice) [sources: docs/TESTING.md]- Chosen: The fake at the process seam, or a
devops cirow for a check of committed files. docs/TESTING.md fakes every program, keeps a real child process only in the process runner's contract suite, and gives a check of committed files to a row ofdevops ci. - Rejected: Keep the real program in the test. The hermetic floor refuses the program, and the acceptance criteria refuse a program start.
- Rejected: A new double for each test that starts a program. docs/TESTING.md gives each edge one shared fake and forbids a test that builds its own double.
- Chosen: The fake at the process seam, or a
- Does this item stay apart from test(core): the data directory, run store and gitignore tests start no git and reach git through the git fake #2174 and the other migration items?: Yes. test(core): the data directory, run store and gitignore tests start no git and reach git through the git fake #2174 moves the data directory, run store and gitignore tests, and this item moves the five Kubernetes and Argo CD modules. An item is one issue and one pull request that delivers nothing else. (best practice) [sources: CONTEXT.md, docs/TESTING.md]
- Chosen: One pull request for the five Kubernetes and Argo CD modules. CONTEXT.md defines an item as one issue and one pull request that delivers nothing else, and test(core): the data directory, run store and gitignore tests start no git and reach git through the git fake #2174 names other files.
- Rejected: One pull request for every migration item. It delivers more than one item, and CONTEXT.md forbids that.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNew
- 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
Refine cannot set this item to Ready at bb46660 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
devops-cli-service commentedon Nov 2, 2026
Alternatives check: not-applicable
Class: test. The check makes no search and no model call for an item of this class.
Tool: none found
Checked on 2026-11-02. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 5, 2026
Status set to Ready at d254410 (see proposed design in issue body).
[-]test(k8s): the kubernetes and argo cd gate tests start no git and reach git through the git fake[/-][+]test(k8s): Use the git fake in k8s and argo cd gate tests[/+]dan-petty commentedon Nov 6, 2026
The job shortened the title of this item. The summary had 85 characters, and the limit is 60. The type and the scope stay.
test(k8s): the kubernetes and argo cd gate tests start no git and reach git through the git faketest(k8s): Use the git fake in k8s and argo cd gate tests