I use sideEffect to produce debug logging (System.err.println) during traversal execution. I can enable or disable this logging with a runtime switch. When disabled, I want it so that the sideEffect steps are not even added to the Traversal, so there is no overhead.
I've noticed that I sometimes get different behavior when the logging sideEffects are not added, so I wonder whether there is some kind of traversal rewriting or optimization happening, something that the addition of sideEffect steps would somehow change.
It turns out that in every case (so far), the desired behavior occurs when the sideEffect is present. For a workaround, I have added a no-op sideEffect{ it -> } instead of the logging sideEffect when logging is disabled.
I wish I had a simple repro, but the problem seems to occur once the traversal has reached a certain level of complexity. In one scenario, I added a "select" step (which effectively selected the data that was already in the traverser ... sort of an "assert"), and that seemed to cause the problem to appear.
Does this sound like something that is expected behavior, i.e. sideEffect impacting traversal execution?
Full disclosure: I'm using an old 3.0.0 snapshot, specifically the last SonaType snapshot (2015-02-06). I'll be migrating to a more recent snapshot shortly.