-
[OPIK-7321] fix: union getProjectIds result stream instead of single() (#7454)
发布于
2026-07-14 08:39:36 +00:00 - [OPIK-7321] fix: union getProjectIds result stream instead of single()
The experiment-aggregation getProjectIds pipeline terminated with
single(), which throws IndexOutOfBoundsException ("Source emitted more
than one item") and surfaces as an unmapped HTTP 500 when the R2DBC
result stream emits more than one element. Fold the emitted sets with
reduceWith so the method always emits exactly one Set (possibly empty),
matching its documented contract and tolerant of multi-element streams.Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
- [OPIK-7321] test: cover getProjectIds multi-emit fold
Extract the project_id fold into a package-private unionProjectIdChunks
helper and add a StepVerifier test: a multi-element stream is unioned
into exactly one Set (the case where single() threw
IndexOutOfBoundsException), a single chunk passes through, and an empty
stream still emits one empty Set.Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
- [OPIK-7321] chore: mark unionProjectIdChunks @VisibleForTesting
Addresses PR review nit: the helper is package-private solely so the unit
test can reach it, so annotate it with Guava's @VisibleForTesting to make
that intent explicit.Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Co-authored-by: Claude Opus 4.8 (1M context) noreply@anthropic.com
下载附件