This is just published for visibility as a public service until the Pine devs are able to fix or document this behavior. The barssince() function returns different values when inside a conditional context. As long as it can be documented (and relied upon), this could be a pretty cool feature, but right now this is now how I read the help documentation to describe the function's intended behavior.
Anyway, in the script you'll see that test and test2 agree on red bars, but on green bars test gets a much lower value, which was pretty shocking to me until I traced down this particular cause within my larger script.