Skip to content

Fix flaky RsSearchTest score parsing for FT.SEARCH results - #97

Merged
mumez merged 1 commit into
developfrom
cursor/fix-flaky-search-score-test-98d3
Sep 8, 2026
Merged

mumez merged 1 commit into
developfrom
cursor/fix-flaky-search-score-test-98d3

Conversation

@mumez

@mumez mumez commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Problem

CI run 34097596917 failed on Pharo64-12 with:

RsSearchTest>>testSearchWithOptionsSimpleHashes ...assert: (rs result) score > 0

Root cause

Two issues in search result parsing:

  1. RsSearchResult>>score: used asInteger — BM25 scores from RediSearch are fractional floats (e.g. 0.287682...). Converting via asInteger truncates to 0, causing score > 0 to fail intermittently depending on how the Redis client returns the value (String vs Float).

  2. RsSearchResultSet used fixed-size chunk parsing — With WITHSCORES, WITHPAYLOADS, and WITHSORTKEYS, the reply layout is variable-length (nested content array vs flat field/value pairs). A fixed chunk size of 5 misaligned fields under some reply formats.

Fix

  • Parse scores with asNumber to correctly handle fractional BM25 values.
  • Replace fixed-size chunking with stream-based result loading that infers field-pair count per document and supports both nested and flat Redis reply layouts.

Testing

Verified locally on Pharo64-11, Pharo64-12, and Pharo64-13:

Executed 349 Tests with 0 Failures and 0 Errors

#testSearchWithOptionsSimpleHashes passes consistently across multiple runs on Pharo64-12 (the CI version that failed).

Open in Web Open in Cursor 

BM25 scores are fractional floats, but score: used asInteger which
truncated values like 0.28 to 0 and failed score > 0 assertions on CI.

Replace fixed-size chunk parsing with stream-based loading that handles
both nested and flat Redis reply layouts for WITHSCORES/WITHPAYLOADS/
WITHSORTKEYS combinations.

Co-authored-by: Masashi Umezawa <mumez@users.noreply.github.com>
@mumez
mumez marked this pull request as ready for review September 8, 2026 02:14
@mumez
mumez merged commit 29ff7d0 into develop Sep 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants