Problem
rerankResults (src/core/pinecone/rerank.ts) currently reads item.document directly with returnDocuments: true, and its document-mapping edge cases (missing document, duplicate documents, empty and absent data) are covered by the tests added in #224.
If the implementation later switches to an index-based remap (returnDocuments: false, mapping each rerank item's index back into the input results array), that path introduces failure modes the current code cannot hit and that no test exercises:
- An index that is out of range of the input set.
- Duplicate indices in the rerank output.
- An empty rerank result set for a non-empty input.
This issue tracks adding those tests. It is gated on the code change: there is nothing to test while rerank.ts maps by item.document, so no work is needed until (and unless) the index-remap path lands.
Acceptance Criteria
Applies only once rerankResults maps rerank output by index into the input results (returnDocuments: false):
- A test asserts an out-of-range index is handled without throwing (skipped or mapped to an empty result, per the chosen behavior).
- A test asserts duplicate indices are handled predictably.
- A test asserts an empty rerank result set returns empty reranked results with
degraded: false.
- Each test asserts the mapped
SearchResult fields (id, content, score, metadata, reranked).
Problem
rerankResults(src/core/pinecone/rerank.ts) currently readsitem.documentdirectly withreturnDocuments: true, and its document-mapping edge cases (missing document, duplicate documents, empty and absentdata) are covered by the tests added in #224.If the implementation later switches to an index-based remap (
returnDocuments: false, mapping each rerank item'sindexback into the inputresultsarray), that path introduces failure modes the current code cannot hit and that no test exercises:This issue tracks adding those tests. It is gated on the code change: there is nothing to test while
rerank.tsmaps byitem.document, so no work is needed until (and unless) the index-remap path lands.Acceptance Criteria
Applies only once
rerankResultsmaps rerank output by index into the inputresults(returnDocuments: false):degraded: false.SearchResultfields (id, content, score, metadata, reranked).