Repository navigation
Closed
Labels
effort/mediumEffort Mediumpriority/p1-highPriority P1: high-impact work for the next planned milestonescope/cliCore CLI framework, Typer subcommands, options, and tablesscope/configSettings, OS Keyring, environment variables, and defaultsscope/infraDocker container images, DevContainers, and infrastructure toolingtype/testType test: a new or changed testvalue/highValue High: the delivery of the item matters much
Description
Problem
Counts come from one AST pass over tests/test_*.py at 5c45b1e, the head of release/v0.2.28, and [code: …] lines are at the same commit. A file belongs to the package it references most, as in the census.
- Files (17; 5,057 lines, 257 tests [measured: AST pass at 5c45b1e]).
- For the modules this item names:
test_cloudflare_commands,test_config_audit_keys,test_config_cmd,test_config_commands,test_prometheus,test_scan,test_telemetry_cmd,test_telemetry_profile,test_tf,test_tf_notify_plan,test_valkey,test_vault_cmd. - Five more cover infra command modules that no other item names:
test_argo,test_docker,test_grafana,test_kustomize,test_tls_cmd. devops sandboxis tested intest_sandbox_lifecycle.py,test_sandbox_logs.pyandtest_sandbox_metrics.py, which referencesandbox/most, so they go to the item owning the directory 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 them in (test(infra): infrastructure tests run on edge fakes #1335 fortests/sandbox/).test_workload_sandbox.pytestsdocker/sandbox.py, and test(infra): infrastructure tests run on edge fakes #1335 names it.
- For the modules this item names:
- Coupling. These files hold 185 internal patch sites (15 files) and 18 private imports (10 files) [measured]. One invariant test adds a private import of
commands.config._detect_keyring_secret_leaks[code: tests/test_zero_plaintext_invariants.py:7].- Most-patched internals:
load_settings37 (cloudflare 18, config 7, prometheus 6, argo 3, grafana 3);commands.valkey._resolve_client20;tf._resolve_tf_binary15;cloudflare._resolve_client14;telemetry.query_jaeger_trace8;vault.VaultSecretBroker8;tf.is_dry_run7, patched where tests could pass--dry-run;telemetry.get_tracer4. test_telemetry_cmd.pypatches the tracer's private_send_payloadand itstest_connection[code: tests/test_telemetry_cmd.py:41-43, :54-56].- Edge patches, 55 sites: httpx2 17,
subprocess.run13, keyring 10,shutil.which6,typer.promptandtyper.confirm4,socket.getaddrinfo3,docker.from_env1,time.sleep1. test_valkey.pyfakes the RESP socket in its own helper (:127), and all 17 files build a module-levelrunner = CliRunner().
- Most-patched internals:
- Edges outside a seam.
- 15 inline httpx2 clients:
commands/argo.py:203,:256,:285;commands/grafana.py:106,:158,:219,:334,:452,:492,:529;commands/prometheus.py:144,:198,:280,:334,:376.
commands/config.pyimports thekeyringlibrary [code: commands/config.py:530] and the privateconfig.settings._keyring_has[code: commands/config.py:22, :533].ValkeyClientis built inside_resolve_client[code: commands/valkey.py:36, :47], andcommands/ai_ingest.py:224imports that function privately.- Waits use
time.sleep[code: commands/telemetry.py:279, :367; commands/argo.py:129].
- 15 inline httpx2 clients:
- Logic living in commands/ (Q19).
- This item moves:
- Terraform binary and directory resolution [code: commands/tf.py:51-85];
- secret-leak detection [code: commands/config.py:468, :494];
- Cloudflare Access bypass-IP resolution [code: commands/cloudflare.py:691];
- Vault path validation [code: commands/vault.py:44].
- Other items move the rest:
- test(infra): infrastructure tests run on edge fakes #1335: the PromQL client [code: commands/prometheus.py:41-105] and its five inline clients; Cloudflare client resolution and DNS record matching [code: commands/cloudflare.py:50, :340-409]; the Grafana API calls [code: commands/grafana.py:237, :259, :289]; Argo workflow waiting [code: commands/argo.py:114] and the three Argo CD clients; Valkey client resolution [code: commands/valkey.py:36];
- test(security): scanner, secret and crypto tests run on the executor, process, http and keyring fakes, and scanners stop looking for mocks #1332: the scan gate [code: commands/scan.py:797-840];
- test(telemetry): telemetry, server, ui, output and docs tests run on edge fakes, and the dashboard suite splits by behaviour #1334: the profiled run and Jaeger trace polling [code: commands/telemetry.py:331, :353].
- This item moves:
- Names.
- Catch-alls:
test_prometheus.py:126,test_valkey.py:742,test_docker.py:171,test_config_commands.py:211. - 33 test names end in
_success,_failure,_basicor_command.
- Catch-alls:
Acceptance criteria
- No internal patches or private imports. The test files this item owns under
tests/commands/have zero patch sites aimed at devops_cli internals and zero private imports. So do the tests it adds elsewhere, and so doestest_zero_plaintext_invariants.py. 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 two ceilings drop by the counts these files carry when the item starts (185 and 19 at 5c45b1e). - Edges only through seams.
- Processes (terraform, kustomize, kubectl) through refactor(cli): one process runner owns execution, process groups and dry-run #775's process fake; scanners through feat(review): review tools run through one injectable executor in a network-less sandbox with CPU, memory and time limits #772's executor fake with recorded tool output.
- HTTP and DNS through refactor(cli): Unify HTTP and DNS seams with shared fakes #1314: the seven Grafana clients are routed through it, and test(infra): infrastructure tests run on edge fakes #1335 routes the Argo and Prometheus clients it moves.
- The Kubernetes API through refactor(k8s): KubernetesService is the Kubernetes API seam, with a shared fake cluster and its contract suite #1315, the Docker engine through refactor(infra): DockerEngineService is the Docker engine seam, with a shared in-memory engine fake and its contract suite #1316 and Valkey through refactor(ai): Valkey, Qdrant and the embedder each have one seam, with shared fakes and contract suites #1317.
- The keyring through refactor(security): one keyring seam owns the keyring and the Secret Service lock check, with a shared keyring fake and its contract suite #1318;
commands/config.pyimports neitherkeyringnor_keyring_has. - The tracer's export through refactor(telemetry): OTLP export goes through one exporter seam, and tests read exported spans and metrics from a shared fake #1319's OTLP fake, so no test patches an
OTelTelemetryClientmethod; waits through refactor(cli): tests control time: time-machine fakes wall-clock reads, and retry and rate-limit waits return at once and are recorded #1320. - Settings through 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
configfixture, dry runs through--dry-runand prompts throughCliRunnerinput. - No test patches httpx2,
subprocess,keyringortyperprompts.
- No interim markers. If 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 added its interim
unreachable(...)marker, none remains in this item's test files: each gives way to the fake of the edge it names, in the fake's refusing state where the test relies on the refusal. - Logic moves out of commands/ (Q19).
- The four pieces this item moves go behind public functions in
tf/,config/,cloudflare/andsecurity/, and are tested there;test_zero_plaintext_invariants.pyimports the public leak check. - The commands become thin adapters over these and over the functions test(security): scanner, secret and crypto tests run on the executor, process, http and keyring fakes, and scanners stop looking for mocks #1332, test(telemetry): telemetry, server, ui, output and docs tests run on edge fakes, and the dashboard suite splits by behaviour #1334 and test(infra): infrastructure tests run on edge fakes #1335 move.
- A move too big for this item gets its own item. Until then its logic is tested through the CLI with edge fakes.
- The four pieces this item moves go behind public functions in
- CLI tests.
- CLI tests use the shared
clifixture in place of the 17 module-level runners, and check only parsing, wiring, output and exit codes (Q14). - Command output (tables, plan summaries, dry-run previews) is compared as syrupy snapshots (Q18; 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).
- Assertions compare whole values (Q7).
- CLI tests use the shared
- Names. Test names state behaviour (Q8), and the catch-alls are dissolved into behaviour tests.
- Dead code. Every line that no public behaviour reaches is deleted (Q22), and the 90% coverage gate passes.
-
uv run devops cipasses.
Key questions
- Which files belong to this item? Decided 2026-10-07: under Q17, each file goes to the package that owns most of what it tests, and 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 it in that package's mirror directory. This item owns exactly the files named above;
tests/commands/is shared, and each file in it belongs to the one E item that names it. (proposed) The infra commands no other item names also join here:argo,docker,grafana,kustomizeandtls. test(cli): tests double only process edges and mirror the source tree #1307's default would sendargo,dockerandgrafanato test(infra): infrastructure tests run on edge fakes #1335, but their test files are command tests, and test(infra): infrastructure tests run on edge fakes #1335 names none of them. - Which fake do the
devops scantests use? (proposed) feat(review): review tools run through one injectable executor in a network-less sandbox with CPU, memory and time limits #772's executor fake with recorded tool output, the one test(security): scanner, secret and crypto tests run on the executor, process, http and keyring fakes, and scanners stop looking for mocks #1332's scanner tests use: one seam per edge (Q24). - Order against test(security): scanner, secret and crypto tests run on the executor, process, http and keyring fakes, and scanners stop looking for mocks #1332, test(telemetry): telemetry, server, ui, output and docs tests run on edge fakes, and the dashboard suite splits by behaviour #1334 and test(infra): infrastructure tests run on edge fakes #1335? (proposed) They first where possible: they move the scan gate, the telemetry profile and the Argo, Prometheus, Cloudflare, Grafana and Valkey code these commands call, and route its clients through the seams. This is an ordering, not a native link.
- Is this one pull request? Decided 2026-10-07: under Q33, it is filed now as one item, and refinement applies
needs-splitif it proves too big.
Strategic alignment
- Depends on: 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, feat(review): review tools run through one injectable executor in a network-less sandbox with CPU, memory and time limits #772, refactor(cli): one process runner owns execution, process groups and dry-run #775, 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. Blocks: test(cli): Convert ratchets to bans and merge invariant tests #1336. Related: 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 (the ratchets this item lowers), test(k8s): devops k8s commands are thin adapters tested over edge fakes, and the _K8sModule patch forwarding is gone #1323 (tests the vault path check today), test(ai): devops review, devops analyze and the devops ai commands are thin adapters tested over the model seam and edge fakes #1326 (
ai_ingest), test(security): scanner, secret and crypto tests run on the executor, process, http and keyring fakes, and scanners stop looking for mocks #1332 (moves the scan gate; scanner tests), test(telemetry): telemetry, server, ui, output and docs tests run on edge fakes, and the dashboard suite splits by behaviour #1334 (moves the telemetry profile), test(infra): infrastructure tests run on edge fakes #1335 (moves the Argo, Prometheus, Cloudflare, Grafana and Valkey logic; owns thedevops sandboxtest files). - Parent: test(cli): tests double only process edges and mirror the source tree #1307 (phase E).
Proposed design
Problem statement
The infra command tests patch internal functions and import private modules. This makes tests fragile and hard to maintain.
Acceptance criteria
- Criterion 1: Test files under tests/commands/ have zero internal patch sites or private imports.
Verification: Run the test suite with no patch sites or private imports in the test files owned by this item. - Criterion 2: All edges go through seams using fake implementations.
Verification: Verify that all HTTP, DNS, process, keyring and other external calls are faked through designated seam items. - Criterion 3: Logic moves out of commands/ directory to public functions.
Verification: Check that Terraform resolution, secret-leak detection, Cloudflare bypass-IP resolution, and Vault path validation move to public functions in tf/, config/, cloudflare/, and security/ directories. - Criterion 4: CLI tests use shared cli fixture and syrupy snapshots for output.
Verification: Confirm that CLI tests use the shared cli fixture and assert on full values using syrupy snapshots.
Key questions
- Which fake do the devops scan tests use?: The executor fake with recorded tool output, the one used by test(security): scanner, secret and crypto tests run on the executor, process, http and keyring fakes, and scanners stop looking for mocks #1332's scanner tests. (proposed)
- Order against test(security): scanner, secret and crypto tests run on the executor, process, http and keyring fakes, and scanners stop looking for mocks #1332, test(telemetry): telemetry, server, ui, output and docs tests run on edge fakes, and the dashboard suite splits by behaviour #1334 and test(infra): infrastructure tests run on edge fakes #1335?: They first where possible: they move the scan gate, telemetry profile and Argo, Prometheus, Cloudflare, Grafana and Valkey code these commands call. (proposed)
- Is this one pull request?: Yes, it is filed as one item for now. A split happens if it proves too big. (proposed)
Open questions
- Which files belong to this item? (missing verified source)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
#1313, #1314, #1315, #1316, #1317, #1318, #1319
Alternatives check of 2026-10-30: not-applicable.
Tool: none found.
Metadata
Metadata
Assignees
Labels
effort/mediumEffort Mediumpriority/p1-highPriority P1: high-impact work for the next planned milestonescope/cliCore CLI framework, Typer subcommands, options, and tablesscope/configSettings, OS Keyring, environment variables, and defaultsscope/infraDocker container images, DevContainers, and infrastructure toolingtype/testType test: a new or changed testvalue/highValue High: the delivery of the item matters much
Type
Projects
- StatusShow more project fieldsNew
- StatusShow more project fieldsNew
Activity
5 remaining items
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.
This change improves the quality and maintainability of infrastructure command tests.Improving test quality impacts all users by increasing reliability and reducing bugs.Requires moderate effort to refactor tests and remove internal patches and private imports.infra commands are thin adapters tested over edge fakes, with no internal patches or private importsas the change that both ask for.The candidate and item #1335 both ask for the same change of infra commands being thin adapters tested over edge fakes with no internal patches or private imports.A person closes one of the two if that is so.dan-petty commentedon Oct 27, 2026
Refine cannot set this item to Ready at 518db63 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.
refactor(docker): DockerEngineService is the Docker engine seam, with…
refactor(security): one keyring seam owns the keyring and the Secret …
devops-cli-service commentedon Oct 30, 2026
Alternatives check: not-applicable
Tool: none found
Checked on 2026-10-30. A person decides what this means for the item. The check changes no label and closes no issue.
dan-petty commentedon Nov 29, 2026
Plan PR
#2872merged and closed this issue on2026-10-31before any implementation task ran. All implementation and verification groups inopenspec/changes/1327-infra-commands-edge-fakes/tasks.mdstayed open (0of5task groups completed,0of29checkboxes ticked):src/devops_cli/commands/tf.py(which still holds_resolve_tf_binary), secret-leak checks fromsrc/devops_cli/commands/config.py, and Cloudflare bypass-IP and Vault path helpers into domain packages.test_config_cmd.py,test_config_commands.py,test_config_audit_keys.py, andtest_vault_cmd.pyontocliand edge fakes with zero internal monkeypatches.test_tf.py,test_tf_notify_plan.py,test_kustomize.py, andtest_docker.pyontoprocess_fake,--dry-run, and edge fakes.test_telemetry_cmd.py,test_telemetry_profile.py,test_prometheus.py, andtest_grafana.pyonto OTLP and HTTP edge fakes.test_cloudflare_commands.py,test_argo.py,test_valkey.py,test_tls_cmd.py, andtest_scan.pyonto edge fakes.Where this work is now: Open Phase E tracker
#1335covers this migration across infrastructure packages andcommands/(specifically proposed children 4, 5, and 6 coveringsandbox,docker,tf,watchers,argo,cloudflare,prometheus, andgrafana). As part of#7356, the stale folderopenspec/changes/1327-infra-commands-edge-fakes/was removed.chore(roadmap): settle the change folders of 5 closed items (#7813)