I have a phenomenon here and am wondering whether this is a bug or work-as-designed.
We receive geometries from a routing service as polylines (saved as JSON) and we want to unite them geometrically with the union function. (We have no Z-coordinates, so we cant't detect if it is a crossing or a bridge or so on.)
edge1_shape:arcpy.Polyline = arcpy.AsShape(edge1.Geometry, True)
edge2_shape:arcpy.Polyline = arcpy.AsShape(edge2.Geometry, True)
edge1.Geometry = edge1_shape.union(edge2_shape).JSON
So far, everything is fine in normal line segments.
Something strange happens when the line crosses, like here

The polyline, which normally consists of exactly one “part”, is split at the crossing point, as soon as the circle closes (at the exact same crossing point wich has already been added before)
Now another part is created. So far everything, so good.
However, the part that was traveled first and was previously part 0 ...

... suddenly becomes Part 1 and the newly inserted part is now Part 0.

As far as I know, new parts are always added at the end.
And then to top it all off:
If the third part is added after the crossing point, then
- the first part is the last part (Part 2),
- the second section is the first part (Part 0) and
- the last section is the middle part (Part 1)

This means that there is no sequence at all. I don't know any longer, which part was added first and which is the last part of my line.
It looks like a bug to me.