FA-11871 / Search retrieval semantics / Open access
Filtered search returns an underfilled result page · case 01
Filtered search returns an underfilled result page.
ROOT CAUSE
The rank cutoff is applied before eligibility filtering.
VERIFIED REPAIR
Filter all candidates, sort by descending score and identifier, then truncate.
Unsuccessful approach: Oversampling a fixed multiple still misses eligible hits farther down the candidate list.
Case contract
Hits are [id,score,eligible], IDs unique. Return the highest ranked k eligible IDs with lexical score ties; k is nonnegative.
Why this case matters
An offline deterministic retrieval model isolates this search contract from tokenization, storage, and network behavior.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(hits, k):
return [h[0] for h in sorted(hits,key=lambda h:(-h[1],h[0]))[:k] if h[2]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('deep eligible hit', solve([[str(i),100-i,False] for i in range(N+3)]+[['ok',0,True]],1),['ok'])
check('eligible score order', solve([['b',N,True],['a',N+1,True]],2),['a','b'])
check('score ties', solve([['b',N,True],['a',N,True]],1),['a'])
check('zero limit', solve([['a',N,True]],0),[])
check('empty candidates', solve([],N),[])
check('all rejected', solve([['a',N,False]],1),[])
check('short page exhausted', solve([['a',N,True]],5),['a'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| deep eligible hit | [] | ['ok'] | Failed |
| eligible score order | ['a', 'b'] | ['a', 'b'] | Passed |
| score ties | ['a'] | ['a'] | Passed |
| zero limit | [] | [] | Passed |
| empty candidates | [] | [] | Passed |
| all rejected | [] | [] | Passed |
| short page exhausted | ['a'] | ['a'] | Passed |
SHA-256 / 4ce2d552f508e500a8f0c1986b6258f9885813fdb27ba33c08267f1c89649003
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(hits, k):
return [h[0] for h in sorted(hits,key=lambda h:(-h[1],h[0]))[:2*k] if h[2]][:k]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('deep eligible hit', solve([[str(i),100-i,False] for i in range(N+3)]+[['ok',0,True]],1),['ok'])
check('eligible score order', solve([['b',N,True],['a',N+1,True]],2),['a','b'])
check('score ties', solve([['b',N,True],['a',N,True]],1),['a'])
check('zero limit', solve([['a',N,True]],0),[])
check('empty candidates', solve([],N),[])
check('all rejected', solve([['a',N,False]],1),[])
check('short page exhausted', solve([['a',N,True]],5),['a'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| deep eligible hit | [] | ['ok'] | Failed |
| eligible score order | ['a', 'b'] | ['a', 'b'] | Passed |
| score ties | ['a'] | ['a'] | Passed |
| zero limit | [] | [] | Passed |
| empty candidates | [] | [] | Passed |
| all rejected | [] | [] | Passed |
| short page exhausted | ['a'] | ['a'] | Passed |
SHA-256 / 85b3d177f5556cd37960ff38ddfaad8c9b4c6e667caad09ba6587b8c752b14a8
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(hits, k):
return [h[0] for h in sorted((h for h in hits if h[2]),key=lambda h:(-h[1],h[0]))[:k]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('deep eligible hit', solve([[str(i),100-i,False] for i in range(N+3)]+[['ok',0,True]],1),['ok'])
check('eligible score order', solve([['b',N,True],['a',N+1,True]],2),['a','b'])
check('score ties', solve([['b',N,True],['a',N,True]],1),['a'])
check('zero limit', solve([['a',N,True]],0),[])
check('empty candidates', solve([],N),[])
check('all rejected', solve([['a',N,False]],1),[])
check('short page exhausted', solve([['a',N,True]],5),['a'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| deep eligible hit | ['ok'] | ['ok'] | Passed |
| eligible score order | ['a', 'b'] | ['a', 'b'] | Passed |
| score ties | ['a'] | ['a'] | Passed |
| zero limit | [] | [] | Passed |
| empty candidates | [] | [] | Passed |
| all rejected | [] | [] | Passed |
| short page exhausted | ['a'] | ['a'] | Passed |
SHA-256 / 05454f9b80779229ef491dfd8a92bab66cefdd406dccbee9b6dd2f2485da9c31
Verification & scope
Inputs are already tokenized or scored; this model makes no claim about production engine performance or linguistic analysis. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:38:51.749573+00:00.
Case digest / 071dae902cee60c74f1014bdd3841de520328b0c9813c8701208f00692de9ab9