[DUPLICATE] Story 4.5: Test Reranker Score Validation and Top-K Constraints
Sprint Key: 4-5-test-reranker-score-validation-and-top-k-constraints
Epic: 4
PRD: testing-framework
Story 4.5: Test Reranker Score Validation and Top-K Constraints
Status: ready-for-dev
Story
As a developer, I want pytest tests for the reranker's score validation and result limiting, so that score boundaries and top-K enforcement are validated.
Acceptance Criteria
-
Given
genieai_tei_reranker.pyvalidates scores and enforces top-K constraints, when I createtests/test_reranker.py, then tests verify score validation accepts valid scores (0.0–1.0) and rejects out-of-range values -
Given the reranker supports
top_nparameter, when I run tests, then tests verify top-K constraint enforcement returns exactly K results for the "slice" strategy -
Given the reranker calls the TEI
/rerankendpoint, when I run tests, then tests verify TEI service call with correct payload (query + texts) - Given TEI service is mocked via conftest fixture, when I run tests, then all external dependencies are mocked and no real network calls occur
- Given the reranker supports 3 strategies plus a fallback, when I run tests, then tests cover all 4 code paths: "slice", "threshold", "knee_threshold", and unknown strategy fallback