Skip to content

Commit 76b576b

Browse files
tcconnallyclaude
andcommitted
test(temporal): make always-true-filter recall comparison order-insensitive
The unfiltered-vs-filtered recall equivalence test compared ordered key lists across two calls, but the first (unfiltered) call reinforces both hits — legitimately changing the ranking inputs (retrieval_count, last_accessed_unix_ms) before the second call — and the final ORDER BY tie-break is id ASC over random UUIDs. Post-rebase onto schema-v8 main this flaked roughly half the time (creation crossing a millisecond boundary + unlucky UUID order). The invariant under test is membership, not order: compare sorted key sets. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent a76636e commit 76b576b

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/tools.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3087,13 +3087,20 @@ mod tests {
30873087
)
30883088
.expect("filtered recall");
30893089
let fv: Value = serde_json::from_str(&filtered).unwrap();
3090+
// Compare as SETS (sorted), not ordered lists: the first (unfiltered)
3091+
// recall reinforces both hits, which legitimately changes the ranking
3092+
// inputs (retrieval_count, last_accessed) before the second call, and
3093+
// the final `id ASC` tie-break is over random UUIDs — so cross-call
3094+
// ORDER is not a stable property. Membership is.
30903095
let keys = |v: &Value| -> Vec<String> {
3091-
v["items"]
3096+
let mut k: Vec<String> = v["items"]
30923097
.as_array()
30933098
.unwrap()
30943099
.iter()
30953100
.map(|i| i["key"].as_str().unwrap().to_string())
3096-
.collect()
3101+
.collect();
3102+
k.sort();
3103+
k
30973104
};
30983105
assert_eq!(keys(&uv), keys(&fv), "always-true filter must not change the result set");
30993106

0 commit comments

Comments
 (0)