metaflow/client/core.py [1233:1276]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        if not steps:
            return []

        current_path = self.metadata_dict.get("foreach-execution-path", "")

        if len(steps) > 1:
            # Static join - use exact path matching
            pattern = current_path or ".*"
            yield from self._iter_matching_tasks(
                steps, "foreach-execution-path", pattern
            )
            return

        # Handle single step case
        target_task = Step(
            f"{flow_id}/{run_id}/{steps[0].id}", _namespace_check=False
        ).task
        target_path = target_task.metadata_dict.get("foreach-execution-path")

        if not target_path or not current_path:
            # (Current task, "A:10") and (Parent task, "")
            # Pattern: ".*"
            pattern = ".*"
        else:
            current_depth = len(current_path.split(","))
            target_depth = len(target_path.split(","))

            if current_depth < target_depth:
                # Foreach join
                # (Current task, "A:10,B:13") and (Parent task, "A:10,B:13,C:21")
                # Pattern: "A:10,B:13,.*"
                pattern = f"{current_path},.*"
            else:
                # Foreach split or linear step
                # Option 1:
                # (Current task, "A:10,B:13,C:21") and (Parent task, "A:10,B:13")
                # Option 2:
                # (Current task, "A:10,B:13") and (Parent task, "A:10,B:13")
                # Pattern: "A:10,B:13"
                pattern = ",".join(current_path.split(",")[:target_depth])

        yield from self._iter_matching_tasks(steps, "foreach-execution-path", pattern)

    @property
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



metaflow/client/core.py [1288:1331]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        if not steps:
            return []

        current_path = self.metadata_dict.get("foreach-execution-path", "")

        if len(steps) > 1:
            # Static split - use exact path matching
            pattern = current_path or ".*"
            yield from self._iter_matching_tasks(
                steps, "foreach-execution-path", pattern
            )
            return

        # Handle single step case
        target_task = Step(
            f"{flow_id}/{run_id}/{steps[0].id}", _namespace_check=False
        ).task
        target_path = target_task.metadata_dict.get("foreach-execution-path")

        if not target_path or not current_path:
            # (Current task, "A:10") and (Child task, "")
            # Pattern: ".*"
            pattern = ".*"
        else:
            current_depth = len(current_path.split(","))
            target_depth = len(target_path.split(","))

            if current_depth < target_depth:
                # Foreach split
                # (Current task, "A:10,B:13") and (Child task, "A:10,B:13,C:21")
                # Pattern: "A:10,B:13,.*"
                pattern = f"{current_path},.*"
            else:
                # Foreach join or linear step
                # Option 1:
                # (Current task, "A:10,B:13,C:21") and (Child task, "A:10,B:13")
                # Option 2:
                # (Current task, "A:10,B:13") and (Child task, "A:10,B:13")
                # Pattern: "A:10,B:13"
                pattern = ",".join(current_path.split(",")[:target_depth])

        yield from self._iter_matching_tasks(steps, "foreach-execution-path", pattern)

    @property
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



