Repository navigation
Description
What happened
The test-suite audit of 2026-10-24 at df8e2ee found setup code and tests that cost time and add no check of src/:
Autouse fixtures that repeat a reset of the floor (15). The floor calls every reset in _PROCESS_STATE_RESETS after each test, so these module fixtures do again what the floor already did:
tests/test_k8s_service_proxy.py:24, tests/test_secret_resolution.py:46, tests/test_telemetry_logfire.py:40, tests/test_rag_kb_sync.py:116, tests/test_gitignore_evaluation.py:19, tests/test_ai_request_priority.py:27, tests/test_k8s_service.py:25, tests/test_ollama_dynamic_leasing.py:20, tests/test_fastmcp_contracts.py:808, tests/test_k8s_context_resolution.py:14, tests/test_config_field_validation.py:32, tests/test_rag_investigator.py:28, tests/test_ci_dry_run.py:18, tests/test_consolidation_dry_run_decorator.py:15 and tests/test_review_rules_pack.py:41.
Fixtures defined again in several modules. project in tests/test_ci_repeat.py:75, tests/test_review_regression_harness.py:40, tests/test_test_runner.py:61 and tests/test_test_selection.py:44; tree in tests/test_review_tool_runs.py:89, tests/test_review_tool_sandbox.py:43, tests/test_sandbox_tool_executor.py:41 and tests/test_scanner_tool_executor.py:67.
Tests whose subject is a test helper, not src/.
tests/test_model_fixture.py:29-115: 8 tests ofModelFake, whichtests/test_model_contract.pyalready covers.tests/test_support_waits.py: tests oftests/support/waits.py; one case waits 1.5 s of real time.tests/test_support_hung_children.py:45: a test oftests/support/hung_children.pythat startssh.tests/test_per_test_timeout.py: runs a hanging test in an inner pytest session to check the pytest-timeout setting (4.2 s).tests/test_openblas_worker_threads.py: starts python to check an environment variable of the root conftest, and skips where/proc/self/statusis missing.
An input much larger than its case needs. tests/test_semgrep_registry.py:226 builds a YAML body nested 100,000 levels deep to check that the loader refuses it. The audit measured about 10 s for each case on the CI runner. A depth just past the limit that the loader enforces gives the same refusal.
What should happen
- The 15 fixtures go.
- A fixture with the same body in several modules moves to
tests/support/. A fixture with a different body gets a name that says what it builds. - The tests of test helpers go. A setting of pytest or of the root conftest that must hold is checked by a
devops cirow, not by a test that starts pytest or python. - The nested-YAML case builds the smallest body that passes the loader's limit, with the depth read from that limit.
Evidence
.data/agent/scratch/audit/full_list.txtof the 2026-10-24 audit: sections 5.autouse-in-test-modules, 5.fixtures-defined-in-many-places, 4.tests-of-fakes-or-helpers, 4.expensive-inputs and class 6.tests/conftest.py:83-134at b170358:_PROCESS_STATE_RESETS.
Acceptance criteria
- None of the 15 fixtures is left, and no other module fixture calls a reset that
_PROCESS_STATE_RESETSholds. -
projectandtreeare each defined in one place, or their copies have distinct names. - The five helper-test files are deleted. Any setting they guarded is a
devops cirow, and the pull request shows the row failing on a broken setting. - The nested-YAML case still refuses the body with the same error, and the pull request gives its time before and after.
-
uv run devops cipasses.
Out of scope: the module-level runner = CliRunner() bindings belong to #1307's children (Q14). The duplicated _public_endpoints and _bypass_dns_validation fixtures patch devops_cli names, so #1331, #1328 and #2167 remove them. The CONFIG_PATH patch at tests/test_ai_task_settings_paths.py:30 belongs to #1333.
Proposed design
Problem statement
The test suite carries 15 autouse fixtures that repeat resets the conftest floor already performs, two fixtures defined in four modules each, five test files that test test helpers instead of src/, and one test input 100,000 levels deep where a depth just past the loader limit suffices. These cost CI time and add no check of production code.
Acceptance criteria
- Criterion 1: None of the 15 listed autouse fixtures remains in its module, and no other module fixture calls a reset that _PROCESS_STATE_RESETS holds.
Verification: Run uv run pytest tests/ -x and confirm no collection error. Grep the 15 listed files for the fixture names and confirm they are absent. Run uv run devops ci and confirm the architectural-invariant check passes. - Criterion 2: The project fixture is defined in one place, or its four copies carry distinct names that say what each builds.
Verification: Grep tests/ for the fixture definition of project. Confirm at most one definition remains, or that the remaining copies have distinct names. Run uv run pytest on the four affected modules and confirm they pass. - Criterion 3: The tree fixture is defined in one place, or its four copies carry distinct names that say what each builds.
Verification: Grep tests/ for the fixture definition of tree. Confirm at most one definition remains, or that the remaining copies have distinct names. Run uv run pytest on the four affected modules and confirm they pass. - Criterion 4: The five helper-test files are deleted: test_model_fixture.py, test_support_waits.py, test_support_hung_children.py, test_per_test_timeout.py, test_openblas_worker_threads.py.
Verification: Confirm the five files are absent from tests/. Run uv run pytest tests/ -x and confirm no import or collection error references them. - Criterion 5: Every pytest or conftest setting the deleted tests guarded is now a devops ci row, and the pull request shows that row failing on a broken setting.
Verification: Read the devops ci configuration for the new rows. Run the row with a deliberately broken setting and confirm it fails. Run uv run devops ci with the correct setting and confirm it passes. - Criterion 6: The nested-YAML case in test_semgrep_registry.py builds a body whose depth is just past the loader limit, still receives the same refusal error, and the pull request records its time before and after.
Verification: Read the loader source for the depth limit constant. Confirm the test builds a body at limit+1 depth. Run the test and confirm the same error message. Read the pull request description for before and after timings. - Criterion 7: uv run devops ci passes in full.
Verification: Run uv run devops ci and confirm exit code 0 with no failing check.
Key questions
- Where is _PROCESS_STATE_RESETS defined and what does it hold?: It is defined at tests/conftest.py:82 as a dict mapping module names to tuples of reset function names. The floor iterates it after each test to clear process state. [sources: tests/conftest.py:82, tests/conftest.py:142]
- Where is ModelFake defined and is it already covered by a contract test?: ModelFake lives in tests/support/fakes/model.py. The contract suite in tests/test_model_contract.py already covers it, as recorded in the changelog entry for refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001. [sources: tests/support/fakes/model.py, CHANGELOG.md:550]
- What depth limit does the semgrep registry loader enforce?: The body directs the implementer to read the limit from the loader source and build a body at limit+1 depth. The exact constant is in the loader module under src/. (proposed) [sources: tests/test_semgrep_registry.py:226]
- Which settings did the five deleted helper-test files guard, and what devops ci row replaces each?: test_per_test_timeout.py guarded the pytest-timeout setting; test_openblas_worker_threads.py guarded an environment variable set by the root conftest. Each becomes a devops ci row that checks the setting holds. The pull request must show the row failing on a broken setting. (proposed) [sources: tests/test_per_test_timeout.py, tests/test_openblas_worker_threads.py]
- Do the out-of-scope items (test(cli): tests double only process edges and mirror the source tree #1307, test(ai): the remaining ai modules are tested through their public interfaces on edge fakes, and the legacy provider layer leaves src #1331, test(review): ai/review and review/ are tested through one public interface over the model, tool-executor and process fakes, with no mock detection in src #1328, test(cli): migrate 49 tests to public interfaces #2167, test(cli): Use edge fakes and real git; drop test rebind hooks #1333) block this work?: No. The body lists them as out of scope because they remove other fixtures in the same files. This issue does not depend on their delivery; it only avoids touching those fixtures. (proposed)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady
- StatusShow more project fieldsNew
Activity
dan-petty commentedon Oct 24, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.
The candidate proposes changes to test modules and their fixtures, which falls under test improvements.The changes improve test suite quality but do not address a critical issue or bug.Improving test efficiency and reducing redundant code benefits all developers and users by making tests faster and cleaner.The candidate requires refactoring multiple test files, moving fixtures, deleting tests, and adjusting input data, which is substantial but manageable work.Both items target test files that patch devops_cli names or import private names, but this candidate focuses on fixtures and helper tests while the related item focuses on ownership and internal patches.dan-petty commentedon Oct 28, 2026
Status set to Ready at bb46660 (see proposed design in issue body).