Files
xerj-org 1742bfbcaf fix(bench): stop on failed requests and unready ANN instead of reporting a number (#2075 items 11-13)
Motivation
#2075 (reported by @rudycelekli; the maintainer asked for items 11, 12
and 13 on 2026-11-02) lists benchmark harnesses that can print a number
that is not what it says. Item 16 landed as #3001; these are the other
three.

Root causes and fixes
11. Latency sampling kept failed requests.
    - scripts/bench/query-latency-size0.sh: both clients resolved with the
      HTTP status and nothing checked it, so a 4xx/5xx `_search` (fast) was
      timed as a latency sample. Any non-2xx now aborts the run with the
      status; nothing is printed as MEASURED.
    - benchmarks/neural-path-triage/latency.py: common.http turns an HTTP
      error into {"_err": ...}; latency.py timed it like a search. search()
      now goes through the new common.require_ok and exits on a failure.
12. scripts/bench/knn-recall.sh scored recall without ANN readiness.
    The /_cat/ann wait loop fell through after 120 polls and probed anyway,
    and its test `coverage >= 1` was wrong: `coverage` is a COUNT of graphed
    docs (es_compat.rs maps it from hnsw_stats.doc_coverage), so a single
    graphed vector passed. Ready is now the node's own `covered` verdict
    (graphed == vector docs, not stale), never while stale or rebuilding;
    a build without `covered` falls back to coverage >= vector_docs > 0.
    Not ready after ANN_WAIT_S (default 120) -> the run stops, because
    probes then would measure the exact-scan fallback.
13. benchmarks/neural-path-triage/eval.py scored HTTP failures as empty
    results: ids({"_err": ...}) == [] was counted in `empty=` and scored
    nDCG 0. search() and the _count line now exit on any non-2xx
    (common.require_ok); `empty=` counts only real zero-hit answers.

Regressions (fail on main, pass here)
- scripts/bench/tests/test_bench_guards.py runs both repro scripts end to
  end against scripts/bench/tests/fake_xerj.py (stub binary, no engine
  build). main: all 4 guard tests fail (503 timed as latency; stale,
  partly graphed and missing ANN rows all scored as recall); the 2
  controls (healthy stub still measured) pass. Here: 6/6 pass.
- benchmarks/neural-path-triage/test_http_failures.py runs eval.py and
  latency.py against an in-process stub. main: 2 of 4 fail (the two
  failure cases). Here: 4/4 pass.

Real-binary check: knn-recall.sh with VECS=5000 PROBES=20 on a private
port against a v1.0.0-rc.104 release build of this tree: covered graph
accepted, recall@10 1.000 over 20 probes, score parity 4.94e-08.

Not run: no engine code changed, so no cargo test or ES-YAML run for this
commit; no full-size benchmark run.

Reported-by: @rudycelekli (#2075)
2026-11-19 12:25:26 -06:00
..