Skip to content

bug(graph): literal If over an axis reopened after a Collect drops items #9917

Closed

Description

@lstein

Summary

A literal If whose selected branch iterates an axis that was reopened after a Collect gives wrong groups when the reopened collection has a different length from the original axis. An item is dropped silently and one group comes out empty. No error is raised.

Reproduction

Nodes (the test nodes are from tests/test_nodes.py):

  • srcA: CollectionConcatInvocation(first=["a1", "a2"]) → itA: IterateInvocation
  • itA.item → b: Mark("b:") → cc: CollectInvocation
  • cc.collection → ext: CollectionConcatInvocation(second=["x"]) → itB: IterateInvocation (3 items)
  • itB.item → t: Mark("t:") → if.true_input
  • itA.item → f: Mark("f:") → if.false_input
  • if: IfInvocation(condition=True) → collect: CollectInvocation

Run it with GraphExecutionState on main (seen at ac237a1, on both schedulers).

Observed: the graph completes with three collect outputs, at paths [0] → ["t:b:a1"], [1] → ["t:b:a2"] and [2] → []. Item x never reaches t, so t:x is missing.

Expected: t:x is not lost. Either the selected branch's items are collected correctly, or the shape is rejected with UnsupportedIfIterationAxesError before anything runs, as other unsupported axis shapes are.

With condition=False the same graph is rejected with UnsupportedIfIterationAxesError once #9789 is merged.

Notes

One narrow rule would turn this into an error: allow a reopened axis only when the new Iterate reads straight from the closing Collect. That changes the result of a graph main currently completes, so it was left out of #9789 and is waiting on a maintainer decision there.

Found during review of #9789.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions