Severity: Low (side-effect count; output matches)
Summary
In path mode only, and only when the ?-wrapped generator is reached through .., an error
inside the generator does not backtrack out of the enclosing .[] — evaluation resumes with
the next element, so a side effect ahead of the error fires once per element instead of once.
Repro
Confirmed live against jq 1.7.1 and succinctly at a953112f2; pre-existing (the same
divergence reproduces on 1b12aa528, before #2694's streaming work, so it is not caused by it):
$ echo '[true,false]' | jq -c '[path(.. | (.[]|stderr|.+0)?)]'
true[]
$ echo '[true,false]' | succinctly jq -c '[path(.. | (.[]|stderr|.+0)?)]'
truefalse[]
.+0 on a boolean raises; jq's try aborts the whole body, so .[] is never resumed and
stderr writes once. Here .[] continues to the second element and writes twice.
Three neighbouring spellings all agree with jq, which is what localises it to the
..-piped path-mode route rather than to ? or to .[]:
$ echo '[true,false]' | jq -c '[(.[]|stderr|.+0)?]' # true[] — both agree
$ echo '[true,false]' | jq -c '[.. | (.[]|stderr|.+0)?]' # true[] — both agree (value mode)
$ echo '[true,false]' | jq -c '[path((.[]|stderr|.+0)?)]' # true[] — both agree
So the difference appears only when the ? sits downstream of .. and inside path().
Likely the node .. delivers is not the document's own tracked value, routing the ? through
a different arm than the standalone path((...)?) spelling takes
(resolve_optional_sink vs. whatever the piped stage reaches).
Fix direction
Find which arm the .. | stage routes the Optional through and make its error handling stop
the enclosing generator, as resolve_optional_sink already does for the standalone spelling.
Needs a live-oracle differential sweep against jq 1.7.1 per ADR-0018 before landing; the
neighbouring rows above are the regression guards.
Severity: Low (side-effect count; output matches)
Summary
In path mode only, and only when the
?-wrapped generator is reached through.., an errorinside the generator does not backtrack out of the enclosing
.[]— evaluation resumes withthe next element, so a side effect ahead of the error fires once per element instead of once.
Repro
Confirmed live against jq 1.7.1 and
succinctlyata953112f2; pre-existing (the samedivergence reproduces on
1b12aa528, before #2694's streaming work, so it is not caused by it):.+0on a boolean raises; jq'stryaborts the whole body, so.[]is never resumed andstderrwrites once. Here.[]continues to the second element and writes twice.Three neighbouring spellings all agree with jq, which is what localises it to the
..-piped path-mode route rather than to?or to.[]:So the difference appears only when the
?sits downstream of..and insidepath().Likely the node
..delivers is not the document's own tracked value, routing the?througha different arm than the standalone
path((...)?)spelling takes(
resolve_optional_sinkvs. whatever the piped stage reaches).Fix direction
Find which arm the
.. |stage routes theOptionalthrough and make its error handling stopthe enclosing generator, as
resolve_optional_sinkalready does for the standalone spelling.Needs a live-oracle differential sweep against jq 1.7.1 per ADR-0018 before landing; the
neighbouring rows above are the regression guards.