Skip to content

test(ci): cover devops ci --force and the cache tree-changed warning #4016

Open

Description

@devops-cli-service

Split from #3885.

Problem: devops ci --force with a matching cache entry has no test, and the warning that _try_save_ci_cache prints when the tree changed during a run has no test. The old test patched _run_all_checks_async. run_subprocess_async starts real child processes unless subprocess.run is patched, so no process fake answers the checks of devops ci (#1333). A probe in a temporary tree started a real uv, and the floor refused it. Why deferred: this part waits on #1333, which removes the async reroute. Acceptance criteria: after #1333, a CLI test of devops ci --force over the process fake and the git fake SHALL show that --force skips a matching cache entry. A CLI test SHALL show that a tree changed during a run prints MESSAGES.ci.cache_tree_changed and leaves the cache file as it was.

Proposed design

Problem statement

No test covers devops ci --force when the cache holds a matching entry. No test covers the warning that _try_save_ci_cache prints when the tree changes during a run. The old test patched _run_all_checks_async. run_subprocess_async starts real child processes unless subprocess.run is patched, so no process fake answers the checks of devops ci (#1333). Issue #1333 removes this async reroute. The two CLI tests then run over the process fake and the git fake.

Acceptance criteria

Requirement: Force skips a matching cache entry

The devops ci --force command SHALL run the checks even when the cache holds an entry that matches the tree.

Scenario: Force with a matching cache entry

  • WHEN A CLI test seeds a matching cache entry over the git fake and runs devops ci --force over the process fake.
  • THEN The process fake records the check commands, which shows that the cache entry did not skip the run.

Requirement: Changed tree prints the warning and keeps the cache

The devops ci command SHALL print MESSAGES.ci.cache_tree_changed and SHALL leave the cache file as it was when the tree changes during a run.

Scenario: Tree changes during the run

  • WHEN A CLI test runs devops ci over the process fake and the git fake, and the fake changes the tree fingerprint while the checks run.
  • THEN The output contains MESSAGES.ci.cache_tree_changed and the cache file has the same content as before the run.

Existing Tool Considered

No check has run. pytest and the project fakes cover the need: tests/support/fakes/process.py answers child processes and tests/support/fakes/git.py answers git. No new tool or library is required. pytest lacks a fake that answers the checks of devops ci until #1333 lands. The change adds two test functions, so the cost is about one short session to write and check them.

Key questions

  • Why do the tests wait on test(cli): Use edge fakes and real git; drop test rebind hooks #1333?: run_subprocess_async starts real child processes and reroutes to the sync path only when subprocess.run is patched. A probe of devops ci --force started a real uv, and the floor refused it. Issue test(cli): Use edge fakes and real git; drop test rebind hooks #1333 removes this reroute, so the fakes can then answer the checks. [sources: src/devops_cli/core/process.py, src/devops_cli/commands/ci.py, openspec/changes/archive/2026-11-07-3746-roadmap-tests-install-store-hook/proposal.md]
  • Which layer do the tests drive?: The tests run the CLI command over the process fake and the git fake. They do not patch _run_all_checks_async or _try_save_ci_cache. (best practice) [sources: openspec/changes/archive/2026-11-08-4087-ci-and-test-selection-command-tests-on-edge-fakes/design.md]
    • Chosen: CLI test over the edge fakes. It checks the behavior that a user sees and follows the project rule to fake only at the edge.
    • Rejected: Patch _run_all_checks_async and _try_save_ci_cache. The earlier design rejected it: it proves that the command calls a function, not that a verdict is kept.
  • How does the test seed a matching cache entry?: The test runs devops ci once over the fakes, so that the real record_passing_run writes the verdict, and then runs devops ci --force. (best practice) [sources: openspec/changes/archive/2026-11-08-4087-ci-and-test-selection-command-tests-on-edge-fakes/design.md]
    • Chosen: Run the gate once over the fakes. The real cache writes the verdict, so the test reads a real matching entry.
    • Rejected: Write the cache file by hand. A hand-written file can differ from the shape that the real cache writes.
  • How does the test change the tree fingerprint during the run?: The process fake answers one check command with a callable that edits a file in the tree, so the fingerprint that the gate reads after the run differs. (best practice) [sources: tests/support/fakes/process.py]
    • Chosen: A process-fake answer edits a file during a check. ProcessAnswer.side_effect takes a callable, so the fake changes the tree with no patch of a devops_cli name.
    • Rejected: Patch compute_workspace_fingerprint. It is a devops_cli name, and the project rule forbids a patch of one.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#1333

Activity

  1. added
    source/agent
    type/test
    scope/ci
    status/new
    value/medium
    effort/medium
    on Nov 7, 2026
  2. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    ContributorAuthor

    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/ci. The (ci) scope of the title gives the scope.
    • Priority: P3-Low. The item adds test coverage and waits on #1333.
    • Value: Medium. The tests protect the --force cache path and the tree-changed warning.
    • Effort: Medium. Two CLI tests need the process fake, the git fake and the #1333 change.
    • Related: test(roadmap): add the seams the serve and ci tests still lack #3885, which asks for a different change. Both add CI test coverage, but #3885 adds missing seams and this item adds two CLI tests.
  3. added
    priority/p3-low
    on Nov 7, 2026
  4. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at 6121d09 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

    The next refine round also looks at the item again when a commit on the default branch changes one of these files: src/devops_cli/core/process.py.

  5. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at 1ca0133. A bot opened the item, so a review of the issue and of the proposal must approve it first. The review found the defects below. A person edits the body to answer them. The next refine round looks at the item again only after a body edit.

    • missing_path at existing_tool: The plan names two fake files. The input files has no entry for them, and no task creates them. Evidence: "pytest and the project fakes cover the need: tests/support/fakes/process.py answers child processes and tests/support/fakes/git.py answers git."
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/mediumpriority/p3-lowscope/cisource/agentstatus/newtype/testvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions