From e469eb1d496bb5ca08a8eb264bfaead2816670e3 Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Wed, 7 Oct 2026 09:40:32 +0300 Subject: src/search/native.rs (tests): fix the C3.2/C3.3 parser-test defects the guix attempt-4 check phase exposed. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three defects in the committed C3.2/C3.3 test code, all found by guix attempt 4's check phase (drv jlsjsw7i, phase `check', cargo test --offline; log: logs/guix-c1-3.log attempt-4 section) after the build phase had already proven the vendoring mechanism and the fork link (287 s): 1. E0596 x2: the `terms` and `prefixed` closures borrow `qp` mutably, so both bindings need `let mut` (rustc 1.85.1 diagnostics in the guix log; the same E0596 sat unnoticed in logs/c3-3.log above a bogus "LIB_EXIT=0" — the dev-shell gate script swallowed cargo's exit status; fixed by re-running the gates with explicit status capture, logs/fix-fulltest.log). 2. The C3.2 boolean test asserted the WRONG index term for group:B6: `XGbxd`, with a message claiming "group:B6 must lowercase to XGbxd". That is the r1-test BXD case: search.py:204-209 lowercases the VALUE and concatenates behind XG, so B6 -> XGb6 (xapian-delve on the dev index: terms XGb6, XGb6btbrf2, XGb6d2, XGb6d2f2, XGb6d2ri exist for group B6; XGbxd exists separately for the BXD value). Corrected to XGb6 / !XGB6. The 13a7cb1 commit message itself repeats the wrong "group:B6 -> XGbxd" claim — history is left intact, corrected here and in LANE-REPORT/REVIEW. 3. The C3.3 probabilistic test asserted the non-stemmed field prefix (XD/XRF/XWK), but with STEM_ALL_Z the parsed field term is Z++stem — exactly what d563910's own commit message describes ("wiki:diabetes -> ZXWKdiabet") and what the production indexer emits (dev index: 9678 ZXWK* terms, 47868 ZXRF* terms, ZERO XWKZ/XRFZ/XDZ terms). Corrected to ZXD/ZXRF/ZXWK, making the assertion pin the exact indexed term form instead of a form that never occurs. Because of defect 1 neither test ever ran at commit time — the C3.3 "lib tests green / FULL suite EXIT=0" evidence was a false positive of the broken exit capture, now re-established with real status capture. --- src/search/native.rs | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/search/native.rs b/src/search/native.rs index a7b2fb5..665477a 100644 --- a/src/search/native.rs +++ b/src/search/native.rs @@ -267,7 +267,7 @@ mod tests { #[test] fn boolean_prefixes_parse_to_exact_index_terms() { let mut qp = build_query_parser(); - let terms = |query: &str| -> std::collections::BTreeSet { + let mut terms = |query: &str| -> std::collections::BTreeSet { qp.parse_query_checked::<&str>(query, None, None) .unwrap_or_else(|e| panic!("{query} must parse: {e:?}")) .unique_terms() @@ -288,21 +288,29 @@ mod tests { assert!(terms("chr:1").contains("XC1")); assert!(terms("peakchr:1").contains("XPC1")); // search.py:204-209, 222-223: group values lowercase (xapian - // does not stem boolean fields starting with a capital). + // does not stem boolean fields starting with a capital): + // B6 -> b6, concatenated behind XG. (The r1-test G4 smoke's + // XGbxd was the same rule for value BXD, not a stem.) let b6 = terms("group:B6"); - assert!(b6.contains("XGbxd"), "group:B6 must lowercase to XGbxd, got {b6:?}"); - assert!(!b6.contains("XGBXD"), "group must not emit the raw-case term"); + assert!( + b6.contains("XGb6"), + "group:B6 must lowercase to XGb6, got {b6:?}" + ); + assert!(!b6.contains("XGB6"), "group must not emit the raw-case term"); } /// The probabilistic-prefix registrations (C3.3): description, rif, /// wiki and the uppercase aliases must parse as weighted field /// terms, not free text (search.py:229-233). With STEM_ALL_Z the - /// field term is the prefix + Z-stemmed value (e.g. XDZinsulin), - /// so assert on the prefix, the invariant the registration owns. + /// field term is Z++stem — ZXDinsulin, ZXRF…, ZXWK… — the + /// exact shape the production indexer's TermGenerator emits for + /// these fields (confirmed against the dev index: term + /// ZXWKdiabet exists with 24 gene documents, ZXRF-prefixed terms + /// abound; d.v. the delve probes in LANE-REPORT). #[test] fn probabilistic_prefixes_and_aliases_parse_as_field_terms() { let mut qp = build_query_parser(); - let prefixed = |query: &str, prefix: &str| { + let mut prefixed = |query: &str, prefix: &str| { let set = qp .parse_query_checked::<&str>(query, None, None) .unwrap_or_else(|e| panic!("{query} must parse: {e:?}")) @@ -311,11 +319,11 @@ mod tests { .collect::>(); set.iter().any(|t| t.starts_with(prefix)) }; - assert!(prefixed("description:insulin", "XD")); - assert!(prefixed("rif:insulin", "XRF")); - assert!(prefixed("RIF:insulin", "XRF")); - assert!(prefixed("wiki:diabetes", "XWK")); - assert!(prefixed("WIKI:diabetes", "XWK")); + assert!(prefixed("description:insulin", "ZXD")); + assert!(prefixed("rif:insulin", "ZXRF")); + assert!(prefixed("RIF:insulin", "ZXRF")); + assert!(prefixed("wiki:diabetes", "ZXWK")); + assert!(prefixed("WIKI:diabetes", "ZXWK")); } /// The index-open guards, without touching a real index. -- cgit 1.4.1