Skip to content

test(cli): cloudflare, valkey and other command tests patch no names #4088

Closed

Description

@dan-petty

Problem or Motivation

Issue #3769 asks that no command test patches a name inside devops_cli. It splits the work by command group. This item is group 4: the Cloudflare and Valkey command tests, and every command test under tests/commands that groups 1 to 3 do not cover (the k8s, pr, gh, repos, ci and test_selection tests).

Measured at origin/main 74ba76b (2026-11-07), group 4 holds 328 string patches of a devops_cli name in 30 test files. The largest files are test_devcontainer.py (45), test_cloudflare_commands.py (36), test_analyze.py (28), test_valkey.py (27) and test_tf.py (25).

Each of these patches doubles code inside the process (commands.cloudflare.load_settings, commands.cloudflare._resolve_client, commands.valkey._resolve_client) instead of the edge that the command reaches. Issue #1336 turns the ratchets into bans and fails on these patches.

Proposed Solution & Architectural Design

Replace each patch with a double of the edge that the command reaches:

  • Settings come from the config fixture, not from a patch of load_settings.
  • The Cloudflare API is faked at the HTTP edge with the web fixture, with the token in the keyring fake.
  • Valkey is faked with the in-memory server of tests/support/fakes/valkey.py, or with a loopback listener that records the commands.
  • Programs are faked with process_fake.

Commands are tested through the cli fixture. A test keeps its name and the behavior it checks. This item takes the largest coherent files first (Cloudflare and Valkey) and then the next biggest files that fit one reviewable pull request.

Acceptance criteria

  • The files that the pull request migrates hold no string patch of a devops_cli name.
  • Each migrated test keeps its node id, and the collected ids of the migrated files match before and after.
  • A product mutation in a scratch copy makes the migrated tests fail.
  • The pull request states the count of string patches of the group before and after, and lists each patch that stays with its reason.

Existing tool considered

No new tool is needed. pytest with the fakes of tests/support/fakes/ (HTTP, process, Valkey, keyring), the config fixture and the cli fixture cover the need. All of them exist.

Related

Related: #3769

Activity

  1. added
    source/agent
    type/test
    scope/cli
    status/new
    value/medium
    effort/high
    on Nov 7, 2026
  2. dan-petty commented on Nov 7, 2026

    @dan-petty
    OwnerAuthor

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

    • Type: type/test. The test prefix of the title gives the type.
    • Scope: scope/cli. The (cli) scope of the title gives the scope.
    • Priority: P2-Medium. This is a test refactoring task that improves maintainability but does not block a release or fix a user-facing defect.
    • Value: Medium. It removes 328 fragile internal patches across 30 files, making the test suite more robust and easier to maintain.
    • Effort: High. Migrating 328 patch sites across 30 test files with new edge fakes for Cloudflare, Valkey, and other commands is substantial work.
    • Related: test(cli): command tests patch no devops_cli names #3769, which asks for a different change. Both target removing devops_cli name patches from command tests, but #3769 is the umbrella for all groups while this candidate covers only group 4 (Cloudflare, Valkey, and remaining files).
  3. added
    priority/p2-medium
    on Nov 7, 2026
  4. added
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 8, 2026
  5. removed
    status/in-review
    on Nov 8, 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/p2-mediumscope/clisource/agenttype/testvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions