Skip to content

fix(infra): a plan shows a skip by a check-mode when as unchecked #5435

Closed

Description

@dan-petty

Problem or Motivation

devops infra plan shows a skip by a false when as "no change" and every other skip as unchecked (_is_check_mode_skip and _is_skipped_item in src/devops_cli/infra/plan.py). Some tasks cannot run in check mode while the change of an earlier task is still to come. For example, apt cannot find a package in a source that check mode did not add. A role skips such a task with a when that names ansible_check_mode, for example when: not (ansible_check_mode and repo is changed). The skip result has the key false_condition, so the plan shows the task neither as changed nor as unchecked.

devops infra apply then runs the playbook. The task changes in the real run, and guard 7 (unplanned_changes in src/devops_cli/infra/apply.py) finds a change that is not in the plan. The apply stops after the run changed the host. On a disruptive host, the drained node stays cordoned. An agent at level safe can also apply such a plan, because the plan shows no unchecked task. The gVisor play of the infra repository (the install of runsc from a new apt source) has this problem on its first apply and on each change of the pin.

Proposed Solution

  1. In _is_check_mode_skip and _is_skipped_item, count a skip as unchecked when its false_condition names ansible_check_mode. ansible-core puts the first false item of the when list into false_condition (Task._resolve_conditional_with_item in ansible-core 2.22.0). So a role can put the condition of the work first in a when list, and a skip with nothing to do does not name check mode.
  2. Record a check-mode run of the pinned ansible-runner on a new play of the probe in tests/fixtures/infra/runner_events/probe/: one task skipped by when: not ansible_check_mode, one loop with items that the same when skips, and one task with a when list whose first false item does not name check mode. Pin the result in tests/infra/test_plan.py.
  3. Update the module docstring of plan.py and the infra page of the docs with the rule.

Acceptance Criteria

  • In the recorded run, the task and the loop that when: not ansible_check_mode skips are unchecked.
  • The task whose first false when item does not name ansible_check_mode is not unchecked.
  • The tests of tests/infra/ pass, and the docs name the rule.

Existing Tool Considered

ansible-core already writes the false condition into each skip result. The change reads that field. It adds no tool and builds no parser.

Source: #5120

Activity

  1. added
    source/agent
    on Nov 13, 2026
  2. added
    type/bug
    scope/infra
    status/new
    value/medium
    effort/medium
    on Nov 13, 2026
  3. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 13, 2026
  5. removed
    status/in-review
    on Nov 13, 2026
  6. devops-cli-service commented on Nov 13, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-13 18:17 UTC

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/p2-mediumscope/infrasource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions