Skip to content

test(cli): test files use public interfaces over the shared fakes - #3804

Merged
dan-petty merged 27 commits into
mainfrom
test/2167-49-test-files-public-seams
Nov 6, 2026
Merged

dan-petty merged 27 commits into
mainfrom
test/2167-49-test-files-public-seams

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

42 test files patched a devops_cli name or imported a private name of devops_cli. ADR 0007 and docs/TESTING.md forbid both: a test doubles only a process edge, through the shared fake of that edge, and reaches private code through its public interface.

Each test now installs a shared fake (process, git, cluster, GitHub, model, scanner, Qdrant, embedder, OTLP, web) and calls the public command or class. Where a pure function was the unit under test, it gets a public name and its callers change. Code that only a patch kept alive is removed: the function get_k8s_client of k8s/volume.py and the alias _HELM_RELEASES_BY_STACK. The change adds and removes no behavior.

The test test_volume_reclaim_confirmation_aborted is deleted: a CliRunner stdin is no terminal, so the prompt cannot be reached.

Closes #2167

Change: openspec/changes/archive/2026-11-06-2167-the-49-test-files-that-no/

@dan-petty dan-petty added type/test Type test: a new or changed test scope/cli Core CLI framework, Typer subcommands, options, and tables labels Nov 6, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test and check results

  • Full uv run devops ci on the final code (before the last rebase onto the release commit 0.70.0): 19819 passed, 2 skipped, 2 failed, 1 error, in 9 min 42 s. The failures are test_mark_only_commands_under_global_dry_run and test_the_direct_executor_refuses_a_network_profile_before_it_starts_the_tool[direct] (with its teardown error). Both depend on tools in the shared home volume (the popeye binary). Both also fail on a scratch checkout of origin/main, so this change does not cause them.
  • uv run devops openspec check passes. The pre-push hook passes.
  • Scans over the 42 files: no private import of devops_cli, no patch of a devops_cli name, no MagicMock. The patches that stay patch a stdlib or third-party object (socket.create_connection, time.sleep, subprocess.Popen, logfire.*, shutil.which). The one exception is below.

Names changed by the plan (product code)

  • Removed: get_k8s_client in k8s/volume.py and the alias _HELM_RELEASES_BY_STACK.
  • Renamed to public: the stack catalogs HELM_RELEASES_BY_STACK, MANIFESTS_BY_STACK, POST_HELM_BY_STACK; the git output parsers; the entry points of the review runner, pipeline and helpers; and a few pure functions of the review, security and CI packages.
  • commands/rag.py, commands/ai_research.py and roadmap/intake_model.py now get their Qdrant client and embedder through the seam.

Tests deleted or replaced

  • Deleted: test_volume_reclaim_confirmation_aborted. It also removes the only test of the prompt-decline path, which a CliRunner cannot reach.
  • Renamed or split, same checks: test_clean_markdown_href_schemes_and_paths is now test_markdown_links_keep_local_paths_and_drop_external_schemes. test_build_user_prompt_formatting is now test_the_prompt_holds_the_task_the_context_the_root_and_the_probe_limit. test_bound_inquiry_result_truncates_probes is now test_the_result_is_cut_to_the_probe_limit. test_ipv6_builders_and_bracketing is split into five tests. test_configure_urls_on_ipv6_cluster_and_fallbacks is split into two.
  • Assertions dropped (no public route): the TCP probe of example.com:8443, the bare http://2001:db8::1:30080 fallback, the port-80 fallback, and the Tempo address with a user name and a query.
  • test_orchestrator_review_feeds_comment_and_metrics_with_and_without_reporting checks the Bandit path only. It no longer feeds a persona finding (qa), because the old test set it with a patch and the model fake has no public route to it. test_summary_only_exits_before_orchestrator_construction proves no model call and no session directory, not that the orchestrator is never built.

Rebase note

Review fixes in this PR

  • The canary run test now asserts the exact canaried tools and that no scanner run holds the canary directory prefix.
  • The analogies JSON test asserts a seeded pattern, so it proves the Qdrant path.
  • ProcessFake.reset() is new. The Hypothesis tests of test_cache_fuzzing.py and test_cleanup_fuzzing.py call it at the start of each example, so no state leaks between examples.
  • The active plans 2469-deploy-stack-dry-run-lists-the and 1323-k8s-commands-edge-fakes name the public catalogs now.

@dan-petty
dan-petty marked this pull request as ready for review November 6, 2026 16:31
@dan-petty
dan-petty merged commit f6286d6 into main Nov 6, 2026
24 checks passed
@dan-petty
dan-petty deleted the test/2167-49-test-files-public-seams branch November 6, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/cli Core CLI framework, Typer subcommands, options, and tables type/test Type test: a new or changed test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(cli): migrate 49 tests to public interfaces

1 participant