Skip to content

test(telemetry): telemetry, server, ui, output and docs tests run on edge fakes, and the dashboard suite splits by behaviour #1334

Closed

Description

@dan-petty

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.

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.py adds 5 sites, one of them internal (the tracer's _send_payload [code: tests/test_otel_command_coverage.py:30]), and 2 private imports from main.

    • Dashboard data access: KubernetesService 4, the dashboard's private _get_k8s_client 4 and _get_docker_client 2, ValkeyClient 2, ui.dashboard.pod_log_source 8.
    • Telemetry: the service-status fetchers and new_http_client 7, OTelTelemetryClient._send_payload_sync and test_connection 6.
    • Processes and keyring: run_subprocess 8, the keyring reader config.settings._keyring_get 4.
    • The memory profiler's CLI tests patch commands.test_cmd.run_memory_profiler 7 times.
    • At the edges: logfire SDK functions 13, subprocess.Popen 6.
  • Telemetry export is private.

    • Tests across the suite replace _send_payload and _send_payload_sync [code: telemetry/tracer.py:1232, :1216], 24 times in 10 files for _send_payload alone [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 with socket.getaddrinfo directly [code: telemetry/waterfall.py:142].
    • An atexit hook shuts the tracer down after teardown [code: telemetry/tracer.py:1479].
    • forbid_requests patches the private tracer._resolve_telemetry_settings [code: tests/cluster_secret_fakes.py:231].
  • 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 a ValkeyClient [code: ui/data_providers.py:642].

  • Logic in commands (Q19). devops telemetry profile does two things in the command module [code: commands/telemetry.py:331, :353, :367]:

    • it runs the profiled command;
    • it polls Jaeger with time.sleep until a trace stops growing.

    devops serve checks 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.py renders panels from ui/data_providers, and commands/status_cmd.py renders telemetry/service_status results.

  • Shape.

    • test_ui_reactive.py is 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.asyncio markers, and test_ui_dashboard.py 2.
    • test_output.py is 1,106 lines with test_output_formatter_extended_coverage [code: tests/test_output.py:565].
    • More catch-alls: test_tracer_helpers_and_shutdown [code: tests/test_telemetry.py:331] and test_telemetry_payload_and_shutdown_error_branches [code: tests/test_telemetry.py:480].
    • server/service.py takes a clock= parameter [code: server/service.py:70, :232, :406] but reads time.time() beside it [code: server/service.py:157].

Acceptance criteria

Doubles only at edges

Accommodations (Q27)

  • forbid_requests no longer patches tracer internals.

Logic out of commands/ (Q19)

  • The profiled run and Jaeger trace polling move into telemetry/ behind public functions, next to query_jaeger_trace, and are tested there.
  • The service-mode configuration check (_validate_service_mode) moves into server/ behind a public function that returns the parsed webhook secrets or raises, and is tested there.
  • The CLI tests of devops dashboard, devops serve and devops status check 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 of devops telemetry profile then do the same.

Behaviour files and names

Ratchets and coverage

Key questions

Strategic alignment

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

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

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#1313, #1314, #1315, #1316, #1317, #1318, #1319

Activity

  1. added
    type/test
    scope/cli
    scope/telemetry
    priority/p2-medium
    on Oct 7, 2026
  2. 3 remaining items

  3. dan-petty commented on Oct 26, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.

    • Priority: P1-High. The candidate is part of a major refactoring effort with high impact on test reliability and maintainability.
    • Value: High. This change improves test isolation and reduces coupling to internal implementation details, which benefits the project's long-term health.
    • Effort: High. The change requires significant refactoring of many test files to use edge fakes and remove internal patches.
    • Possible duplicate: test(cli): tests double only process edges and mirror the source tree #1307, which may ask for the same change. The model names telemetry, server, ui, output and docs tests run on edge fakes as 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.
  4. dan-petty commented on Oct 27, 2026

    @dan-petty
    OwnerAuthor

    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.

  5. added
    priority/p1-high
    status/new
    effort/high
    value/high
    and removed
    priority/p2-medium
    on Oct 28, 2026
  6. added
    status/in-progress
    and removed
    status/new
    on Oct 31, 2026
  7. added a commit that references this issue on Oct 31, 2026
    5f4f711
  8. removed
    status/in-progress
    on Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/highpriority/p1-highscope/cliscope/telemetrytype/testvalue/high

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions