Commit dac4a2b
Fix random TestRandomChains failures by excluding broken-offsets producers, #1072
TestRandomChains could fail intermittently (deterministic given a seed) with
"startOffset must be non-negative, and endOffset must be >= startOffset" thrown
from OffsetAttribute.SetOffset via ShingleFilter.IncrementToken. A broken-offsets
producer (e.g. WordDelimiterFilter) emits backwards offsets that a downstream
word-combiner (ShingleFilter) then passes to SetOffset, which rejects start > end.
The 8 known broken-offsets producers were only listed in brokenOffsetsConstructors,
which merely relaxes ValidatingTokenFilter's checks (offsetsAreCorrect=false) but
still lets the offending filter run and feed bad offsets downstream. Upstream Lucene
resolved this in 9.1 (LUCENE-10352) by excluding these classes from random chains via
the @IgnoreRandomChains annotation. Until that is backported, also add them to
brokenConstructors with ALWAYS so they are fully excluded from the random chains.
Also fix an operator-precedence bug in NewFilterChain's MockGraph/MockRandomLookahead
guard (misplaced parenthesis) to match upstream Java, and remove [AwaitsFix] from
TestRandomChains_ and TestRandomChainsWithLargeStrings now that they pass reliably.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent e2e5d97 commit dac4a2b
1 file changed
Lines changed: 12 additions & 4 deletions
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
154 | 164 | | |
155 | 165 | | |
156 | 166 | | |
| |||
1169 | 1179 | | |
1170 | 1180 | | |
1171 | 1181 | | |
1172 | | - | |
1173 | | - | |
| 1182 | + | |
| 1183 | + | |
1174 | 1184 | | |
1175 | 1185 | | |
1176 | 1186 | | |
| |||
1284 | 1294 | | |
1285 | 1295 | | |
1286 | 1296 | | |
1287 | | - | |
1288 | 1297 | | |
1289 | 1298 | | |
1290 | 1299 | | |
| |||
1311 | 1320 | | |
1312 | 1321 | | |
1313 | 1322 | | |
1314 | | - | |
1315 | 1323 | | |
1316 | 1324 | | |
1317 | 1325 | | |
| |||
0 commit comments