Skip to content

fix: attribute idempotence failures to handlers correctly#4626

Open
psimaker wants to merge 1 commit intoansible:mainfrom
psimaker:fix/idempotence-handler-attribution
Open

fix: attribute idempotence failures to handlers correctly#4626
psimaker wants to merge 1 commit intoansible:mainfrom
psimaker:fix/idempotence-handler-attribution

Conversation

@psimaker
Copy link
Copy Markdown

@psimaker psimaker commented Apr 5, 2026

Summary

Fix idempotence test failure attribution for Ansible handlers.

When a handler is not idempotent, _non_idempotent_tasks() incorrectly
reports the calling task name instead of the handler name. This happens
because the parser only matches TASK prefixes in Ansible output, but
handlers appear as RUNNING HANDLER [name].

  • Add "RUNNING HANDLER" to the prefix match in _non_idempotent_tasks()
  • Add unit test verifying correct handler attribution

Fixes #4414

Test plan

  • Existing unit tests pass (8/8)
  • New test test_non_idempotent_tasks_handler validates the fix
  • Ruff lint passes with no warnings

When a handler is not idempotent, molecule incorrectly reports the
calling task instead of the handler name. This happens because
non_idempotent_tasks() only matches lines starting with "TASK"
but ignores "RUNNING HANDLER" lines from Ansible output.

Add "RUNNING HANDLER" prefix matching so handlers are correctly
identified in idempotence failure reports.

Fixes ansible#4414

Signed-off-by: psimaker <[email protected]>
@psimaker psimaker force-pushed the fix/idempotence-handler-attribution branch from a45b291 to d7d81c1 Compare April 5, 2026 19:59
@github-actions github-actions Bot added fix and removed fix labels Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Idempotence test fail in handler not attributed to handler

1 participant