about summary refs log tree commit diff
path: root/tests/search_engine.rs
AgeCommit message (Collapse)Author
2026-10-08Merge origin/main (54f1388): page, publish annotations, publications route.Alexander_Kabui
Composes the new main above the search engine seam: * src/routes/search.rs (page): parsed and threaded through the seam; the gn3 forwarder passes page to gn3 unsorted (sorted fetches the wide first page), the native engine takes the mset window. Ranked pages slice the sorted list, as before. * src/routes/search.rs (add_publish_annotations): enrichment now fills locus and abbreviation in one PublishXRef/Phenotype lookup. * src/search/mod.rs (Engine::search): page parameter; SearchHit gains abbreviation and pubmed_id (gn3's future fields flow via extra, as before). * src/db.rs (LRS_PER_LOD): 4.604 — lod shifts accordingly everywhere. All 34 test binaries green; parity replay and shape gates pass against the dev index with the new lod constant (grading compares identifier sets, not lod); page disjointness, abbreviation and locus verified live (native engine, dev index, SQL_URI set).
2026-10-07Typed-422 body + Q42 re-baseline (C3.7, ACTIVE — the owner-blessed contract)Alexander_Kabui
One commit, both halves of AMENDMENT E / the 2026-10-06 contract: (i) The 422 invalid_query body gains the blessed typed shape. The SearchError::InvalidQuery payload becomes {message, xapian_error_type}, threaded from every producer: - native parser rejects (parse_query_checked): the ParseError's own class, e.g. QueryParserError for Q51/Q52; - the C3.4 numeric-range guard: QueryParserError ("Unknown range operation", Q52's recorded production diagnostic); - the C3.6 invalid-location guard: InvalidOperationError — the class production actually threw for Q42; - the gn3 forwarder: gn3's error_type field, with the bytes-repr leak normalized (b'QueryParserError' -> QueryParserError — the binding- report R1 / OPEN-16 wrapper-layer normalization), or the exception class name itself for gn3's escaping-exception 500 bodies. The route's engine_error builds the typed body inside the existing ApiError envelope, under "error": {type: "invalid_query", message, param: "query", detail: {xapian_error_type}} — the envelope's existing fields (code, detail, ...) keep their meaning, so every current 422 (Q51/Q52 parser rejects, Q42's invalid-location class, mean:abc..def) emits it and the harness's body["code"] grading is untouched. The forwarder additionally maps gn3's malformed-processor-value 500s (the escaping xapian exceptions — Q42's recorded {"error": "InvalidOperationError", ...} body, the parity-metric amendment's curl-verified ValueError) onto InvalidQuery, scoped to the exception-class shape (a bare CamelCase ...Error name, or "Class: message"): the blessed contract folds all malformed input into 422, while prose 500 diagnostics ("gn3 exploded") keep the 502 backend_error class — pinned by both the rust and python route tests. (ii) The harness comparator's Q42 mapping rule changes: recorded production 500 -> expected 422 invalid_query. The recorded fixture itself stays untouched as production truth (recorded_status 500, served verbatim by the stub); only grade_error_class's Server500 arm re-baselines, with its doc comments and the comparator unit tests. Gate evidence (~/spikes/port-execution-r2/logs/c37-*): production floor 54/54 PASS with the NEW rule — Q42 rec=500 gn4=422 code=invalid_query through the real route + forwarding engine + stub (match200 49/49, clause-b 36/36, min J 1.000, parity-report.json floor PASS); FULL pinned cargo test --release EXIT=0 (30 suites, incl. the re-based comparator unit tests and the route unit tests pinning the typed body's presence for invalid_query and absence for backend errors); shape-class gate 52/52 unchanged; hermetic lib 23 green incl. the typed-payload assertions (Q51 message byte-identical, QueryParserError classification). rustfmt --edition 2024 clean on all nine touched files.
2026-10-07tests/search_engine.rs (timeout stub): stop parking a runtime worker in ↵Alexander_Kabui
serve_slow. The 2s stall ran as a bare std::thread::sleep inside the axum handler, which parks a tokio worker thread. When the reqwest client future's wake then lands on the parked worker, the GN3_TIMEOUT_SECS=1 cancel is processed only after the response completes, and the test measures ~2.0s instead of <1.9s -- a scheduler-dependent ~30% flake, measured 3/10 isolated failures both at pristine C1.1 (1597f51) and at the P0 baseline run (the first full-suite run of this lane hit it under load; the isolated 10x runs are the discriminating evidence). Move the sleep onto the blocking pool via spawn_blocking, the same house pattern every src/routes handler uses for blocking work. Test semantics unchanged: the response still stalls 2s, the 1s timeout still fires first. Evidence: ~/spikes/port-execution/logs/flakefix.log (10/10 isolated passes after the fix, full suite EXIT=0); pre-fix logs: baseline-raw.log, baseline-raw.log.2, c1-2.log.
2026-10-06* tests/search_engine.rs (gn3 engine): pin the seam error contract.Alexander_Kabui
Covers the SearchError variants tests/search.rs does not reach (it pins only InvalidQuery and Backend), plus the GN3_TIMEOUT_SECS -> reqwest timeout plumbing. Calls the Gn3 engine directly, so no auth or JWKS stub is needed; scenarios run in one sequential test function per the process-global-state rule in docs/SKILL.md.