Skip to content

test(slm): harden #16351's deletion guards so a plausible playbook edit can't make them pass vacuously #16373

Description

@mrveiss

Problem

These came from Helper-02's second-session delta review of #16351 round 13 (3aadb1424..ae04398c2). Nothing here blocks #16351. All of them sharpen guards that pass non-vacuously on today's playbook but could pass vacuously after a plausible edit. They were filed rather than folded in because #16351 had reached thirteen rounds, and every push re-runs full CI while runners are saturated.

# Where Gap Fix
A repo_tests/sync_deletions_cross_component_isolation_16310_test.py, _assert_no_archive_prefix_rewrite It reads only the task's shell key. Converting the archive task to ansible.builtin.shell: or command: makes the check pass with nothing checked. Read whichever command key is present (shell, ansible.builtin.shell, command, ansible.builtin.command, cmd), and assert that a command was found.
B same git's ref:path form (git archive <ref>:autobot-backend) flattens the paths without any --prefix, so the landing-directory derivation would be wrong while the prefix check still passes. Pin the -- {{ item.path }} pathspec form itself, and fail on a <ref>:<path> tree-ish.
C same, the strip-components branch Any --strip-components=N is taken to mean "dest is the landing directory". That's only right when N equals the archived path's depth: 4 for the AI Stack, correct today. Derive the landing directory from N and the archived path's depth, and fail if they don't add up.
D autobot-slm-backend/ansible/roles/_shared/tasks/sync_deletions.yml, the always: cleanup failed_when: false makes a cleanup failure silent. register: the result and add a debug warning when it failed, so "nothing swallowed" stays true.
E same, comment ignore_unreachable: true only covers a node that became unreachable between the delete and the cleanup. A node that's already unreachable inside the block isn't rescued, and it leaves the play before always:. The "one node never aborts the fleet" contract covers this module's failures, not unreachability. State that boundary in the comment.
F the isolation test's docstring The new isolation tests cover the 12 playbook sites. The four role sites (e.g. slm_agent's per-file copies) are outside them, because their targets are role variables. State the boundary, and extend coverage to the role sites if their variables can be resolved statically.

Acceptance criteria

  • A: a planted archive task under each command-key spelling is checked, and a task with no command key fails.
  • B: a planted <ref>:<path> archive fails the test.
  • C: a planted strip count that doesn't match the path depth fails.
  • D: a failed cleanup produces a visible warning, pinned by a YAML test.
  • E and F: the boundaries are stated where a reader of the guard will see them.

Refs #16351, #16310, #16322

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions