8000 Project-level remediation for data-flow fixes (L080 rename, L006 cat→slurp) · Issue #565 · ansible/apme · GitHub
[go: up one dir, main page]

Skip to content

Project-level remediation for data-flow fixes (L080 rename, L006 cat→slurp) #565

Open

Description

@cidrblock

Summary

Node-local AI remediation rewrites producers without updating consumers. After remediating a large repo, a review found:

  1. L080 (set_fact → __foo) — facts written to __foo, tasks still read foo (role default, usually false). Configure/start tasks skipped; pkg mgr vars undefined.
  2. L006 (cat → slurp) — module swapped, Jinja still uses stdout_lines (slurp does not provide it). RCA report output empty.
  3. L006 + piped cat — first-token match fired on cat /proc/meminfo | grep …; AI moved the pipeline onto command (no shell).

Short-term: stop auto-applying these (see the companion PR). This issue is the real fix.

Is this project-level AI?

Yes. These fixes belong in ADR-027 (agentic project-level remediation with search/read/write), not in node-local propose_node_fix().

A graph walk of data_flow edges is not sufficient. We do not know every use:

What we have Gap
EdgeType.DATA_FLOW from register / set_fact Built by _extract_variable_references() — Jinja {{ }} only, in when_expr and string module_options
David's actual consumers Bare when: chrony_config_chrony_installed (no braces) — no data_flow edge
Role defaults Old name stays defined, so L039 never fires after a rename
Not scanned failed_when, changed_when, loop, task name, nested maps, .j2 templates, hostvars[] / vars[], extra vars
ARI TaskCall.variable_use Exists on the ARI model, not copied onto ContentNode, unused for data_flow

A stronger usage index would help the common YAML-task cases. It cannot be the sole source of truth for a rename or a register-shape change. Templates and dynamic lookups need project-wide search.

What a complete fix should do

  • L080 / variable rename: find every reference (YAML + Jinja templates), rename them, or refuse the transform.
  • L006 cat → slurp: rewrite register consumers to content \| b64decode / splitlines; do not substitute when the command has pipes or extra tokens.
  • Convergence: mark consumers dirty (not just the producer). A dropped data_flow edge after a transform should fail the changeset.
  • Routing: keep L006/L080 on the project-level path until the above exists.

Do not re-enable node-local AI for these rules as a shortcut.

Related

  • ADR-027 (agentic project-level AI)
  • ADR-044 (data_flow edges; semantic preservation / graph isomorphism)
  • Companion PR: stop node-local AI from applying L006/L080; skip piped cat in L006; refuse L007 shell→command when the command cannot be inspected

Activity

  1. cidrblock commented on Aug 19, 2026

    @cidrblock
    CollaboratorAuthor

    Short-term stopgap: #566 — L006/L080 no longer auto-remediated; piped cat is not L006; L007 will not move an uninspectable/piped command onto command.

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

    enhancementNew feature or requestpythonPull requests that update python coderules

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0