Commit 3fc22ec
committed
fix(sprint-13/codex-p2): D-CSV-14 gen=0 + D-CSV-16 cam_pq_search semantics
Two codex P2 findings on the merged sprint-13 W-I2 / W-I3 PRs (#395, #396).
Both bugs are silent semantic regressions; both fixes are surgical.
## #395 / D-CSV-14 — splat_ops::splat_gaussian deprecated shim, gen=0 case
Old free fn wrote `SplatField::generation = generation` verbatim. The
deprecation shim seeds `Think::from_field(field, generation.saturating_sub(1))`
then calls `splat_gaussian`, which advances cycle and writes
`generation = self.cycle`. For `generation >= 1` this matches v1; for
`generation == 0` the saturating sub stays at 0 and the post-advance
cycle becomes 1, producing `generation = 1` instead of 0.
Fix: after the delegated call, walk `think.splat_field` and overwrite
the touched splat (matched by `mean`) with the caller-supplied
`generation`. Both push-new and merge-existing paths are covered.
Test: `deprecated_splat_gaussian_preserves_generation_zero` asserts
verbatim preservation for both push and merge paths.
## #396 / D-CSV-16 — WitnessCorpus::cam_pq_search exact-match semantics
Old (sprint-12) `cam_pq_search` was exact SPO top-k via HashMap. W-I3's
patch added a `#[cfg(feature = "with-cam-pq")]` early-return that routed
through `WitnessIndexCamPq::cam_pq_search`, which is distance-ranked ANN
over the whole corpus. Two semantic regressions follow when CAM-PQ is
enabled:
- Missing SPO: v1 returns empty; v2 returns k unrelated neighbours.
- Existing SPO with <k entries: v1 returns just the matches; v2 pads
with unrelated nearest neighbours.
The distance-ranked API was already added as `query_similar` (returns
`Option<Vec<(&WitnessEntry, f32)>>`), so callers wanting ANN have it.
`cam_pq_search` should keep its exact-match contract.
Fix: remove the `with-cam-pq` early-return block; the HashMap path
(always present) handles both feature states identically.
Test: `cam_pq_search_exact_match_when_cam_pq_enabled` (cfg with-cam-pq)
asserts a missing SPO returns empty and an existing SPO returns only
its own entries — never unrelated neighbours.
## Validation
- `cargo test --manifest-path crates/thinking-engine/Cargo.toml splat_ops`
→ 5/5 pass (including new gen=0 test)
- `cargo check -p lance-graph --features with-cam-pq --tests` → clean
- `cargo check -p lance-graph --tests` (feature OFF) → clean
- `cargo test -p lance-graph --features with-cam-pq` linking fails with
`ld terminated with signal 7 [Bus error]` — environmental linker
constraint, same one W-I3 originally hit; not a code defect.
https://claude.ai/code/session_01UwJuKqP828qyX1VkLgGJFS1 parent 8d321ff commit 3fc22ec
2 files changed
Lines changed: 68 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
412 | | - | |
| 412 | + | |
413 | 413 | | |
414 | | - | |
415 | | - | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
416 | 417 | | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | 418 | | |
427 | 419 | | |
428 | 420 | | |
| |||
979 | 971 | | |
980 | 972 | | |
981 | 973 | | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
982 | 1007 | | |
983 | 1008 | | |
984 | 1009 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
56 | 65 | | |
57 | 66 | | |
58 | 67 | | |
| |||
169 | 178 | | |
170 | 179 | | |
171 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
172 | 203 | | |
173 | 204 | | |
174 | 205 | | |
| |||
0 commit comments