Repository navigation
Description
Problem
Phase E migration of telemetry/, server/, ui/ and output/, of docs/, which renders the CLI and MCP surfaces into documents, and of the thin commands over them: commands/dashboard.py, commands/serve.py and commands/status_cmd.py. This item owns the 27 test files named below, by today's flat names (12,962 lines, 592 tests) [measured: AST pass at 5c45b1e]. #1313 places most of them under those mirror directories; a file named here belongs to this item wherever #1313 places it.
- telemetry:
test_telemetry.py,test_telemetry_{collector_export,deduplication,instruments,logfire,logging_bridge,metrics,semconv}.py,test_trace_propagation.py,test_service_status.py,test_sandbox_traces.py,test_network_security_and_trace_correlation.py,test_memory_profiler.py,test_otel_command_coverage.py. - server:
test_server.py,test_server_{service,stream}.py. - ui:
test_ui_dashboard.py,test_ui_reactive.py.test_k8s_models.pyis 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's. - output:
test_output.py,test_consolidation_table_builder.py,test_streaming_serializer.py. - docs:
test_docs.py,test_docs_{command_resolver,compactor,knowledge_base_argv,mcp_argv_collector}.py.
test_otel_command_coverage.py checks the spans and metrics that commands and processes emit through the tracer. It is a telemetry behaviour test, not an invariant test: its subject is no committed file.
The evidence:
-
Tests patch internals. 96 of the 176 patch sites in the first 26 files target a devops_cli name, in 18 files, and those files import 21 private names [measured: census AST pass, files unchanged at 5c45b1e].
test_otel_command_coverage.pyadds 5 sites, one of them internal (the tracer's_send_payload[code: tests/test_otel_command_coverage.py:30]), and 2 private imports frommain.- Dashboard data access:
KubernetesService4, the dashboard's private_get_k8s_client4 and_get_docker_client2,ValkeyClient2,ui.dashboard.pod_log_source8. - Telemetry: the service-status fetchers and
new_http_client7,OTelTelemetryClient._send_payload_syncandtest_connection6. - Processes and keyring:
run_subprocess8, the keyring readerconfig.settings._keyring_get4. - The memory profiler's CLI tests patch
commands.test_cmd.run_memory_profiler7 times. - At the edges: logfire SDK functions 13,
subprocess.Popen6.
- Dashboard data access:
-
Telemetry export is private.
- Tests across the suite replace
_send_payloadand_send_payload_sync[code: telemetry/tracer.py:1232, :1216], 24 times in 10 files for_send_payloadalone [measured: census]. - The tracer opens a raw socket [code: telemetry/tracer.py:1143] and its own
httpx2.Clients [code: telemetry/tracer.py:1180, :1213]. Waterfall queries open another [code: telemetry/waterfall.py:194] and resolve the Jaeger host withsocket.getaddrinfodirectly [code: telemetry/waterfall.py:142]. - An
atexithook shuts the tracer down after teardown [code: telemetry/tracer.py:1479]. forbid_requestspatches the privatetracer._resolve_telemetry_settings[code: tests/cluster_secret_fakes.py:231].
- Tests across the suite replace
-
The dashboard reaches three edges itself. It has its own kubeconfig loader [code: ui/data_providers.py:146, :163, :165], calls
docker.from_env()[code: ui/data_providers.py:217-221] and builds aValkeyClient[code: ui/data_providers.py:642]. -
Logic in commands (Q19).
devops telemetry profiledoes two things in the command module [code: commands/telemetry.py:331, :353, :367]:- it runs the profiled command;
- it polls Jaeger with
time.sleepuntil a trace stops growing.
devops servechecks the service configuration and parses the webhook secrets in the command [code: commands/serve.py:34]. The other two commands are already thin:commands/dashboard.pyrenders panels fromui/data_providers, andcommands/status_cmd.pyrenderstelemetry/service_statusresults. -
Shape.
test_ui_reactive.pyis 3,463 lines and 198 tests under 25 section headings: "Fixtures" (:87) and 24 behaviour sections from "Dashboard State Store" (:202) to "Help" (:3440). It has 64 redundant@pytest.mark.asynciomarkers, andtest_ui_dashboard.py2.test_output.pyis 1,106 lines withtest_output_formatter_extended_coverage[code: tests/test_output.py:565].- More catch-alls:
test_tracer_helpers_and_shutdown[code: tests/test_telemetry.py:331] andtest_telemetry_payload_and_shutdown_error_branches[code: tests/test_telemetry.py:480]. server/service.pytakes aclock=parameter [code: server/service.py:70, :232, :406] but readstime.time()beside it [code: server/service.py:157].
Acceptance criteria
Doubles only at edges
- No test of this item patches a devops_cli name or imports a private one. Today that is 97 sites and 23 imports.
- Span, metric and log checks read refactor(telemetry): OTLP export goes through one exporter seam, and tests read exported spans and metrics from a shared fake #1319's OTLP fake, opted into per test (Q28). Nothing patches
_send_payload*or logfire functions. - The tracer's socket and HTTP clients and the waterfall client go through refactor(telemetry): OTLP export goes through one exporter seam, and tests read exported spans and metrics from a shared fake #1319's and refactor(cli): Unify HTTP and DNS seams with shared fakes #1314's seams. The waterfall's Jaeger host lookup (
telemetry/waterfall.py:142) resolves through refactor(cli): Unify HTTP and DNS seams with shared fakes #1314's DNS seam, and its tests take DNS answers from refactor(cli): Unify HTTP and DNS seams with shared fakes #1314's DNS fake. - The dashboard gets Kubernetes from refactor(k8s): KubernetesService is the Kubernetes API seam, with a shared fake cluster and its contract suite #1315's seam, Docker from refactor(infra): DockerEngineService is the Docker engine seam, with a shared in-memory engine fake and its contract suite #1316's and Valkey from refactor(ai): Valkey, Qdrant and the embedder each have one seam, with shared fakes and contract suites #1317's. Its own kubeconfig loader goes, and tests use the three fakes.
- Service-status and Prometheus fetches use refactor(cli): Unify HTTP and DNS seams with shared fakes #1314's HTTP fake.
-
kubectland other processes use refactor(cli): one process runner owns execution, process groups and dry-run #775's fake. - Logfire's token comes from refactor(security): one keyring seam owns the keyring and the Secret Service lock check, with a shared keyring fake and its contract suite #1318's keyring fake.
- Polling tests step time with 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 clock.
-
server/service.pykeeps itsclock=parameter, and the wall-clock read at:157goes through it, so service tests pass a clock instead of travelling time.
Accommodations (Q27)
-
forbid_requestsno longer patches tracer internals.
Logic out of commands/ (Q19)
- The profiled run and Jaeger trace polling move into
telemetry/behind public functions, next toquery_jaeger_trace, and are tested there. - The service-mode configuration check (
_validate_service_mode) moves intoserver/behind a public function that returns the parsed webhook secrets or raises, and is tested there. - The CLI tests of
devops dashboard,devops serveanddevops statuscheck only parsing, wiring, output and exit codes (Q14). test(cli): the infra commands are thin adapters tested over edge fakes, with no internal patches or private imports #1327's CLI tests ofdevops telemetry profilethen do the same.
Behaviour files and names
-
test_ui_reactive.pysplits along its 24 behaviour sections into files undertests/ui/(Q10). -
test_ui_dashboard.py,test_output.pyandtest_telemetry.pysplit by behaviour, and the catch-alls dissolve (Q8). -
test_consolidation_table_builder.pyand the cross-packagetest_network_security_and_trace_correlation.pyare renamed after their behaviour or dissolve into owners (Q13). -
test_otel_command_coverage.pydissolves: its span and metric cases become telemetry behaviour tests over refactor(telemetry): OTLP export goes through one exporter seam, and tests read exported spans and metrics from a shared fake #1319's fake, and its check of the command table (test_all_command_specs_registered) becomes a CLI test that every command is listed bydevops --help. - Output whose whole text is the contract is a syrupy snapshot (Q18): the dashboard summary view, formatter tables and generated docs.
-
test_ui_reactive.py's local finding factory gives way tomake_finding, the builder 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 puts intests/support/builders.py(Q20). - The eight module-level
CliRunner()s give way to 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'sclifixture (Q14), and the 66 redundant@pytest.mark.asynciomarkers go.
Ratchets and coverage
- 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 this item's removals, and the PR body states the counts before and after.
- 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 files. A test that relied on the refusal installs the edge's fake in its refusing state. - Unreachable lines are deleted (Q22). Coverage stays at or above 90%.
-
uv run devops cipasses.
Key questions
- Does this item make
test_ui_reactive.pyfaster? Decided 2026-10-07: no. Speed is not part of the design (Q12). perf(cli): the dashboard's reactive tests run in half today's time and still check every behaviour #1339 owns that file's cost; this item splits it by behaviour only. - Which files? Decided 2026-10-07: each file goes to the package owning most of what it tests (Q17). Every test file is named in exactly one child's list, so the list above is this item's share wherever 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 a file.
test_memory_profiler.pyteststelemetry/memory_profiler.pymost, and itsdevops testCLI cases become CLI tests (Q14).test_otel_command_coverage.pyis named here because its subject is the tracer's output. - Is telemetry exported during tests? Decided 2026-10-07: no. Export is off by default, and a test opts in with the OTLP fake (Q28, delivered by 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).
server/service.py'sclock=parameter? Decided 2026-10-07: it stays. Q24 installs a fake through a constructor parameter where domain code already takes one; the bare wall-clock read at:157moves onto it.- Who owns
docs/,commands/dashboard.py,commands/serve.pyandcommands/status_cmd.py? (proposed) This item, next to the packages they render or start. No other item owns them;docs/'s 5 test files hold 12 internal patch sites.
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, 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 (ratchets), 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 (telemetry off, resets, the console's public reset), 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 (
test_k8s_models.py), test(cli): the infra commands are thin adapters tested over edge fakes, with no internal patches or private imports #1327 (telemetry command), test(cli): Use edge fakes and real git; drop test rebind hooks #1333 (main.py), perf(cli): the dashboard's reactive tests run in half today's time and still check every behaviour #1339 (test_ui_reactive.pycost), fix(ci): review workflow tests start the logfire SDK's credential check, which the network guard blocks #965 (logfire credential check), fix(config): service clients use only configured urls and never fall back to an unconfigured localhost default #1165 (no unconfigured service-URL fallbacks). - Parent: test(cli): tests double only process edges and mirror the source tree #1307 (phase E).
- Evidence tags are explained in test(cli): tests double only process edges and mirror the source tree #1307. Here [code: path:line] lines are at 5c45b1e, the release/v0.2.28 head, and the per-item counts were recounted there.
Update 2026-10-08: refinement
tests/test_docs_mcp_argv_collector.py is now tests/test_docs_source_argv_collector.py (#868). telemetry/waterfall.py uses the factory (:127), so its lookup criterion is void. #1381 moves the tracer clients (telemetry/tracer.py:1180, :1213).
Proposed design
Problem statement
Tests for telemetry, server, ui, output and docs packages patch 97 devops_cli internal names and import 23 private names across 27 files (12,962 lines, 592 tests). They must use the project's edge fakes instead. Logic that belongs in telemetry/ and server/ sits in commands/ and must move. Test files must split by behaviour, catch-alls must dissolve, and output contracts must become snapshots.
Acceptance criteria
- Criterion 1: No test in this item patches a devops_cli name or imports a private one.
Verification: Run an AST pass over the 27 test files. Confirm zero patch sites target a devops_cli name and zero imports reference a private name. - Criterion 2: Span, metric and log checks read the OTLP fake from refactor(telemetry): OTLP export goes through one exporter seam, and tests read exported spans and metrics from a shared fake #1319, opted into per test.
Verification: Grep the test files for_send_payload,_send_payload_sync, andlogfire. Confirm none appear. Confirm the OTLP fake fixture is used in telemetry tests. - Criterion 3: The tracer's socket and HTTP clients go through refactor(telemetry): OTLP export goes through one exporter seam, and tests read exported spans and metrics from a shared fake #1319's and refactor(cli): Unify HTTP and DNS seams with shared fakes #1314's seams.
Verification: Inspect telemetry/tracer.py. Confirm the raw socket and httpx2.Client calls are replaced by seam calls. Confirm fix(security): move the remaining HTTP clients onto the egress-checked factory and delete the pre-flight resolve paths #1381's change is present. - Criterion 4: The dashboard gets Kubernetes from refactor(k8s): KubernetesService is the Kubernetes API seam, with a shared fake cluster and its contract suite #1315's seam, Docker from refactor(infra): DockerEngineService is the Docker engine seam, with a shared in-memory engine fake and its contract suite #1316's and Valkey from refactor(ai): Valkey, Qdrant and the embedder each have one seam, with shared fakes and contract suites #1317's.
Verification: Inspect ui/data_providers.py. Confirm _get_k8s_client, docker.from_env and ValkeyClient construction are replaced by seam calls. Confirm the own kubeconfig loader is removed. - Criterion 5: Service-status and Prometheus fetches use refactor(cli): Unify HTTP and DNS seams with shared fakes #1314's HTTP fake.
Verification: Grep telemetry tests for direct HTTP calls. Confirm they use the refactor(cli): Unify HTTP and DNS seams with shared fakes #1314 HTTP fake fixture. - Criterion 6: kubectl and other processes use refactor(cli): one process runner owns execution, process groups and dry-run #775's fake.
Verification: Grep test files forsubprocess.Popenandrun_subprocesspatches. Confirm they use refactor(cli): one process runner owns execution, process groups and dry-run #775's process fake instead. - Criterion 7: Logfire's token comes from refactor(security): one keyring seam owns the keyring and the Secret Service lock check, with a shared keyring fake and its contract suite #1318's keyring fake.
Verification: Grep test files forconfig.settings._keyring_getpatches. Confirm they use refactor(security): one keyring seam owns the keyring and the Secret Service lock check, with a shared keyring fake and its contract suite #1318's keyring fake. - Criterion 8: Polling tests step time with 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 clock.
Verification: Grep test files fortime.sleepandtime.timepatches. Confirm they use 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 clock fake. - Criterion 9: server/service.py keeps its clock= parameter and the wall-clock read at line 157 goes through it.
Verification: Inspect server/service.py. Confirm line 157 calls the clock parameter. Confirm service tests pass a clock object. - Criterion 10: forbid_requests no longer patches tracer internals.
Verification: Inspect tests/cluster_secret_fakes.py. Confirm the patch of tracer._resolve_telemetry_settings is removed. - Criterion 11: The profiled run and Jaeger trace polling move into telemetry/ behind public functions.
Verification: Inspect commands/telemetry.py. Confirm the profiled run and polling logic is removed. Confirm the new public functions exist in telemetry/ and are tested there. - Criterion 12: The service-mode configuration check moves into server/ behind a public function.
Verification: Inspect commands/serve.py. Confirm _validate_service_mode is removed. Confirm the new public function in server/ returns parsed webhook secrets or raises, and is tested there. - Criterion 13: CLI tests of devops dashboard, serve and status check only parsing, wiring, output and exit codes.
Verification: Inspect the CLI test files. Confirm they do not test business logic. Confirm they 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 cli fixture. - Criterion 14: test_ui_reactive.py splits along its 24 behaviour sections into files under tests/ui/.
Verification: List files under tests/ui/. Confirm each of the 24 sections has its own file. Confirm test_ui_reactive.py no longer exists. - Criterion 15: test_ui_dashboard.py, test_output.py and test_telemetry.py split by behaviour and catch-alls dissolve.
Verification: List the new files. Confirm no test is named with 'catch-all', 'extended_coverage', 'helpers_and_shutdown' or 'payload_and_shutdown_error_branches'. - Criterion 16: test_consolidation_table_builder.py and test_network_security_and_trace_correlation.py are renamed or dissolve into owners.
Verification: Confirm the files are renamed after their behaviour or their tests appear in the owning package's test files. - Criterion 17: test_otel_command_coverage.py dissolves into telemetry behaviour tests and a CLI test.
Verification: Confirm the file no longer exists. Confirm span and metric cases appear in telemetry tests over the OTLP fake. Confirm test_all_command_specs_registered appears as a CLI test checking devops --help. - Criterion 18: Output whose whole text is the contract is a syrupy snapshot.
Verification: Confirm the dashboard summary view, formatter tables and generated docs use syrupy snapshots. Confirm the .ambr files exist under tests/snapshots/. - Criterion 19: test_ui_reactive.py's local finding factory gives way to make_finding from tests/support/builders.py.
Verification: Grep the new ui test files for the local finding factory. Confirm it is absent. Confirm make_finding from tests/support/builders.py is used. - Criterion 20: The eight module-level CliRunner()s give way to 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 cli fixture and the 66 redundant asyncio markers go.
Verification: Grep the 27 test files forCliRunner()at module level. Confirm zero. Grep for@pytest.mark.asyncio. Confirm only the necessary ones remain. - Criterion 21: 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 this item's removals.
Verification: Confirm the PR body states the ratchet counts before and after. - Criterion 22: 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 files.
Verification: Grep the 27 test files forunreachable. Confirm zero matches. - Criterion 23: Unreachable lines are deleted and coverage stays at or above 90%.
Verification: Runuv run devops ci. Confirm it passes and the coverage report shows 90% or above.
Key questions
- Does this item make test_ui_reactive.py faster?: No. Speed is not part of the design (Q12). perf(cli): the dashboard's reactive tests run in half today's time and still check every behaviour #1339 owns that file's cost. This item splits it by behaviour only. (proposed)
- Which files belong to this item?: Each file goes to the package owning most of what it tests (Q17). Every test file is named in exactly one child's list. test_memory_profiler.py tests telemetry/memory_profiler.py most. test_otel_command_coverage.py is named here because its subject is the tracer's output. (proposed)
- Is telemetry exported during tests?: No. Export is off by default, and a test opts in with the OTLP fake (Q28, delivered by 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). (proposed)
- Does server/service.py's clock= parameter stay?: It stays. Q24 installs a fake through a constructor parameter where domain code already takes one. The bare wall-clock read at line 157 moves onto it. (proposed)
- Who owns docs/, commands/dashboard.py, commands/serve.py and commands/status_cmd.py?: This item, next to the packages they render or start. No other item owns them. docs/ 5 test files hold 12 internal patch sites. (proposed)
Open questions
- Which files? Decided 2026-10-07: each file goes to the package owning most of what it tests (Q17). Every test file is named in exactly one child's list, so the list above is this item's share wherever 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 a file.
test_memory_profiler.pyteststelemetry/memory_profiler.pymost, and itsdevops testCLI cases become CLI tests (Q14).test_otel_command_coverage.pyis named here because its subject is the tracer's output. server/service.py'sclock=parameter? Decided 2026-10-07: it stays. Q24 installs a fake through a constructor parameter where domain code already takes one; the bare wall-clock read at:157moves onto it.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNew
- StatusShow more project fieldsNew
Activity
3 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.
The candidate is part of a major refactoring effort with high impact on test reliability and maintainability.This change improves test isolation and reduces coupling to internal implementation details, which benefits the project's long-term health.The change requires significant refactoring of many test files to use edge fakes and remove internal patches.telemetry, server, ui, output and docs tests run on edge fakesas the change that both ask for.The candidate and item #1307 both ask for tests to run on edge fakes and mirror the source tree.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 c845583 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_memory_profiler.pyteststelemetry/memory_profiler.pymost, and itsdevops testCLI cases become CLI tests (Q14).test_otel_command_coverage.pyis named here because its subject is the tracer's output.server/service.py'sclock=parameter? Decided 2026-10-07: it stays. Q24 installs a fake through a constructor parameter where domain code already takes one; the bare wall-clock read at:157moves onto it.refactor(k8s): KubernetesService is the Kubernetes API seam, with a s…
refactor(docker): DockerEngineService is the Docker engine seam, with…
test(telemetry): telemetry, server, ui, output and docs tests on edge…