Repository navigation
Description
Problem
devops-cli's tests break when code is refactored without a change in behaviour, and a reader cannot find the tests for a package. Tests patch devops-cli's own functions and import its private names. Each file builds its own doubles, and product code has grown branches that detect mocks. This parent makes tests double only what devops-cli reaches beyond its own process (its edges), through one seam per edge and one shared fake per edge, and lays tests/ out as a mirror of src/devops_cli.
The vocabulary used here and in every child (Edge, Seam, Fake, Contract suite, Hermetic floor, Live test, CLI test, Invariant test, Ratchet, Builder, Snapshot) is defined in docs/TESTING.md. ADR 0005 (docs/adr/0005-tests-double-only-process-edges.md) records the decision. Both are drafted and land with #1308.
Owner decisions (2026-10-07). The owner ranked coupling to internals as the first pain and findability second, then settled the design question by question, and reaffirmed Q32 (filing in phases) and Q34 (amending existing issues) later the same day. Every decision is listed under Key questions; the children state them as decided.
Evidence tags used in this issue and its children.
- [code: path:line] is a line at 5c45b1e, the head of release/v0.2.28 after fix(k8s): argo cd takes homelab values from deploy-time overrides, and the repository holds no private or placeholder config #1290. Paths are under
src/devops_cli/except those starting withtests/and the top-level filesAGENTS.mdandpyproject.toml. - [measured: census] is the edge census taken at 36cfbbb: one deduplicated AST pass over all 447 test files plus grep, with a skeptic's corrections applied.
- [measured: recount] and untagged counts were recounted at 36cfbbb for this issue. fix(k8s): argo cd takes homelab values from deploy-time overrides, and the repository holds no private or placeholder config #1290 moved a few of them slightly by 5c45b1e: 176,301 test lines instead of 175,620, 10 files over 2,000 lines instead of 9, 130 module-level runners instead of 131, and 48 test files that find the repo root by
__file__depth instead of 47. Figures abouttests/conftest.pyare at 5c45b1e. - [measured: timing] is one
pytest -n logicalrun on 16 workers at fca29e9. - [sourced: …] is an upstream page, and [inference] is a conclusion that was not measured.
Tests are coupled to internals
- 3,655 patch sites in the 447 test files: 2,770 aimed at devops-cli internals, 168
patch.objectcalls on local objects, 674 at edges and 43 other; 151 files have none. 210 test files import 937 private names from devops_cli [measured: census]. - Most patched:
run_subprocess262 sites in 61 files,run_gh199 in 20,load_settings135 in 38,_run_mcp_cmd68 in 19,_run_cmd68 in 10 [measured: census]. tests/test_pr_cmd.pyhas 216 patch sites for 101 tests, andtests/test_review_verification.pyimports 75 private names.- Where the coupling reaches [measured: recount]. 2,502 patch sites name a
devops_cli.…path as a string; all but a few dozen (such asdevops_cli.<module>.subprocess.runor.time.sleep) aim at internals. The other internal patches pass an imported devops-cli module or object.
| Package the test reaches into | String patch targets | Private names imported |
|---|---|---|
commands/ (top-level modules) |
804 | 185 |
github/ |
367 | 87 |
commands/k8s/ |
230 | 87 |
security/ |
141 | 28 |
k8s/ |
128 | 15 |
core/ |
120 | 9 |
config/ |
94 | 11 |
ai/review/ |
92 | 292 |
ai/rag/ |
74 | 21 |
ai/mcp/ |
73 | 8 |
ai/ elsewhere (top level and other subpackages) |
125 | 119 |
roadmap/ |
11 | 2 |
Other packages (git/, argo/, sandbox/, telemetry/, …) |
243 | 73 |
| All packages | 2,502 | 937 |
The suite is flat
- 447
tests/test_*.pyfiles hold 175,620 lines and 7,006 test functions in one directory. The only subdirectories aretests/fixtures/(24 data files) andtests/golden/(3 JSON files). 32 files are over 1,000 lines and 9 over 2,000;tests/test_ui_reactive.pyhas 3,463 lines and 198 tests. - Files are named after work, not behaviour:
test_batch_2_review_defects.py, tentest_consolidation_*.pyand three*_hardening.py, and AGENTS.md:161 names two consolidation files as canonical. Catch-alls includetest_ci_helpers_and_edge_cases[code: tests/test_ci.py:383] andtest_classify_license_all_branches[code: tests/test_aibom.py:149]. 263 test names end in_success,_failure,_basicor_command. - Tooling assumes the flat layout:
devops testglobstest_*.pynon-recursively [code: commands/test_cmd.py:72] and maps a source stem to three flat file names [code: commands/test_cmd.py:87-91];- 47 test files find the repo root by
__file__depth; - 3 files import from
tests.conftest, andtests/test_roadmap_dry_runs.py:47imports from another test file.
Doubles are duplicated, and the shared ones patch internals
- Processes: 248 hand-built
CompletedProcess(in 57 files._mock_procis defined intests/test_docker.py:21,tests/test_k8s.py:22,tests/test_uv.py:18andtests/test_gh_project_workflows.py:28. - GitHub:
_FakeGithubfour times intests/test_github_client.py,_FakeGitHubintests/test_review_path_routing.py:111andtests/test_review_scope.py:28,_RecordedGithub[code: tests/test_github_session.py:33] andRecordedGh[code: tests/test_roadmap_github_store.py:93]. - Elsewhere: five
DummyClientmodel fakes intests/test_review_path.py;FakeValkeyintests/test_run_store.py:49andtests/test_run_comparison.py:39; a_finding(...)helper in 14 files; 1,417MagicMock(calls in 196 files. - The shared fakes install by patching private names.
route_clientandroute_llm_clientsreplaceLLMClient's private_shared_clientand_create_http_client[code: tests/llm_stream_fakes.py:98-127], and 12 files patch or call the tracer's private_send_payload[code: telemetry/tracer.py:1232] or_send_payload_sync[code: telemetry/tracer.py:1216].
Edges have no single seam
- Processes:
run_subprocess[code: core/process.py:346] is a free function imported by name, and 11 modules spawn processes themselves [measured: census]. - HTTP: three parallel seams,
new_http_client[code: http/client.py:55],get_shared_client[code: http/pool.py:63] andDEFAULT_HTTP_BROKER[code: http/broker.py:186]; 27 modules outsidehttp/build httpx2 clients or callhttpx2.get/postinline. - Models: 24 inline
LLMClient(...)constructions in 11 modules, beside theget_llm_clientfactory [code: config/settings.py:1237]. - GitHub REST:
GitHubClientcalls the API through PyGithub's own HTTP stack [code: github/client.py:39-46], outside both the gh process and refactor(github): the github session owns transport, ledger, error classes and link pagination #983's session. refactor(github): pull request, repository and ssh key calls move from pygithub onto the github session #891 moves those calls onto the session.
Product code accommodates tests
- Mock detection:
security/base.pyimportsNonCallableMock[code: security/base.py:17], and its_run_subprocesscalls a mock that_is_mockedfinds on the scanner's module insys.modulesinstead of running the tool [code: security/base.py:327-417];- a missing path counts as a scannable manifest when kube-linter is mocked [code: ai/review/pipeline.py:710-715];
- the MCP server checks
hasattr(run_subprocess, "assert_called")[code: ai/mcp/server.py:88]; commands/ci.pyreadsPYTEST_CURRENT_TEST[code: commands/ci.py:253, :257], and the process runner passes that variable through to child processes [code: core/process.py:93];- the async runner reroutes through the sync one when
subprocess.runis patched [code: core/process.py:545]; - the host sandbox answers a mocked
Popenthrough_communicate_mock[code: sandbox/host.py:88-98, :247].
- Shaped for patching:
_K8sModule.__setattr__forwards patches into four submodules [code: commands/k8s/init.py:223-253];- five command modules (release, ci, uv, workspace, branches) look dependencies up through
_LAZY_OBJECT_MAPPINGand_get; - seven scanner modules re-import
run_subprocessandis_dry_rununder# noqa: F401only to give tests a patch target; - the settings cache puts
CONFIG_PATHin its key because "tests rebind it" [code: config/settings.py:928].
- Test-only code ships in the wheel:
roadmap/memory_store.py(1,093 lines) has no importer insrc.
The root conftest is both the floor and a domain toolbox
tests/conftest.pyis 917 lines with 17 autouse fixtures.- It turns telemetry export on for every test [code: tests/conftest.py:465, :471], so spans queue exports that the network guard refuses [measured: census].
tmp_ssh_dirandtmp_repos_dirhave no users, andverify_test_paths_isolatedcannot fail.
- 22 process-wide caches and singletons get no public reset from any fixture (the conftest pins one, the
core.processGitHub token, through private names), and 8 of them have no reset function [measured: census]. - State escapes the test's directories:
- two tests create review worktrees under the real home (
tests/test_git_worktree.py:96,tests/test_review_worktree_regression.py:80), becausegit/worktree.pyreads its own import-timeCONST_USER_DATA_ROOT[code: git/worktree.py:31] while the conftest rebinds onlycore.repo's [code: tests/conftest.py:308]; - the Ollama round-robin file is shared in the system temp directory [code: ai/client/network.py:94];
- the port-forward daemon keeps a cwd-relative state file [code: k8s/port_forward_daemon.py:21], which fix(ai): the durable-run store resolves under the data directory, so tests never write .data/durable_runs.db into the checkout #1036 fixes.
- two tests create review worktrees under the real home (
- 131 test files build their own module-level
runner = CliRunner(...). - The 21
@pytest.mark.bwraplive tests never run:if True:[code: tests/conftest.py:873] skips them even where bwrap is installed (fix(ci): the live bubblewrap tests run wherever bwrap is installed and skip only where it is missing #1337).
The roadmap package shows the alternative works
461 test functions in 15 tests/test_roadmap*.py files carry 68 patch sites. They run on InMemoryRoadmapStore, whose constructor takes clock= [code: roadmap/memory_store.py:176], and on an injected runner= typed by the GhRunner Protocol [code: roadmap/github_store.py:136]. A contract suite pins the store's promises against the in-memory adapter (tests/test_roadmap_store_contract.py, SteppedClock at :44), and the GitHub adapter keeps the same promises over recorded gh output (tests/test_roadmap_github_store.py). #983 replaces this GhRunner injection with the GitHub session: the store keeps no GhRunner, and its tests build it on a session over MockTransport for REST and a scripted runner for the board commands. #1335 builds its stores on #983's session fake.
Speed is out of scope
9,278 tests pass in about 130 s wall against 1,015.9 s of summed test time, so about half the wall time is overhead; every worker repeats collection, and tests/test_ui_reactive.py alone sums 146.3 s [measured: timing]. #1338 and #1339 take these, outside this parent (Q12).
Considered options
Chosen: tests double only process edges, each through one seam in src with one shared fake and its contract suite, in a tests/ tree that mirrors src/devops_cli.
- Patch at the library boundary only (
subprocess.run, httpx2 transports, SDK classes), with no source changes: rejected. Several SDKs speak HTTP through other stacks (plain httpx, urllib3, requests) that a class swap cannot reach, and the shared HTTP pool hands out cached clients that bypass it. Patching the stdlib object stays as a fallback for stdlib edges. - Pass every client down the call graph as a parameter: rejected. It rewrites signatures across hundreds of modules for no gain over one seam per edge.
- Allow internal patches with a stated reason: rejected. Exceptions accumulate until the rule means nothing.
- freezegun, or a home-grown Clock: rejected. freezegun is unmaintained, and its frozen monotonic clock hangs asyncio and tenacity. A home-grown Clock would duplicate what the libraries already accept: time-machine fakes wall-clock reads, and waiting goes through the parameters tenacity, ratelimit and pydantic-ai already offer.
- One test file per source module: rejected. Tests target the package's public interface, one file per behaviour (Q10).
- Move tests package by package, together with their design fixes: rejected. One
git mvPR at a quiet point onmainkeeps each file's history and makes every open PR rebase once; design fixes follow per package [inference]. - Keep in-memory test implementations in
src: rejected. They move totests/support/fakes/, and fakes never ship in the wheel (Q25). - Keep the testing vocabulary in CONTEXT.md or AGENTS.md: rejected. CONTEXT.md stays a domain glossary, and AGENTS.md links to
docs/TESTING.md(Q5). - Keep the tuple-assert mandate: rejected. 15 linear asserts score McCabe 1 under ruff C901, so the mandate's complexity rationale does not hold (Q7).
- File the package migrations lazily, once their seams land: rejected. A person can order only the work that is filed (Q33).
Consequences
- One seam per edge. An edge without a seam gets one before its tests migrate. refactor(cli): one process runner owns execution, process groups and dry-run #775 (processes), refactor(github): the github session owns transport, ledger, error classes and link pagination #983 (GitHub session), refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001 (models) and feat(review): review tools run through one injectable executor in a network-less sandbox with CPU, memory and time limits #772 (review tools) are the first seam items; refactor(cli): Unify HTTP and DNS seams with shared fakes #1314 to refactor(cli): tests control time: time-machine fakes wall-clock reads, and retry and rate-limit waits return at once and are recorded #1320 add the rest. refactor(github): pull request, repository and ssh key calls move from pygithub onto the github session #891 brings PyGithub behind refactor(github): the github session owns transport, ledger, error classes and link pagination #983's session, so one GitHub fake covers every GitHub call.
- Every fake has a contract suite, run against the fake and the real implementation (recorded responses or a real local tool, never a live service). A fake without one cannot merge.
- The hermetic floor denies by default. A test that reaches a faked edge without its fake fails with an error naming the edge. Process-wide state is reset after every test, and telemetry export is off unless a test opts in.
- Accommodations go. Product code that detects mocks or exists only to be patched is deleted, package by package. Ratchets keep internal patches, private imports, accommodations and the flat layout from growing until each reaches zero, and test(cli): Convert ratchets to bans and merge invariant tests #1336 turns them into bans.
- One mechanical move. test(cli): every test file sits in the directory mirroring the package it tests or in tests/invariants/, and the root conftest holds only the hermetic floor #1313 renames whole files and nothing else. Open PRs that touch tests rebase once, at a quiet point on
main[inference]. - Dead code is deleted, not covered: the legacy
ai/providers/{anthropic,openai,ollama,copilot}.py,tests/mock_provider.py,core/process_pipeline.py, and every line no public behaviour reaches. The 90% coverage gate stays. - Commands become thin adapters. Domain logic behind private helpers in
commands/moves into its domain package behind a public function. - git and bwrap run for real in temporary directories; bwrap tests skip only where bwrap is missing.
- New dev dependencies: syrupy, pinned at 6.1.1 (test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312), and time-machine 3.5.1 (refactor(cli): tests control time: time-machine fakes wall-clock reads, and retry and rate-limit waits return at once and are recorded #1320).
- Shared test support comes first. test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312 creates
tests/support/with the glossary builders before any E child, so the E children adopt one set of builders instead of each defining its own. - Documentation:
docs/TESTING.mdis the one place for test conventions. AGENTS.md,docs/SDLC.md,CONTRIBUTING.mdand.devops/review.mdlink to it, and the tuple-assert mandate leaves AGENTS.md (docs(cli): docs/TESTING.md holds the test conventions, ADR 0005 records that tests double only process edges, and AGENTS.md and the contributor docs point to them #1308). test(cli): retire the tuple-assert mandate and detect opaque tuple asserts and presence-only tests #851 keepsai/instruction_generator.py, the AST check and the site rewrites; the generator carries no copy of the mandate at 5c45b1e. refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150 deletes the review's catalog entry for the mandate [code: ai/review/common_hallucinations.json:731] and the verifier guard that enforces it [code: ai/review/verification.py:1171].
Acceptance criteria
Phases are an order, not milestones: a person plans each child on the board.
Phase A: conventions
- docs(cli): docs/TESTING.md holds the test conventions, ADR 0005 records that tests double only process edges, and AGENTS.md and the contributor docs point to them #1308:
docs/TESTING.mdholds the test vocabulary and conventions and ADR 0005 records the decision; AGENTS.md,docs/SDLC.md,CONTRIBUTING.mdand.devops/review.mdlink to it and drop their own test rules, including AGENTS.md's tuple-assert mandate. - test(cli): retire the tuple-assert mandate and detect opaque tuple asserts and presence-only tests #851: the tuple-assert mandate is retired in code:
ai/instruction_generator.py, the site rewrites, and an AST check that detects opaque tuple asserts and presence-only tests (Q7). - test(cli): ratchets hold internal patches, private imports and test accommodations in src at today's counts and name each site that would raise one #1309: ratchets hold today's counts of patches aimed at devops-cli internals, private imports from devops_cli, and
unittest.mock,PYTEST_CURRENT_TESTand mock-attribute checks insrc; no count may grow.
Phase B: floor and prep
- test(cli): the hermetic floor fails a test that reaches an edge without a fake and resets all process-wide state after every test #1310: the hermetic floor fails a test that reaches a faked edge without its fake, resets every process-wide cache and singleton after each test (an invariant catches a new one without a reset), and keeps telemetry export off unless a test opts in; the
configand sharedclifixtures exist; the Qdrant session guardguard_live_rag_data[code: tests/conftest.py:480] stops reading the real config. - fix(ci): tests touch no state outside their temporary directories #1311: no test touches state outside its temporary directories. Each worker runs with an empty home of its own, the system temp directory resolves under the test's
tmp_path, and review worktrees and the Ollama round-robin file [code: ai/client/network.py:94] resolve under the test's directories. The port-forward daemon's state file [code: k8s/port_forward_daemon.py:21] is fixed by fix(ai): the durable-run store resolves under the data directory, so tests never write .data/durable_runs.db into the checkout #1036, not here. - test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312:
tests/support/exists; tests find the repo root andtests/fixturesthrough it, not by__file__depth; no test importstests.conftestor another test file;devops testmaps a changed source file to its mirror directory and searches recursively. It also:- creates
tests/support/builders.pywith the glossary builders the E children use (make_finding,make_verdict,make_item,make_candidate), each built through the real constructor (Q20), and movestests/markdown_examples.pythere; - adds syrupy, pinned at 6.1.1, to the
devdependency group (Q18).
- creates
Phase C: move
- test(cli): every test file sits in the directory mirroring the package it tests or in tests/invariants/, and the root conftest holds only the hermetic floor #1313: every
test_*.pysits in a mirror directory ofsrc/devops_clior intests/invariants/, moved by puregit mvwith no renames or content edits; the root conftest is split into package conftests; a layout ratchet keeps it so. It lands at a quiet point onmain.
Phase D: seams and fakes
Each child except #1320 adds one seam in src (a Protocol plus the one place that supplies the real implementation), the edge's fake under tests/support/fakes/ and the fake's contract suite. #1320 adds no Clock type: time-machine and the libraries' own parameters serve instead (Q30).
- refactor(cli): one process runner owns execution, process groups and dry-run #775: one process runner owns execution, process groups and dry-run; the process fake covers every program except git and bwrap,
shutil.whichincluded. refactor(cli): one process runner owns execution, process groups and dry-run #775 also consolidates the four process-group copies, and the E children confirm none remain. - refactor(github): the github session owns transport, ledger, error classes and link pagination #983: the GitHub session owns transport, ledger, error classes and link pagination, and has a fake.
- refactor(github): pull request, repository and ssh key calls move from pygithub onto the github session #891 (not a child, not amended): moves the pull request, repository and SSH-key calls from PyGithub onto the GitHub session. It builds on refactor(github): the github session owns transport, ledger, error classes and link pagination #983, and once it lands refactor(github): the github session owns transport, ledger, error classes and link pagination #983's fake covers the PyGithub REST client, a faked edge under Q23. test(github): github/ is tested through its public interface over the gh process and session fakes, with no internal patches or private imports #1321, test(cli): devops pr, gh and repos are thin adapters tested over edge fakes, and merge readiness is tested in its package #1324, test(ai): devops review, devops analyze and the devops ai commands are thin adapters tested over the model seam and edge fakes #1326, 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(ai): the remaining ai modules are tested through their public interfaces on edge fakes, and the legacy provider layer leaves src #1331 and test(security): scanner, secret and crypto tests run on the executor, process, http and keyring fakes, and scanners stop looking for mocks #1332 wait for it.
- refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001: one model seam,
LLMClientover wire adapters behind one factory, with a model fake. refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001 also routes the inlineLLMClient(...)constructions, and the E children confirm none remain. - feat(review): review tools run through one injectable executor in a network-less sandbox with CPU, memory and time limits #772: review tools run through one injectable executor, with an executor fake (also a child of feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137, phase P1a).
- refactor(cli): Unify HTTP and DNS seams with shared fakes #1314: one HTTP and DNS seam replaces
new_http_client,get_shared_clientandDEFAULT_HTTP_BROKER; the HTTP fake runs on httpx2MockTransport, and the DNS fake grows frompublic_dns. - refactor(k8s): KubernetesService is the Kubernetes API seam, with a shared fake cluster and its contract suite #1315:
KubernetesService[code: k8s/service.py:55] is the one way to the Kubernetes API, the three independent loaders included;FakeCoreV1becomes its fake. - refactor(infra): DockerEngineService is the Docker engine seam, with a shared in-memory engine fake and its contract suite #1316:
DockerEngineService[code: docker/engine.py:197] is the one way to the Docker engine,docker.from_env()[code: ui/data_providers.py:221] included, with an engine fake. - refactor(ai): Valkey, Qdrant and the embedder each have one seam, with shared fakes and contract suites #1317: Valkey (
ValkeyClient[code: valkey/client.py:64]), Qdrant and embeddings each have one seam and one shared fake; the hand-rolled copies in test files go as their packages migrate. - refactor(security): one keyring seam owns the keyring and the Secret Service lock check, with a shared keyring fake and its contract suite #1318: keyring and D-Bus go through one seam (
get_keyring_secret, theSecretProviderProtocol [code: security/secrets.py:116]);FakeKeyringbecomes its fake. - refactor(telemetry): OTLP export goes through one exporter seam, and tests read exported spans and metrics from a shared fake #1319: OTLP export has a public seam in place of the private
_send_payloadand_send_payload_sync, with an OTLP fake. - refactor(cli): tests control time: time-machine fakes wall-clock reads, and retry and rate-limit waits return at once and are recorded #1320: tests control time with time-machine (3.5.1, added to the
devgroup) and the libraries' own sleep and clock parameters (Q30). Tenacity and pydantic-ai'sRetryConfigwait through the sleeps one place insrcsupplies. The burst limit takes that clock at construction, and only if fix(github): gh calls no longer stall silently for up to a minute behind a fixed 60-call window, and the unmaintainedratelimitpackage is removed #1118 has not already removedratelimit.AsyncLimitergets no seam, because its only user,run_gh_async, has no caller and refactor(github): the github session owns transport, ledger, error classes and link pagination #983 deletes it. - Outbound MCP servers and durable backends get their seam when their package migrates; no child now.
Phase E: package migrations
Each E child does the following for its directories:
- no patch aimed at devops-cli internals and no private import remain;
- no
unreachable(...)marker remains in its files; - files are split into behaviour files (Q10) with behaviour-named tests (Q8), and assertions compare whole values (Q7);
- CLI tests use test(cli): the hermetic floor fails a test that reaches an edge without a fake and resets all process-wide state after every test #1310's shared
clifixture in place of module-level runners (Q14); - catch-all tests are dissolved and unreachable lines deleted (Q22);
- domain logic in
commands/moves into its domain package (Q19); - the package's accommodations are deleted (Q27);
- tests adopt test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312's builders (Q20) and syrupy snapshots (Q18);
- invariant tests go into the
tests/invariants/subject file for their subject (Q13); - if test(cli): ratchets hold internal patches, private imports and test accommodations in src at today's counts and name each site that would raise one #1309 has landed, its ceilings drop by what the child removed.
Each E child names its test files. Every test file outside tests/invariants/ is named in exactly one E child, so a shared directory such as tests/commands/ or tests/ai/ has no file that no child owns. Where #775 or #1001 already routes a package's bypassing callers, the E child confirms that none remain.
- test(github): github/ is tested through its public interface over the gh process and session fakes, with no internal patches or private imports #1321:
github/. - test(k8s): k8s/ is tested through its public interface over the Kubernetes API, process, HTTP and keyring fakes, with no internal patches or private imports #1322:
k8s/. - test(k8s): devops k8s commands are thin adapters tested over edge fakes, and the _K8sModule patch forwarding is gone #1323:
commands/k8s/, including_K8sModule's patch forwarding. - test(cli): devops pr, gh and repos are thin adapters tested over edge fakes, and merge readiness is tested in its package #1324: GitHub-facing commands:
commands/pr,ghandrepos. - test(ci): devops ci, test, devcontainer, workspace, install-tools, uv, branches and pipeline are tested over edge fakes, with no lazy patch targets or PYTEST_CURRENT_TEST checks #1325: dev-workflow commands:
commands/ci,test_cmd,devcontainer,workspace,install_tools,uv,branchesand (proposed)pipeline, including thePYTEST_CURRENT_TESTchecks. - test(ai): devops review, devops analyze and the devops ai commands are thin adapters tested over the model seam and edge fakes #1326: AI commands:
commands/review,analyze,ai,ai_gatewayand the otherai_*command modules. - test(cli): the infra commands are thin adapters tested over edge fakes, with no internal patches or private imports #1327: infra commands:
commands/cloudflare,tf,sandbox,valkey,scan,prometheus,telemetry,vault,configand (proposed)argo,docker,grafana,kustomize,tls. Thedevops sandboxtest files referencesandbox/most, so they sit intests/sandbox/and migrate with test(infra): infrastructure tests run on edge fakes #1335. - 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:
ai/review/andreview/, including the kube-linter mock check, the threetests/goldenfiles andtests/test_review_regression_harness.py. - test(ai): Wire rag once in ai/rag, test with edge fakes #1329:
ai/rag/andai/library/, withcommands/rag. - test(mcp): mcp, agent and tool tests run on edge fakes #1330: AI agents:
ai/mcp/,ai/agents/,ai/harness/,ai/tools/,ai/toolsets/andcommands/mcp, including the MCP mock check. - test(ai): the remaining ai modules are tested through their public interfaces on edge fakes, and the legacy provider layer leaves src #1331: the rest of
ai/: top-level modules,ai/client/,ai/spend/,ai/analyze/,ai/providers/,ai/models/and the other subpackages, withcommands/benchmark. - test(security): scanner, secret and crypto tests run on the executor, process, http and keyring fakes, and scanners stop looking for mocks #1332:
security/andcrypto/, withcommands/ssh, including the scanner mock detection and the seven# noqa: F401re-imports. - test(cli): Use edge fakes and real git; drop test rebind hooks #1333: foundation:
core/,config/,git/,dry_run/,http/and (proposed)main.py,entry.py,exceptions/,lang/,models/, including the async reroute and theCONFIG_PATHcache key. - test(telemetry): telemetry, server, ui, output and docs tests run on edge fakes, and the dashboard suite splits by behaviour #1334:
telemetry/,server/,ui/,output/, withcommands/serve,dashboardandstatus_cmd, and (proposed)docs/withcommands/docs. - test(infra): infrastructure tests run on edge fakes #1335: infra packages (
sandbox,docker,argo,valkey,cache,cloudflare,grafana,prometheus,tf,watchers) plus the nearly cleanroadmap,ciandpipeline, withcommands/roadmap, including the host sandbox's mock branch.
Phase F: finish
- test(cli): Convert ratchets to bans and merge invariant tests #1336: every ratchet at zero becomes a hard ban, and a ban fails any module under
tests/support/fakes/that no contract suite runs against its real implementation (Q26). test(cli): Convert ratchets to bans and merge invariant tests #1336 ownstests/invariants/: it merges the invariant files test(cli): every test file sits in the directory mirroring the package it tests or in tests/invariants/, and the root conftest holds only the hermetic floor #1313 moved there into the Q13 subject files, removes their private imports and module-level runners, and bans any file there that is not subject-named. AGENTS.md's test rules point only atdocs/TESTING.md. - Exit, when test(cli): Convert ratchets to bans and merge invariant tests #1336 lands:
- 0 patches aimed at devops-cli internals and 0 private imports from devops_cli in
tests/; - 0
unittest.mock,PYTEST_CURRENT_TESTor mock-attribute checks insrc; - every
test_*.pyin a mirror directory or in a subject-named file intests/invariants/; - every fake under
tests/support/fakes/has a contract suite; - the coverage gate is still 90%.
- 0 patches aimed at devops-cli internals and 0 private imports from devops_cli in
Dependencies
These are hard orderings, and each one is also a native blocked_by link (Q31).
- test(cli): the hermetic floor fails a test that reaches an edge without a fake and resets all process-wide state after every test #1310, test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312 → test(cli): every test file sits in the directory mirroring the package it tests or in tests/invariants/, and the root conftest holds only the hermetic floor #1313.
- test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312 → refactor(cli): one process runner owns execution, process groups and dry-run #775, refactor(github): the github session owns transport, ledger, error classes and link pagination #983, refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001, feat(review): review tools run through one injectable executor in a network-less sandbox with CPU, memory and time limits #772 (links added by the Q34 amendments), refactor(cli): Unify HTTP and DNS seams with shared fakes #1314, refactor(k8s): KubernetesService is the Kubernetes API seam, with a shared fake cluster and its contract suite #1315, refactor(infra): DockerEngineService is the Docker engine seam, with a shared in-memory engine fake and its contract suite #1316, refactor(ai): Valkey, Qdrant and the embedder each have one seam, with shared fakes and contract suites #1317, refactor(security): one keyring seam owns the keyring and the Secret Service lock check, with a shared keyring fake and its contract suite #1318, refactor(telemetry): OTLP export goes through one exporter seam, and tests read exported spans and metrics from a shared fake #1319, refactor(cli): tests control time: time-machine fakes wall-clock reads, and retry and rate-limit waits return at once and are recorded #1320.
- test(cli): every test file sits in the directory mirroring the package it tests or in tests/invariants/, and the root conftest holds only the hermetic floor #1313 → test(github): github/ is tested through its public interface over the gh process and session fakes, with no internal patches or private imports #1321 … test(infra): infrastructure tests run on edge fakes #1335. Each E child also waits for the seams it uses:
| Child | Waits for, besides #1313 |
|---|---|
| #1321 | #775, #983, #891, #1318, #1319, #1320 |
| #1322 | #775, #1314, #1315, #1318, #1320 |
| #1323 | #775, #1315, #1318, #1320 |
| #1324 | #775, #983, #891, #1320 |
| #1325 | #775, #1314, #1316, #1318, #1320 |
| #1326 | #775, #983, #891, #1001, #772, #1314, #1317, #1318, #1319 |
| #1327 | #775, #772, #1314, #1315, #1316, #1317, #1318, #1319, #1320 |
| #1328 | #775, #983, #891, #1001, #772, #1317, #1320 |
| #1329 | #775, #1314, #1315, #1317, #1318, #1319, #1320 |
| #1330 | #775, #1001, #772, #1314, #1317, #1318, #1320 |
| #1331 | #775, #983, #891, #1001, #1314, #1317, #1318, #1319, #1320 |
| #1332 | #775, #983, #891, #772, #1314, #1317, #1318, #1319, #1320 |
| #1333 | #775, #1311, #1314, #1318, #1319 |
| #1334 | #775, #1314, #1315, #1316, #1317, #1318, #1319, #1320 |
| #1335 | #775, #983, #1001, #1314, #1315, #1316, #1317, #1318, #1319, #1320 |
- docs(cli): docs/TESTING.md holds the test conventions, ADR 0005 records that tests double only process edges, and AGENTS.md and the contributor docs point to them #1308, test(cli): ratchets hold internal patches, private imports and test accommodations in src at today's counts and name each site that would raise one #1309 and test(github): github/ is tested through its public interface over the gh process and session fakes, with no internal patches or private imports #1321 … test(infra): infrastructure tests run on edge fakes #1335 → test(cli): Convert ratchets to bans and merge invariant tests #1336.
- refactor(github): pull request, repository and ssh key calls move from pygithub onto the github session #891 is not a child. It builds on refactor(github): the github session owns transport, ledger, error classes and link pagination #983, and the six children above that reach PyGithub wait for it.
- No prerequisites: docs(cli): docs/TESTING.md holds the test conventions, ADR 0005 records that tests double only process edges, and AGENTS.md and the contributor docs point to them #1308, test(cli): retire the tuple-assert mandate and detect opaque tuple asserts and presence-only tests #851, test(cli): ratchets hold internal patches, private imports and test accommodations in src at today's counts and name each site that would raise one #1309, test(cli): the hermetic floor fails a test that reaches an edge without a fake and resets all process-wide state after every test #1310, fix(ci): tests touch no state outside their temporary directories #1311, test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312.
- Soft order: docs(cli): docs/TESTING.md holds the test conventions, ADR 0005 records that tests double only process edges, and AGENTS.md and the contributor docs point to them #1308 and test(cli): ratchets hold internal patches, private imports and test accommodations in src at today's counts and name each site that would raise one #1309 land early, so children cite
docs/TESTING.mdand have ceilings to lower. An E child that lands before test(cli): ratchets hold internal patches, private imports and test accommodations in src at today's counts and name each site that would raise one #1309 has no ceiling to lower, and test(cli): ratchets hold internal patches, private imports and test accommodations in src at today's counts and name each site that would raise one #1309 then sets its ceilings at the lower count.
Key questions
-
Q1. Which pain comes first? Decided 2026-10-07: coupling to internals, which breaks tests on behaviour-preserving refactors; findability second.
-
Q2. What may a test double? Decided 2026-10-07: only process edges, through shared in-memory fakes. Tests never patch devops-cli internals.
-
Q3. How is
tests/laid out? Decided 2026-10-07: as a mirror of thesrc/devops_clipackage tree, each directory with its ownconftest.pyfor package fixtures. -
Q4. How do existing tests get there? Decided 2026-10-07: in one mechanical move PR at a quiet point on
main(test(cli): every test file sits in the directory mirroring the package it tests or in tests/invariants/, and the root conftest holds only the hermetic floor #1313); design fixes land per package as separate items (phase E). -
Q5. Where do the conventions live? Decided 2026-10-07: in
docs/TESTING.md. AGENTS.md,docs/SDLC.md("Test Architecture & Standards"),CONTRIBUTING.mdand.devops/review.mdlink to it and drop their copies. CONTEXT.md stays a domain glossary. -
Q6. What do ratchets hold? Decided 2026-10-07: patches aimed at devops-cli internals, imports of private names from devops_cli, and the layout. Each count may only go down, like
test_c901_suppressions_stay_under_the_ceiling[code: tests/test_architectural_invariants.py:1327]. -
Q7. How do tests assert? Decided 2026-10-07: on whole values (
result == expectedagainst a complete model;fake.requests == [...]). Tuple equality only picks fields out of objects with noisy fields. test(cli): retire the tuple-assert mandate and detect opaque tuple asserts and presence-only tests #851 retires the mandate in code (ai/instruction_generator.py, the AST check and the site rewrites); docs(cli): docs/TESTING.md holds the test conventions, ADR 0005 records that tests double only process edges, and AGENTS.md and the contributor docs point to them #1308 removes the AGENTS.md text. refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150 deletes the review's catalog entry and verifier guard that defend the mandate. -
Q8. How are tests named? Decided 2026-10-07: after behaviour, in CONTEXT.md glossary terms (
test_stalled_item_is_treated_as_not_started); never after helpers, private functions or mocks, and never with an Avoid synonym. -
Q9. How deep is the mirror? Decided 2026-10-07: full depth;
src/devops_cli/ai/review/*maps totests/ai/review/. -
Q10. One test file per what? Decided 2026-10-07: per behaviour of the package, tested through its public interface and named after the behaviour (
tests/roadmap/test_descoping.py), not per source module. -
Q11. Is the decision recorded? Decided 2026-10-07: in ADR 0005 (written), which lands with docs(cli): docs/TESTING.md holds the test conventions, ADR 0005 records that tests double only process edges, and AGENTS.md and the contributor docs point to them #1308.
-
Q12. Is speed part of the design? Decided 2026-10-07: no. perf(ci): the gate's test workers start at least 15% faster, and the full test run keeps at least half of that saving #1338 and perf(cli): the dashboard's reactive tests run in half today's time and still check every behaviour #1339 stand alone.
-
Q13. Where do tests without a source mirror go? Decided 2026-10-07: to
tests/invariants/, the one approved directory outside the mirror, in files named by subject:test_source_tree.py,test_agents_md.py,test_task_files.py,test_workflows.py,test_k8s_manifests.py,test_grafana_dashboards.py. Cross-package behaviour tests (*_hardening.py,test_subprocess_env_boundary.py, …) go to the package that owns the behaviour.- test(cli): Convert ratchets to bans and merge invariant tests #1336 owns the directory. It merges the files test(cli): every test file sits in the directory mirroring the package it tests or in tests/invariants/, and the root conftest holds only the hermetic floor #1313 moved there under their current names into the subject files, removes their private imports and module-level runners, and bans any file that is not subject-named.
- Children that add invariant tests earlier add them to the subject file, creating it if absent, and never to a parallel file: for example test(k8s): k8s/ is tested through its public interface over the Kubernetes API, process, HTTP and keyring fakes, with no internal patches or private imports #1322 and test(k8s): devops k8s commands are thin adapters tested over edge fakes, and the _K8sModule patch forwarding is gone #1323 use
test_k8s_manifests.py, and test(ci): devops ci, test, devcontainer, workspace, install-tools, uv, branches and pipeline are tested over edge fakes, with no lazy patch targets or PYTEST_CURRENT_TEST checks #1325 usestest_workflows.py. - (proposed) Files that fit none of the six subjects, such as the docs, isolation-tripwire and third-party-telemetry tests, get a subject name that test(cli): Convert ratchets to bans and merge invariant tests #1336 states.
-
Q14. How are CLI tests written? Decided 2026-10-07: one shared
clifixture in the root conftest replaces the 131 module-level runners. CLI tests live undertests/commands/with edge fakes and check only parsing, wiring, output and exit codes. Domain rules are tested once, through the domain package. -
Q15. What stays in the root conftest? Decided 2026-10-07: only the hermetic floor. That is the network block; isolation of env, data dir, config, kubeconfig, gh config and D-Bus; and the workspace tripwire.
- Domain fixtures move to package conftests or beside their fake.
- Dead fixtures (
tmp_ssh_dir,tmp_repos_dir) andverify_test_paths_isolatedgo. - The conftest's own private patches (
_github_token,_own_source_dir,_CONSOLE) count toward the ratchet. - The session guard that reads the real config,
guard_live_rag_data[code: tests/conftest.py:480], is fixed.
-
Q16. How does a test set config? Decided 2026-10-07: through a
configfixture that writes overrides into the per-testconfig.yamlnamed byDEVOPS_CLI_CONFIGand resets the settings cache. Tests never patchload_settings,CONFIG_PATHorget_settings. -
Q17 and Q29. What is in the move PR, and what lands before it? Decided 2026-10-07: pure
git mvof whole files into mirror directories plus the conftest split, with no renames and no content edits; each file goes to the package owning most of what it tests. test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312 lands first. -
Q18. Snapshots? Decided 2026-10-07: syrupy for outputs whose whole text is the contract (CLI output, rendered manifests, prompts), hand-written literals elsewhere, and Pydantic models via
model_dump()or the syrupy pydantic plugin. The 3tests/goldenJSON files migrate. Updates use--snapshot-file-lock, because syrupy 6.1.1 can destroy a multi-entry.ambrfile under xdist [sourced: syrupy issue 1237; PR 1242, which enables the lock automatically, is merged but unreleased].- test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312 adds syrupy, pinned at 6.1.1, to the
devdependency group, so parallel E children do not race onpyproject.tomlanduv.lock. - 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 migrates all three golden files (
criteria_replay.json,criteria_direction.jsonandreview_findings.json). It also ownstests/test_review_regression_harness.py, which reads the third [code: tests/test_review_regression_harness.py:46].
- test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312 adds syrupy, pinned at 6.1.1, to the
-
Q19. What about domain logic inside
commands/? Decided 2026-10-07: it moves behind a public function in its domain package, tested there, in that package's E child, and the command becomes a thin adapter. A move too big for the child gets its own item; until then the logic is tested through the CLI with edge fakes. -
Q20. How is test data built? Decided 2026-10-07: with one shared builder per glossary type (
make_finding,make_item, …), named after the CONTEXT.md term, built through the real constructor with validation, taking keyword overrides; plain functions intests/support.- test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312 creates
tests/support/builders.pywith the builders the E children use:make_finding,make_verdict,make_itemandmake_candidate, for the CONTEXT.md terms Finding, Verdict, Item and Candidate. - test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312 also moves
markdown_examples.pythere. The E children only adopt the builders.
- test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312 creates
-
Q21. Property tests? Decided 2026-10-07: expected for state machines and for pure functions over open-ended input (parsers, policy evaluation, redaction), with Hypothesis; example tests elsewhere. feat(cli): structured fuzzing of parsers and schema boundaries #416 carries parser fuzzing.
-
Q22. Lines no test reaches? Decided 2026-10-07: a line no public behaviour reaches is dead code, deleted in the same item. The 90% coverage gate stays [code: pyproject.toml:137].
-
Q23. Which edges are faked? Decided 2026-10-07.
- Faked: every process except git and bwrap (gh, kubectl, helm, minikube, the docker and podman CLIs, scanners, the
uv run devopsself-invocation), withshutil.whichpart of the process fake; all network (HTTP on any stack, raw sockets, DNS); LLM and embedding providers; the Kubernetes API; the Docker engine; Valkey; Qdrant; the PyGithub REST client; outbound MCP servers; durable backends; OTLP export; keyring and D-Bus. - Real: the filesystem under
tmp_path; env and config (the floor plus theconfigfixture); git in temporary repos; bwrap in marked live tests; in-process servers (FastAPI TestClient, loopback servers); randomness; host identity; stdin throughCliRunner(input=). - Default deny: the floor fails a test that reaches a faked edge without a fake, naming the edge.
- The PyGithub REST client is faked through refactor(github): the github session owns transport, ledger, error classes and link pagination #983's session fake once refactor(github): pull request, repository and ssh key calls move from pygithub onto the github session #891 has moved
GitHubClient's calls onto the session. test(github): github/ is tested through its public interface over the gh process and session fakes, with no internal patches or private imports #1321, test(cli): devops pr, gh and repos are thin adapters tested over edge fakes, and merge readiness is tested in its package #1324, test(ai): devops review, devops analyze and the devops ai commands are thin adapters tested over the model seam and edge fakes #1326, 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(ai): the remaining ai modules are tested through their public interfaces on edge fakes, and the legacy provider layer leaves src #1331 and test(security): scanner, secret and crypto tests run on the executor, process, http and keyring fakes, and scanners stop looking for mocks #1332 wait for refactor(github): pull request, repository and ssh key calls move from pygithub onto the github session #891.
- Faked: every process except git and bwrap (gh, kubectl, helm, minikube, the docker and podman CLIs, scanners, the
-
Q24. What is a seam? Decided 2026-10-07: one per edge in
src, a Protocol plus the one place that supplies the real implementation. Tests install the fake through the seam's hook (a fixture), or through a constructor or parameter where domain code already takes one (roadmap'srunner=, which refactor(github): the github session owns transport, ledger, error classes and link pagination #983 replaces with the GitHub session). Patching the stdlib or SDK object is a fallback for stdlib edges only. Callers that bypass a seam (11 direct subprocess spawners, 27 inline httpx2 builders, 24 inlineLLMClient(...)constructions) are routed through it in their package's E child.- Where an existing seam item already claims the call sites, it routes them, and the E children only confirm none remain in their packages: refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001 the inline
LLMClient(...)constructions, refactor(cli): one process runner owns execution, process groups and dry-run #775 the four process-group copies.
- Where an existing seam item already claims the call sites, it routes them, and the E children only confirm none remain in their packages: refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001 the inline
-
Q25. Where do fakes live? Decided 2026-10-07:
tests/support/holdsfakes/<edge>.py,builders.py(test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312) and shared fixtures registered once from the root conftest. In-memory implementations production does not use move there (InMemoryRoadmapStorebecomes the roadmap store fake). Code production uses stays insrc, dead code is deleted (Consequences), and fakes never ship in the wheel. -
Q26. How is a fake kept honest? Decided 2026-10-07: by a contract suite run against the fake and the real implementation, the real side against recorded responses or a real local tool, never a live service. A fake without one cannot merge.
-
Q27. What happens to test accommodations in
src? Decided 2026-10-07: an invariant bansunittest.mock,PYTEST_CURRENT_TESTand mock-attribute checks insrc, as a ratchet at today's count that reaches zero (test(cli): ratchets hold internal patches, private imports and test accommodations in src at today's counts and name each site that would raise one #1309). Each E child deletes the accommodations listed under Problem that sit in its directories. -
Q28. What does the floor reset? Decided 2026-10-07: after each test, the public reset of every process-wide cache and singleton, adding resets where missing and closing the HTTP pool. Telemetry export is off by default; a test opts in with the OTLP fake. An invariant fails when a module-level cache or
globalinsrchas no reset in the floor. -
Q30. How do tests control time? Decided 2026-10-07: time-machine (3.5.1, maintained, cp314 wheels) fakes wall-clock reads. No home-grown Clock; freezegun is rejected. Waiting goes through the libraries' own injection points:
- tenacity
sleep=; ratelimit.limits(clock=), moved from import time [code: github/rate_limiter.py:64] to construction time;- pydantic-ai
RetryConfigsleep[code: ai/retries/init.py:48-64]; - an injected async sleep for
aiolimiter.AsyncLimiter[code: github/rate_limiter.py:773] andAsyncRetrying; - the stdlib fallback for direct
time.sleep[code: github/rate_limiter.py:1004, :1821].
Two of these targets are going away. refactor(github): the github session owns transport, ledger, error classes and link pagination #983 deletes
run_gh_async[code: github/rate_limiter.py:1976], the only user ofAsyncLimiter, and fix(github): gh calls no longer stall silently for up to a minute behind a fixed 60-call window, and the unmaintainedratelimitpackage is removed #1118 removesratelimitand_BURST_LIMIT_DECORATOR. So refactor(cli): tests control time: time-machine fakes wall-clock reads, and retry and rate-limit waits return at once and are recorded #1320 adds noAsyncLimiterseam, and it moves the burst limit to construction time only if fix(github): gh calls no longer stall silently for up to a minute behind a fixed 60-call window, and the unmaintainedratelimitpackage is removed #1118 has not landed first. - tenacity
-
Q31. How is this work filed? Decided 2026-10-07: as a feature parent like feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137, with conventional-commit titles,
type/*,scope/*and priority labels, no milestone and notype/epic. Children carry Parent:, Depends on: and Blocks: lines, and hard orderings are also nativeblocked_bylinks. -
Q32. In what order is the work filed? Decided 2026-10-07, approved and then reaffirmed later the same day: the parent and its children are filed in phases A to F exactly as listed under Acceptance criteria. The standalone fix(ci): the live bubblewrap tests run wherever bwrap is installed and skip only where it is missing #1337, perf(ci): the gate's test workers start at least 15% faster, and the full test run keeps at least half of that saving #1338 and perf(cli): the dashboard's reactive tests run in half today's time and still check every behaviour #1339 are filed with them but are not children.
-
Q33. File the package migrations now or lazily? Decided 2026-10-07: now, all 15 with their seam dependencies. Refinement applies
needs-splitto any that prove too big. -
Q34. Which existing issues change? Decided 2026-10-07. The owner reaffirmed it later the same day, after being shown that a native link keeps a dependent item out of a release when its dependency is outside that release.
- refactor(cli): one process runner owns execution, process groups and dry-run #775, refactor(github): the github session owns transport, ledger, error classes and link pagination #983, refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001 and feat(review): review tools run through one injectable executor in a network-less sandbox with CPU, memory and time limits #772 gain the acceptance line "ships the edge's fake under
tests/support/fakes/and its contract suite", a Parent: line and a native link to test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312. - fix(ci): review workflow tests start the logfire SDK's credential check, which the network guard blocks #965 gains
test_review_stage_flags.py::test_review_cli_stage_flags_propagationas a fifth affected test, with a note that test(cli): the hermetic floor fails a test that reaches an edge without a fake and resets all process-wide state after every test #1310's telemetry-off floor may resolve it. - test(cli): retire the tuple-assert mandate and detect opaque tuple asserts and presence-only tests #851 gains a Parent: line.
- refactor(github): pull request, repository and ssh key calls move from pygithub onto the github session #891 is not amended. The six E children that need it link to it natively from their side.
- refactor(cli): one process runner owns execution, process groups and dry-run #775, refactor(github): the github session owns transport, ledger, error classes and link pagination #983, refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001 and feat(review): review tools run through one injectable executor in a network-less sandbox with CPU, memory and time limits #772 gain the acceptance line "ships the edge's fake under
-
Q35. Priorities? Decided 2026-10-07: fix(ci): the live bubblewrap tests run wherever bwrap is installed and skip only where it is missing #1337 P1, because sandbox regressions go unseen today; perf(ci): the gate's test workers start at least 15% faster, and the full test run keeps at least half of that saving #1338 P2; perf(cli): the dashboard's reactive tests run in half today's time and still check every behaviour #1339 P3. Every child starts at P2, and the roadmap jobs re-rank.
-
Q36. What happens to the drafted
docs/TESTING.mdand ADR 0005? Decided 2026-10-07: they are the core of docs(cli): docs/TESTING.md holds the test conventions, ADR 0005 records that tests double only process edges, and AGENTS.md and the contributor docs point to them #1308, which delivers them. -
Which ADR number? (proposed) feat(review): devops review score scores saved review sessions against a label file offline and reproduces the S11 and loop baselines #1138 plans
docs/adr/0005-review-findings-come-from-tools-not-models.md, the same number. Whichever of docs(cli): docs/TESTING.md holds the test conventions, ADR 0005 records that tests double only process edges, and AGENTS.md and the contributor docs point to them #1308 and feat(review): devops review score scores saved review sessions against a label file offline and reproduces the S11 and loop baselines #1138 merges second takes the next free number and updates its links. -
Who removes the
_getblocks, the async reroute and thePYTEST_CURRENT_TESTpass-through? (proposed)- refactor(cli): one process runner owns execution, process groups and dry-run #775 already plans function-local imports in place of the
_getblocks, and one sync and async implementation. Whichever of refactor(cli): one process runner owns execution, process groups and dry-run #775 and test(cli): devops pr, gh and repos are thin adapters tested over edge fakes, and merge readiness is tested in its package #1324, test(ci): devops ci, test, devcontainer, workspace, install-tools, uv, branches and pipeline are tested over edge fakes, with no lazy patch targets or PYTEST_CURRENT_TEST checks #1325 or test(cli): Use edge fakes and real git; drop test rebind hooks #1333 lands first removes them; the later one confirms they are gone. - The pass-through [code: core/process.py:93] can go only once
commands/ci.pystops reading the variable, so whichever of test(ci): devops ci, test, devcontainer, workspace, install-tools, uv, branches and pipeline are tested over edge fakes, with no lazy patch targets or PYTEST_CURRENT_TEST checks #1325 and test(cli): Use edge fakes and real git; drop test rebind hooks #1333 lands second deletes it.
- refactor(cli): one process runner owns execution, process groups and dry-run #775 already plans function-local imports in place of the
-
Which child owns each module? Under Q19, a command module goes with the E child of its domain package. (proposed) The decided item list leaves the modules below open. Each is now named in one child, and refinement records any later change in the receiving child:
- test(ci): devops ci, test, devcontainer, workspace, install-tools, uv, branches and pipeline are tested over edge fakes, with no lazy patch targets or PYTEST_CURRENT_TEST checks #1325:
commands/pipeline; - test(cli): the infra commands are thin adapters tested over edge fakes, with no internal patches or private imports #1327:
commands/argo,docker,grafana,kustomizeandtls; - test(ai): Wire rag once in ai/rag, test with edge fakes #1329:
commands/rag, and the RAG wiring incommands/ai_ingest; - test(mcp): mcp, agent and tool tests run on edge fakes #1330:
commands/mcp; - test(ai): the remaining ai modules are tested through their public interfaces on edge fakes, and the legacy provider layer leaves src #1331:
commands/benchmark; - test(security): scanner, secret and crypto tests run on the executor, process, http and keyring fakes, and scanners stop looking for mocks #1332:
commands/ssh; - test(cli): Use edge fakes and real git; drop test rebind hooks #1333:
main.py,entry.py,exceptions/,lang/andmodels/; - test(telemetry): telemetry, server, ui, output and docs tests run on edge fakes, and the dashboard suite splits by behaviour #1334:
commands/serve,dashboardandstatus_cmd, anddocs/withcommands/docs; - test(infra): infrastructure tests run on edge fakes #1335:
commands/roadmap.
A module found later with no owner goes to the E child of the domain package it adapts or serves.
- test(ci): devops ci, test, devcontainer, workspace, install-tools, uv, branches and pipeline are tested over edge fakes, with no lazy patch targets or PYTEST_CURRENT_TEST checks #1325:
Strategic alignment
- Milestone: none; a person plans each child on the board. Depends on: none. Blocks: none. The children's hard orderings are listed under Dependencies and linked natively on the children.
- Release epics are retired (ADR 0001): this is a feature parent; its children are the "- [ ]" lines above.
- Owner direction (2026-10-07): tests double only process edges and mirror the source tree (ADR 0005).
- Related:
docs/TESTING.mdand ADR 0005, delivered by docs(cli): docs/TESTING.md holds the test conventions, ADR 0005 records that tests double only process edges, and AGENTS.md and the contributor docs point to them #1308;- refactor(github): pull request, repository and ssh key calls move from pygithub onto the github session #891 (moves the PyGithub calls onto the GitHub session; six children wait for it, and it is not amended);
- fix(github): gh calls no longer stall silently for up to a minute behind a fixed 60-call window, and the unmaintained
ratelimitpackage is removed #1118 (removesratelimitand_BURST_LIMIT_DECORATOR, which makes refactor(cli): tests control time: time-machine fakes wall-clock reads, and retry and rate-limit waits return at once and are recorded #1320's burst-limit change unnecessary if it lands first); - test(cli): whole-tree import-cycle and interface-layer invariants #848 (import-cycle and interface-layer invariants, which join
tests/invariants/) and test(cli): suppression comments may not grow unnoticed #849 (suppression comments may not grow, a ratchet beside test(cli): ratchets hold internal patches, private imports and test accommodations in src at today's counts and name each site that would raise one #1309's); - feat(cli): structured fuzzing of parsers and schema boundaries #416 (structured fuzzing of parsers, Q21);
- feat(ci): fail-to-pass check proves a fix's tests fail on its base (
devops ci fail-to-pass) #844 (fail-to-pass), feat(ci): changed-line coverage on pull requests (diff-cover) #850 (changed-line coverage), feat(ci): shuffled repeat runs of a pull request's changed test files #852 (shuffled repeat runs) and feat(ci): on-demand mutation testing of changed functions (devops ci mutate) #853 (mutation testing), which check the tests this parent reshapes; - fix(ci): review workflow tests start the logfire SDK's credential check, which the network guard blocks #965 (the logfire credential check in review tests, which test(cli): the hermetic floor fails a test that reaches an edge without a fake and resets all process-wide state after every test #1310 may resolve);
- fix(ai): the durable-run store resolves under the data directory, so tests never write .data/durable_runs.db into the checkout #1036 (the durable-run store writes into the checkout; it also fixes the port-forward daemon's state file, beside fix(ci): tests touch no state outside their temporary directories #1311);
- feat(cli): reachable
--dry-runpreviews for delegated commands #412 (reachable--dry-runpreviews; dry-run and the process fake both sit at refactor(cli): one process runner owns execution, process groups and dry-run #775's runner); - refactor(review): the model verifier, the hallucination catalog and the model-claim guards are deleted, and person-recorded verdicts become suppressions #1150 (deletes the review's catalog entry and verifier guard that defend the tuple-assert mandate);
- the standalone fix(ci): the live bubblewrap tests run wherever bwrap is installed and skip only where it is missing #1337 (the bwrap live tests run where bwrap is installed, P1), perf(ci): the gate's test workers start at least 15% faster, and the full test run keeps at least half of that saving #1338 (per-worker collection and import cost) and perf(cli): the dashboard's reactive tests run in half today's time and still check every behaviour #1339 (the cost of
tests/test_ui_reactive.py). They are not children; each names this parent as Related.
- Closed context: fix(ci): devops ci quality gate finishes within five minutes #748 (the gate within five minutes), fix(test): tests never write to the project config, data or tracked files #749 (tests never write project config, data or tracked files), refactor(ci): ci installs nothing on the runner, and live bubblewrap tests skip where bwrap is missing #832 (bwrap tests skip where bwrap is missing; the
if True:arrived with the v0.2.26 squash e70df90), fix(test): the test network guard refuses loopback connects to services the test did not start #837 (the network guard refuses loopback connects to services a test did not start) and feat(cli): tests that cannot fail correctly #421 (tests that cannot fail). - Evidence limits:
- Patch sites are classified as internal or edge by target name, so the split is approximate.
- A file's package is the one it references most; 93 files have under 60% of their references in one package [measured: census], so test(cli): every test file sits in the directory mirroring the package it tests or in tests/invariants/, and the root conftest holds only the hermetic floor #1313 places those by what they test, not by import counts.
- Timing is one run at fca29e9.
- The 26
LLMClient(...)sites counted earlier (and in refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001) include the factory's own call [code: config/settings.py:1244] and a docstring example [code: ai/agents/pipeline.py:8]; 24 are inline constructions.
Alternatives check of 2026-10-29: not-applicable.
Tool: none found.
Proposed design
Problem statement
Tests in devops-cli break when code is refactored without a change in behaviour. A reader cannot find the tests for a package. The parent issue #1307 moves the suite to a design where tests double only process edges through shared fakes and tests/ mirrors src/devops_cli. Twenty-eight of the 34 child issues are merged. Six children stay open: #1314, #1329, #1330, #1333, #1335 and #1336. The parent has no code of its own. It is done when #1336 lands and the exit state holds.
Acceptance criteria
Requirement: No internal patches remain
The test suite SHALL contain zero patches aimed at devops-cli internals and zero imports of private names from devops_cli.
Scenario: Ratchet at zero
- WHEN all open child issues have landed and test(cli): Convert ratchets to bans and merge invariant tests #1336 has turned the ratchets into bans
- THEN the ban test reports 0 internal patches and 0 private imports in tests/
Requirement: No test accommodations in product code
The source tree SHALL contain zero uses of unittest.mock, zero reads of PYTEST_CURRENT_TEST and zero mock-attribute checks.
Scenario: Source ban at zero
- WHEN the open E children have deleted the accommodations in their directories
- THEN the ban test in tests/invariants/test_source_tree.py finds 0 occurrences in src/devops_cli
Requirement: Mirror layout
Every test_*.py file SHALL sit in a directory that mirrors src/devops_cli or in a subject-named file in tests/invariants/.
Scenario: Layout ban
- WHEN test(cli): Convert ratchets to bans and merge invariant tests #1336 has landed
- THEN no test_*.py file exists outside a mirror directory or a subject-named file of tests/invariants/
Requirement: Every fake has a contract suite
Every fake module under tests/support/fakes/ SHALL have a contract suite that runs against the fake and its real implementation.
Scenario: Fake without a contract suite
- WHEN a module under tests/support/fakes/ has no contract suite
- THEN the ban of test(cli): Convert ratchets to bans and merge invariant tests #1336 fails the test run and names the module
Requirement: Coverage gate kept
The change SHALL keep the coverage floor at the value of fail_under in pyproject.toml.
Scenario: Floor after the final child
- WHEN test(cli): Convert ratchets to bans and merge invariant tests #1336 has landed
- THEN fail_under in pyproject.toml is not lower than 85 and the coverage check passes
Existing Tool Considered
The alternatives check of 2026-10-29 found no open, maintained tool that covers this need (not-applicable). The project already uses syrupy 6.1.1 and time-machine 3.5.1, both in the dev group of pyproject.toml. The seams, fakes, contract suites and the mirror layout are project code. The parent adds no code itself. The cost is the work of the six open child issues, each delivered as its own pull request.
Key questions
- How does the parent issue reach Done?: The parent builds no code. The six open children deliver it, and it closes when test(cli): Convert ratchets to bans and merge invariant tests #1336 lands and the exit state holds. The parent depends on those children. (best practice) [sources: AGENTS.md]
- Chosen: Close the parent when test(cli): Convert ratchets to bans and merge invariant tests #1336 lands. test(cli): Convert ratchets to bans and merge invariant tests #1336 depends on all other children, so its landing means the work is complete.
- Rejected: Build the remaining work in one pull request. One item has one pull request. Six open children each need their own change.
- Is the coverage floor 90% or 85%?: The floor is 85% of lines and branches, and a pull request must cover 90% of its changed lines. The criterion follows pyproject.toml. [sources: pyproject.toml, docs/TESTING.md]
Fit
Needs splitting into 6 items:
- refactor(cli): Unify HTTP and DNS seams with shared fakes #1314: one HTTP and DNS seam
- test(ai): Wire rag once in ai/rag, test with edge fakes #1329: ai/rag/ and ai/library/ migration
- test(mcp): mcp, agent and tool tests run on edge fakes #1330: ai/mcp/, agents, harness, tools migration
- test(cli): Use edge fakes and real git; drop test rebind hooks #1333: foundation packages migration
- test(infra): infrastructure tests run on edge fakes #1335: infra packages migration
- test(cli): Convert ratchets to bans and merge invariant tests #1336: ratchets become bans
Suspected block
None.
Dependencies
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNew
- StatusShow more project fieldsNew
Activity
dan-petty-bot commentedon Oct 8, 2026
Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.
It addresses the top two developer pain points (internal coupling and findability) but does not block end users or fix a defect, so it is important but not urgent.It removes 2,770 internal patch sites and reorganises 447 flat test files into a mirror tree, directly improving maintainability and onboarding for every contributor.It spans 447 test files, 175,620 lines, 3,655 patch sites, and is explicitly broken into multiple phases (E, F, etc.) across many child issues.dan-petty commentedon Oct 26, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.
Improving tests helps with maintainability and correctness of the codebase.This change improves test quality, findability, and reduces coupling to internals.Refactoring tests to use shared fakes and mirroring the source tree requires significant effort.tests double only process edges and mirror the source treeas the change that both ask for.Both items ask for tests to double only process edges and mirror the source tree, with no internal patches or private imports.A person closes one of the two if that is so.dan-petty commentedon Oct 26, 2026
Refine cannot set this item to Ready at 48c78ca 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.
test_k8s_manifests.py, and test(ci): devops ci, test, devcontainer, workspace, install-tools, uv, branches and pipeline are tested over edge fakes, with no lazy patch targets or PYTEST_CURRENT_TEST checks #1325 usestest_workflows.py.tmp_ssh_dir,tmp_repos_dir) andverify_test_paths_isolatedgo._github_token,_own_source_dir,_CONSOLE) count toward the ratchet.guard_live_rag_data[code: tests/conftest.py:480], is fixed.devdependency group, so parallel E children do not race onpyproject.tomlanduv.lock.criteria_replay.json,criteria_direction.jsonandreview_findings.json). It also ownstests/test_review_regression_harness.py, which reads the third [code: tests/test_review_regression_harness.py:46].tests/support/builders.pywith the builders the E children use:make_finding,make_verdict,make_itemandmake_candidate, for the CONTEXT.md terms Finding, Verdict, Item and Candidate.markdown_examples.pythere. The E children only adopt the builders.uv run devopsself-invocation), withshutil.whichpart of the process fake; all network (HTTP on any stack, raw sockets, DNS); LLM and embedding providers; the Kubernetes API; the Docker engine; Valkey; Qdrant; the PyGithub REST client; outbound MCP servers; durable backends; OTLP export; keyring and D-Bus.tmp_path; env and config (the floor plus theconfigfixture); git in temporary repos; bwrap in marked live tests; in-process servers (FastAPI TestClient, loopback servers); randomness; host identity; stdin throughCliRunner(input=).GitHubClient's calls onto the session. test(github): github/ is tested through its public interface over the gh process and session fakes, with no internal patches or private imports #1321, test(cli): devops pr, gh and repos are thin adapters tested over edge fakes, and merge readiness is tested in its package #1324, test(ai): devops review, devops analyze and the devops ai commands are thin adapters tested over the model seam and edge fakes #1326, 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(ai): the remaining ai modules are tested through their public interfaces on edge fakes, and the legacy provider layer leaves src #1331 and test(security): scanner, secret and crypto tests run on the executor, process, http and keyring fakes, and scanners stop looking for mocks #1332 wait for refactor(github): pull request, repository and ssh key calls move from pygithub onto the github session #891.LLMClient(...)constructions, refactor(cli): one process runner owns execution, process groups and dry-run #775 the four process-group copies.sleep=;ratelimit.limits(clock=), moved from import time [code: github/rate_limiter.py:64] to construction time;RetryConfigsleep[code: ai/retries/init.py:48-64];aiolimiter.AsyncLimiter[code: github/rate_limiter.py:773] andAsyncRetrying;time.sleep[code: github/rate_limiter.py:1004, :1821].tests/support/fakes/and its contract suite", a Parent: line and a native link to test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312.test_review_stage_flags.py::test_review_cli_stage_flags_propagationas a fifth affected test, with a note that test(cli): the hermetic floor fails a test that reaches an edge without a fake and resets all process-wide state after every test #1310's telemetry-off floor may resolve it.docs/adr/0005-review-findings-come-from-tools-not-models.md, the same number. Whichever of docs(cli): docs/TESTING.md holds the test conventions, ADR 0005 records that tests double only process edges, and AGENTS.md and the contributor docs point to them #1308 and feat(review): devops review score scores saved review sessions against a label file offline and reproduces the S11 and loop baselines #1138 merges second takes the next free number and updates its links._getblocks, the async reroute and thePYTEST_CURRENT_TESTpass-through? (proposed)_getblocks, and one sync and async implementation. Whichever of refactor(cli): one process runner owns execution, process groups and dry-run #775 and test(cli): devops pr, gh and repos are thin adapters tested over edge fakes, and merge readiness is tested in its package #1324, test(ci): devops ci, test, devcontainer, workspace, install-tools, uv, branches and pipeline are tested over edge fakes, with no lazy patch targets or PYTEST_CURRENT_TEST checks #1325 or test(cli): Use edge fakes and real git; drop test rebind hooks #1333 lands first removes them; the later one confirms they are gone.commands/ci.pystops reading the variable, so whichever of test(ci): devops ci, test, devcontainer, workspace, install-tools, uv, branches and pipeline are tested over edge fakes, with no lazy patch targets or PYTEST_CURRENT_TEST checks #1325 and test(cli): Use edge fakes and real git; drop test rebind hooks #1333 lands second deletes it.commands/pipeline;commands/argo,docker,grafana,kustomizeandtls;commands/rag, and the RAG wiring incommands/ai_ingest;commands/mcp;commands/benchmark;commands/ssh;main.py,entry.py,exceptions/,lang/andmodels/;commands/serve,dashboardandstatus_cmd, anddocs/withcommands/docs;commands/roadmap.devops-cli-service commentedon Oct 29, 2026
Alternatives check: not-applicable
Tool: none found
Checked on 2026-10-29. A person decides what this means for the item. The check changes no label and closes no issue.
dan-petty commentedon Oct 30, 2026
Issue #1307 cannot be built as written in one pull request. It is a feature parent issue that has 34 child issues across six phases. Several child issues are already merged, and 19 child issues remain open. Delivery occurs through the individual child issues.
devops-cli-service commentedon Oct 31, 2026
The proposal at 8234a83 needs splitting into 6 items. A person splits the item into the items below, or replies in a comment or edits the body to keep one item, and the next refine round looks at the item again.
refactor(roadmap): the in-memory store leaves src (#3839)
refactor(ai): remove the agent test switches and test models (#4017)
test(ai): library and rag tests run on edge fakes (#4030)
dan-petty commentedon Nov 9, 2026
Issue #1307 cannot be built as written in one pull request. It is a feature parent issue that has 34 child issues across six phases (#1308 through #1336). Twenty-eight child issues are merged and closed. Six child issues (#1314, #1329, #1330, #1333, #1335, #1336) stay open. Rule 1 requires one issue and one pull request. Delivery occurs through the individual child issues.
devops-cli-service commentedon Nov 9, 2026
The proposal at d37762b needs splitting into 6 items. A person splits the item into the items below, or replies in a comment or edits the body to keep one item, and the next refine round looks at the item again.
dan-petty commentedon Nov 10, 2026
All child issues of #1307 are delivered. The final child issue #1336 landed in pull request #4294.
The invariant test suite in
tests/invariants/enforces the exit criteria with hard bans:devops_cliinternals.devops_cliintests/.src/devops_cli/.src/devops_cli/or reside intests/invariants/.tests/support/fakes/has a contract suite.This parent issue has no code of its own and is now complete.