Skip to content

Motif collapse drops activities when the same motif matches twice in one pipeline #28

Description

@matthewmoorcroft

Summary

File: src/flowx/motifs/collapser.py (collapse_motifs)

When one pipeline contains two or more matches of the same motif (e.g. two separate "File Existence Validation" groups), the collapser tracks inserted motifs in a set[str] keyed by motif_id alone (if motif_id in inserted_motifs: continue). The second match hits the guard and is skipped entirely, so:

  1. its member activities are never added to motif_task_keys, and
  2. _rewire_dependencies cannot redirect edges pointing at them.

Downstream tasks that depended on the dropped activities keep a depends_on edge to a task that no longer exists.

Observed failure (deploy-time)

Error: cannot create resources.jobs.<job>: Invalid dependency graph for task
'DataExtractionTableList', job specification does not contain task with key
'OlDBVersiontoCurrentDBVersion' (400 INVALID_PARAMETER_VALUE)

The motif_<id> task_key also collides between the two matches.

Impact

Silent data loss + invalid DAG: a whole group of activities is dropped from the output, and the resulting job fails to create. No error or warning at conversion time.

Proposed fix

Track each detected match by identity (id(detected)) and mint a unique task_key per occurrence (motif_X, motif_X_2, …) via a task_key_suffix, recording every member's task_key -> motif mapping so dependency rewiring still works.

Test gap

No test asserts that a motif matching twice in one pipeline produces two distinct nodes with rewired dependencies. Fix PR adds coverage.

Activity

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 working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions