Skip to content

test(ansible): the check-mode query guard trusts a self-declared verify-after-install marker, and the marker+check_mode:false rejection has no fixture #19883

Closed

Description

@mrveiss

Found in the review of PR #19814 (#19663) at head 024ffbd. Neither finding blocks the PR.

  • repo_tests/_ansible_query_tasks.py is_verify_after_install accepts any task that carries when: not ansible_check_mode. A probe whose registered result a later task reads could be marked that way, and the guard would accept it, so under --check the reader would see a skipped result.

  • The guard rejects a task that carries both the marker and check_mode: false (is_check_safe), but no fixture pins that rejection.

  • The guard fails when a task carrying the marker registers a name that another task reads without | default(...) or is defined.

  • A fixture pins that the marker plus check_mode: false plus changed_when: false is rejected.

  • Both are covered by a contrast case that passes.

Activity

  1. added
    bugSomething isn't working
    phase:M1.4Wizard and SLM: choose a mode, apply it, default models work
    on Oct 28, 2026
  2. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    Correction to this issue's wording, from the review of #20433: is defined on the bare registered name is not a guard. Under --check a skipped task registers {"skipped": true}, so v is defined is true and v is defined and v.rc == 0 still fails. A real --check run printed v is defined true, v.rc is defined false, v is skipped true. The guard accepts | default(...), v is [not] skipped, v.skipped is not defined and v.<attr> is [not] defined.

  3. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    Landed through the merge train (PR #20458) as #20433, main 0dbb02f. Each symbol below was confirmed on main.

    AC Evidence
    Guard fails when a marked task's result is read unguarded repo_tests/_ansible_query_tasks.py::marked_verify_read_unguarded, run on the tree by test_no_marked_verify_has_a_reader_that_breaks_under_check. Differs from the wording: bare is defined is not accepted as a guard, because a skipped task's result is defined; see the correction above.
    Marker plus check_mode: false plus changed_when: false is rejected ::test_the_marker_with_check_mode_off_is_rejected
    Both covered by a passing contrast ::test_contrast_the_marker_alone_passes and the accepted cases in test_a_marked_verify_may_not_decide_a_later_task

    Readers in other files of a role are not seen.

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

    bugSomething isn't workingphase:M1.4Wizard and SLM: choose a mode, apply it, default models worktesting

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions