Search query parsing: fix bug in `reduce` causing issues with search contexts
Created by: camdencheek
Fixes https://github.com/sourcegraph/sourcegraph/issues/35096
Explanation of changes inline.
First commit adds a minimal test case reproducing the issue. Second commit adds a fix with updated test output.
Test plan
Added a test. We may want to consider testing this a bit more rigorously, but this will cover regression.