| Age | Commit message (Collapse) | Author |
|
client recovers from the typed 422 by machine-repairing the query
from the error body alone. Two malformed loops (dangling AND; the
recorded mean:abc..def compound) -> assert the blessed body fields
(error.type/param/message/detail.xapian_error_type) -> derive the
fix from those fields -> resend -> 200 with recorded hits. Hermetic
(stub gn3 + stub JWKS, forwarder forced): CI-safe, no index needed.
|
|
corpus. The 54 harness shapes recorded from the self-built 47k index via the native engine (tests/search_native_dev_corpus.rs), reduced with the committed tool. Dev-truth counts; the production corpus stays the production grading truth. Pins the dev-oracle for reproducibility before any sign-off decision makes it load-bearing.
|
|
review F1)
The C3.6 guard test set XAPIAN_DB_PATH="" to "prove" the guard fires
before the index is opened — but the error VARIANT is already that
proof (an unset path would surface Internal, an unopenable one
Unreachable, if the query ever reached the index), and the mutation
raced the config tests that set the same key on their own parallel
threads in the lib test binary (a scheduler-dependent flake of the
config assertions, found in the mandatory P3 hostile re-read).
The test now touches no environment at all.
Gate: hermetic lib gate green after the change
(logs/p3-f1-fix-lib.log: LIB_EXIT=0, LIB_FMT_EXIT=0).
|
|
Records all 54 shapes from the DEVELOPMENT index through the NATIVE
engine — the same parser configuration as src/search/native.rs by
construction, because it IS that engine — producing a full dev corpus in
the production recordings' format: JSON arrays of hit bodies for match
shapes, gn3-style {"error", "error_type"} diagnostic objects for the
error shapes (the typed payloads from C3.7), and [] for the surface
shapes (an empty query parses to an empty query and matches nothing,
which is what gn3 recorded for them too).
No-drift discipline: the shape table is parsed from the harness source
itself (include_str!("search_parity.rs"), a quote-aware scanner that
handles rustfmt's multi-line rows and the parenthesized Q46 query), and
the recorder FATALs on any class/outcome mismatch and on any hit
lacking the (dataset, name) strings the parity comparison — and the
committed reduce_fixtures.py — require. Env-gated on XAPIAN_DB_PATH +
GN4_DEV_CORPUS_DIR; skips loudly otherwise so hermetic runs stay green.
The corpus itself lives OUT of git at
~/spikes/port-execution-r2/dev-corpus/{full,reduced} + README.md (the
numbers are DEV-TRUTH on the 2025-02-18 public data, not production
counts — the README says so and every run's fixture_dir points at it),
like the 105 MB production full corpus.
Gate evidence (~/spikes/port-execution-r2/logs/): recording
RECORD_EXIT=0, 54/54 with per-shape dev counts printed
(devcorpus-record.log; e.g. Q01 alcohol=2330 dev vs 1197 production,
Q32 position=1, Q53 position:=1017, Q42 recorded as its typed
diagnostic); reduce via the committed reduce_fixtures.py 128,068,128 B
-> 5,237,910 B (4.1%); the DEV FLOOR as a separate report
(GN4_PARITY_FIXTURES at the reduced dev corpus, GN4_PARITY_REPORTS at
logs/dev-parity-reports; the production corpus untouched):
DEV_FLOOR_EXIT=0, 54/54 PASS, FLOOR: PASS, min J = 1.000 (clause-b over
the 26 dev shapes with >= 10 dev hits — dev-truth, not a production
count). FULL pinned cargo test --release EXIT=0 (31 suites, the
recorder skips hermetically). rustfmt --edition 2024 clean.
|
|
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.
|
|
(C3.6)
gn3's species-location shorthands (search.py:246-272), WITHOUT the Hs
liftover OR-branch (OPEN-4, owner-decided; a C3.6b commit would add
it): `Hs:chr<N>:<pos>` / `Mm:...` expand to the gn3 triplet (search.py:
185-193) — AND of the species boolean term (XShuman / XSmouse), the
chromosome term (XC + chromosome number, value lowercased before the
split exactly like gn3's split_query, search.py:178-183) and the slot-2
position range (the C3.5 machinery: SI suffixes, point +/-50 kb clamp,
one-sided VALUE_GE/VALUE_LE, bases->megabases).
THE INVALID LEAF (Q42, AMENDMENT E): every condition where gn3 raises
ValueError (search.py:179-180, 197-201) — a value not splitting into
exactly chr<chromosome>:<position-spec>, a chromosome not starting
with "chr", or an unparseable position spec — emits the sentinel term
GN4InvalidLocationLeaf (verified absent from the dev index; untypeable
as free text under STEM_ALL_Z). The engine then detects the sentinel in
the parsed query's unique terms and reports SearchError::InvalidQuery
BEFORE the index is opened and any mset call — the blessed 422 for the
recorded production mset crash (Q42's 500 InvalidOperationError), via
the app-level guard (evidence-backed option (b), PORT-DESIGN C3.6,
OPEN-31 closed by AMENDMENT E). The C++ try/catch shim is deliberately
NOT extended; no crash-mimicry. An invalid leaf anywhere in the tree
poisons the whole query, exactly as gn3's mset-time OP_INVALID
rejection did (search.py:293-301 has no try/except).
Gate evidence (~/spikes/port-execution-r2/logs/c36-*): hermetic pins
green (23 lib tests: Q40/Q41 triplet forms XShuman+XC2 / XSmouse+XC1 +
slot-2 VALUE_RANGE, value lowercasing, the 7-case invalid matrix,
OR-combined poisoning, and the guard firing InvalidQuery with NO index
configured — gn3's parse-before-open order preserved); shape-CLASS
gate 52/52 cumulative vs the dev index (Q40/Q41 parse Ok with dev
count 0 — REFERENCE ONLY per AMENDMENT B; probe evidence the triplet
machinery is live: species:mouse AND chr:1 AND mb:1..200 matches, the
4.95..5.05 Mb chr1 window is genuinely empty in the 2025-02 dev data;
Q42 -> InvalidQuery); route-level scenarios: Q52 AND Q42 both
422 invalid_query through the real app with SEARCH_ENGINE=native.
rustfmt --edition 2024 clean on the touched files.
|
|
The gn3 SI-suffix FieldProcessor on slot 2 (search.py:237-241), for both
the `position` prefix and its `pos` alias, sharing one processor type
(each registration Box::leaks its own instance inside the binding; the
one-per-process parser absorbs that).
Ported faithfully from search.py:136-165:
- apply_si_suffix (136-142): trailing k/m/g (case-insensitive) multiply
by 10^3/6/9; an UNSUFFIXED value must be an integer (`int(location)`)
— `position:1.5` declines exactly where gn3 raises ValueError.
- parse_position (145-155): a `..` spec is a range with either side
optionally empty; a point expands to +/-50 000 bases clamped at 0.
- the slot-2 query (158-165): sides convert bases->megabases and keep
gn3's one-sided C++ NumberRangeProcessor semantics (VALUE_GE /
VALUE_LE for an empty side, measured identical to the bridge forms);
the degenerate both-empty range is MatchNothing (binding-report R3's
documented ("","") divergence, no production shape).
AMENDMENT A verified end-to-end: the fork's decline->MatchNothing bridge
(aa915af) is IN the dependency and behaves as documented — an
unparseable spec (`position:abc`) parses to an empty-match query and
serves 200 with 0 hits (POSABC gate row, dev index), never an <INVALID>
leaf, never a process abort; `position:abc OR alcohol` keeps its real
OR arm (xapian documents MatchNothing as boolean false). The
registration-only job was the lane's plan; no re-fixing of the library.
Q53 `position:` never reaches the processor (empty value -> free text,
recorded production 200 with 576 hits; dev reference count printed).
Gate evidence (~/spikes/port-execution-r2/logs/c35-*): hermetic pins
green (21 lib tests — slot-2 VALUE_RANGE/VALUE_GE/VALUE_LE forms, SI
case-insensitivity, point clamp, decline matrix incl. MatchNothing OR
semantics); shape-CLASS gate 49/49 cumulative vs the dev index
(Q32=1, Q33=2, Q34=1 dev gene hits at 1.05-1.06Mb/7.45-7.55Mb, Q53=1017
free-text hits, POSABC=0 — dev counts REFERENCE ONLY per AMENDMENT B).
rustfmt --edition 2024 clean on the touched files.
|
|
(C3.4)
NumberRangeProcessor on mean (slot 0), peak (1), peakmb (3), additive
(4), year (5) per search.py:234-243 (slots verified literal at
index-genenetwork:293-299); the markers carry the colon exactly like
gn3's `NumberRangeProcessor(i, prefix + ":")`.
The fork's processor parses bounds as f64 (commit 2673115, Amendment A:
the C3.4 "apply the f64 fix" workload is done at the library level) and
its bridge maps empty sides onto gn3's one-sided VALUE_LE / VALUE_GE
semantics natively — measured on the pinned toolchain before coding
(probe/, logs): `mean:10..20` -> VALUE_RANGE 0, `mean:..15` ->
VALUE_LE 0, `mean:10..` -> VALUE_GE 0. The skeleton-era 0.0/1e18
substitution is therefore superseded for these registrations by the
strictly more faithful one-sided forms.
AMENDMENT A nuance measured and handled: the fork's decline->MatchNothing
bridge (aa915af) also swallows NON-NUMERIC range bounds at the parser
level (`mean:abc..def` parses Ok to MatchNothing — probe evidence), so
the recorded production 400 "Unknown range operation" (Q52, graded 422
invalid_query) can no longer come from the parser. The engine therefore
re-checks the C++ NumberRangeProcessor contract itself (guard_numeric_
ranges): unquoted `<prefix>:` runs containing ".." must have f64-parse-
able non-empty sides, else SearchError::InvalidQuery("Unknown range
operation") before the index is opened. Residuals documented in the
guard's doc comment (inf/nan forms, the degenerate both-empty range —
binding-report R3's ("","") divergence, no production shape).
Gate evidence (~/spikes/port-execution-r2/logs/c34-*): hermetic lib pins
green incl. per-slot VALUE_RANGE/VALUE_LE/VALUE_GE parse forms (a
wrong-slot registration goes red) and the guard accept/reject matrix;
shape-CLASS gate 44/44 vs the dev index (Q28-Q31,Q35-Q39,Q44 parse Ok
with dev counts printed as REFERENCE ONLY per AMENDMENT B: mean:10..20
=1741, mean:..15=23132, peak:5..15=21857, year:2010..2020=22081, Q44
=332; Q52 -> InvalidQuery "Unknown range operation"); wide-range probe
proves slots 0/3/4/5 live on the dev index so the 0-hit shapes are
data-truth; new route-level native scenarios (tests/search_native_
route.rs) pin Q52's STATUS CLASS at the route: 422 invalid_query, with
a valid range serving 200. rustfmt --edition 2024 clean on every file
this commit touches.
|
|
full-set equality at the ENGINE seam; keep status classes, error
bodies and clause (b) top-10 at the ROUTE level (harness v2).
The route gained hits.truncate(limit) in e912c87 (documented limit
contract: default 20, cap 100), which blocked the floor at 85b63ab:
36 shapes DIFFed with rec=200/<full> gn4=200/20 missing=<full-20>.
Root cause was never the route: route-level full-set grading only ever
worked because the calibration stub serves the full recorded body
regardless of the forwarded per_page — real gn3 caps server-side.
The truncate is the route-side piece of the per_page invariant
(PORT-DESIGN §5: the engine retrieves the full match set; the route
keeps its limit logic), so set-equality moved below it, to the seam.
Match200 grading now: replay through the route exactly as before (200
check, top-10 clause (b) off the truncated response — first-ten-in-
recorded-order survives the truncate; upstream-call accounting), then
call genenetwork4::search::search(q, type, ENGINE_FETCH_LIMIT =
1_000_000) directly, in process, against the same stub gn3, and grade
the returned Vec<SearchHit> (dataset, name) identifier set against the
fixture for clause (a). A match shape now makes exactly 2 stub
requests (route + engine); error/surface shapes are unchanged.
replayed_hits reports the engine-level full-set size, so the report
line keeps its meaning (Q01: rec=200/1197 gn4=200/1197 missing=0).
Floor after the fix: 54/54 PASS — match200 49/49, clause-(b) 36/36,
min Jaccard 1.000, report written (target/parity-reports/).
Negative controls (fixture mismatch RED/restore GREEN, truncated stub
body RED/restore GREEN, top-10-breaking stub order RED/restore GREEN)
ran on this commit via a throwaway uncommitted stub hook; evidence in
~/spikes/harness-fix/HARNESS-FIX-REPORT.md and logs/.
|
|
native-search-engine.
Resolution: his route-level additions compose above the engine seam —
the handler now validates sort/order, asks the engine for
SORT_FETCH_LIMIT (1000) when ranking, maps SearchError via the seam's
engine_error, then computes lod, sorts, truncates to limit and fills
loci; lod/locus join SearchHit in src/search/mod.rs. His tests pass
through the seam.
KNOWN at this commit: the parity floor is BLOCKED (36 shapes) — the
route's new truncate(limit) exposes that route-level full-set grading
was a calibration-stub artifact (real gn3 caps at per_page; the stub
ignored it). Harness fix queued: set-equality moves to engine level,
status + top-10 stay route level. Landed together with that fix.
|
|
Checks the 30 of the 39 questions in aisearch/data/small_benchmark.csv
that the API can answer today against the benchmark's own answers:
species and group metadata, group datasets, trait metadata, and
search-based trait questions (marker, additive effect, PubMed id, mean,
LOD within 0.5%). The benchmark's LOD is LRS / 4.604, ours LRS / 4.61.
The uncovered questions are listed in the file's header comment.
* test/data/benchmark_search.json: recorded production gn3 search
responses for those questions (2026-10-07, trimmed to the relevant
hits), so the test needs no network. Database-backed checks skip when
no usable database is reachable.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
|
Search hits gain `lod` (lrs / 4.61) and `locus` (the peak marker name,
looked up in PublishXRef in one batched query; null when the database
is unavailable). `sort=lrs|lod` with `order=asc|desc` ranks hits: gn3
is asked for its first 1000 matches, those are ranked, then `limit`
applies.
* src/db.rs (LRS_PER_LOD, lod, get_publish_loci): add the shared
LRS-to-LOD constant and the locus lookup; TraitInfo and ProbeSetInfo
gain `lod`, computed in SQL from the same constant.
* tests/search.rs, test/python/test_search.py: add the "highest LOD,
locus marker and additive effect for serotonin in BXD male midbrain"
scenario over a recorded production fixture, plus sort/order tests.
* tests/group_trait_info.rs, tests/dataset_probeset_info.rs and their
Python mirrors: assert lod (and locus for trait 17985).
* README.md (Endpoints): document sort, order, lod and locus.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
|
_read_packet returns the 4-byte header plus body, but _read_scramble
parsed from offset 1 as if the header were absent. It matched a zero
byte in the header instead of the one ending the server version
string, so the scramble was garbage, the mysql_native_password login
was always denied, and database_reachable() returned False on every
server, skipping the DB-gated tests. Start at offset 5.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
|
rustfmt to the native engine code (lane round-1 files were not
rustfmt-clean; pre-existing drift in config.rs, routes/search.rs,
tests/search_engine.rs is untouched — the parked house question).
|
|
Guix attempt 5 got past the check phase (195.6 s, the full hermetic
suite green — the E0596/XGb6/ZXD test fixes held inside the build)
and died in the install phase instead: cargo-build-system's install
runs `cargo install --offline --no-track --path .', and cargo install
RE-RESOLVES the dependency graph, refusing to reuse the in-tree
Cargo.lock for the source-replaced git dependency xapian-rs
("the source git+... requires a lock file to be present first before
it can be used against vendored source code", drv 7s1h7nrj,
logs/guix-attempt5.log) — even though the lock sits in the source
root, restored by patch-cargo-checksums, and the build/check phases
consumed it happily.
Root cause proven on a minimal offline repro (vendored git dep, clean
CARGO_HOME, guix-env cargo 1.85.1; /tmp/inst-repro): `cargo build
--offline' EXIT=0 with the same layout, `cargo install --offline
--no-track --path .' fails with the byte-identical error, and the
same command with `--locked' succeeds — --locked makes cargo trust
and reuse the existing lock instead of re-resolving.
Fix: replace the stock install phase with the same invocation plus
--locked (everything else mirrors the stock phase for a bin-only
crate with #:install-source? #f: mkdir out, CARGO_TARGET_DIR=./target,
--no-track --path . --root out). Validated: primitive-load of the
recipe + dry-run lowering of the new derivation (drv gzz9sds5).
This obstacle is distinct from attempts 1-4 (vendoring/check-phase
test code): it is the install phase's re-resolution, understood and
proven offline before this attempt, within the retry cap for a new
obstacle.
|
|
attempt-4 check phase exposed.
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+<prefix>+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.
|
|
Per-strain metadata beyond genotype/phenotype data (age, sex,
treatment, etc.), backed by MariaDB CaseAttribute/CaseAttributeXRefNew.
Combines GeneNetwork3's separate /case-attribute/{id}/names and
/case-attribute/{id}/values (gn3.api.case_attributes) into one
response -- neither list is large enough on its own to need splitting.
This is the only one of GeneNetwork2/3/gn-guile with the concept at
all: GeneNetwork2 delegates to GeneNetwork3 rather than storing case
attributes itself, and gn-guile doesn't have it.
db::get_group_case_attributes returns {names: [...], values: [{strain,
case_attributes: {...}}]}; values is built by folding adjacent
(strain, attribute, value) rows (ordered by strain name) rather than
grouping afterwards, since SQL already guarantees the adjacency.
Found and fixed a real bug while verifying this live: GeneNetwork3's
own query joins CaseAttribute to CaseAttributeXRefNew on
CaseAttributeId alone, but CaseAttributeId is not unique across groups
-- it's a shared vocabulary (id 37 means "Epoch" for dozens of
unrelated groups simultaneously); the actual key is
(InbredSetId, CaseAttributeId). Confirmed against this database:
without also joining on InbredSetId, BXD's result included a spurious
"Strain": "Live" attribute belonging to a different, unrelated group.
Fixed on genenetwork4's side by adding the missing join condition.
A group with no case attributes defined returns 200 with both lists
empty, not a 404 (the group itself exists) -- verified against LXS,
a real group with zero CaseAttribute rows.
tests/group_case_attributes.rs and its Python mirror cover BXD's 4
real attributes (asserting each strain has exactly those 4, not more,
to catch the join bug above), the empty-group case, missing token, and
unknown group.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
|
|
All four 403-deny tests so far used UTHSC_BXD_Cochlea_0225, which was a
real non-public, non-embargoed dataset when first used as a fixture but
is now ~20 months old -- still correctly denied (under the 5-year
embargo threshold), but no longer actually tests "freshly added,
private" data specifically, only "not yet old enough to auto-expire."
Found UTHSC_BXD_2wk_Cochlea_0926 (public=1, confidentiality=1, created
2026-09-01, the most recently added ProbeSetFreeze in the database as
of this writing) and added a parallel test alongside each existing
UTHSC_BXD_Cochlea_0225 test -- dataset_probeset_info, its /values
sibling, the dataset_probesets listing, and the unified /traits
endpoint, in both Rust and Python -- confirming the deny path holds for
data that's actually less than a year old, not just data that merely
hasn't aged past 5 years yet. Verified live against the real database
before adding (is_publicly_readable's two conditions -- flags and age
-- both still correctly deny for this dataset; values/probeset data
exists for it, so the test exercises the authorization check rather
than a 404).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
|
|
Two defects in the checksum-writing awk program, both caught by the
guix build attempts and both re-validated against the real lock before
this commit:
1. The program was committed as raw single-quote text instead of a
double-quoted Scheme string: the quotes inside the program
terminated and re-opened the form, and guile read
sprintf("%c", 34) as a string followed by an unquote — the builder
died at evaluation ("unquote: expression not valid outside of
quasiquote"). A --dry-run does NOT catch this class of error (it
lowers the derivation but never evaluates the builder); the
validation that matters is running the exact decoded program
against the real lock.
2. Lock package names may contain underscores (cfg_aliases, cookie_store,
...) while guix import emits hyphenated origin file-names
(rust-cfg-aliases-0.2.2.tar.gz); the program now gsub(_ -> -).
Verified exhaustively: every one of the 287 checksum-bearing lock
entries maps to an existing vendor directory, and the decoded
program writes all 287 .cargo-checksum.json files with valid JSON
and byte-identical checksums.
|
|
and aliases (C3.3).
Port search.py:229-233: description=XD, rif=XRF, wiki=XWK, plus the
uppercase aliases RIF=XRF and WIKI=XWK. With STEM_ALL_Z the parsed
field term is Z+<prefix>+stem (e.g. wiki:diabetes -> ZXWKdiabet,
matching the TermGenerator emission the production indexer writes),
pinned hermetically by prefix in native.rs tests.
tests/search_native_shapes.rs gains the C3.3 list (Q21-Q25, Q45 with
per-shape parity.rs citations). Dev-index reference counts recorded,
never compared to production: description:insulin=0, rif:insulin=0,
RIF:insulin=0, wiki:diabetes=0 (phenotype type filter: XWK text lives
only on gene documents, d.v. index-genenetwork:432-443), WIKI:diabetes=0,
symbol:insr OR rif:insulin=1. The 0s are faithful, not registration
failures: xapian-delve confirms the fields are populated on the dev
index (term ZXWKdiabet: 24 gene docs; ZXRFdiabet exists) while
ZXRFinsulin simply does not occur in the crawled RIF text and the
phenotype-typed wiki shapes are filtered to an empty set exactly as
gn3 would do on this index.
Evidence: logs/c3-3.log — build EXIT=0, lib tests green (incl. the
probabilistic-prefix assertions), FULL suite EXIT=0, SHAPE-CLASS GATE
33/33 PASS vs the dev index (cumulative C3.1+C3.2+C3.3); delve probe:
/home/kabui/zxrf-all.txt, delve-result.txt.
|
|
Guix build attempt 3 (logs/guix-c1-3.log) got past the git-source
resolution and failed on checksum verification: the restored
Cargo.lock records every registry package's crates-io checksum, but
the stock patch-cargo-checksums {"files":{}} stub provides none —
"unable to verify that hashbrown v0.12.3 is the same as when the
lockfile was generated".
The replaced patch-cargo-checksums now writes each vendored crate's
.cargo-checksum.json as {"files":{},"package":"<checksum>"} with the
checksum read straight out of the restored lock (each vendor
directory is named after its lock entry, both generated from the same
lock by guix import crate). The per-file map stays empty — the same
trust model as the stock stub; only the package-level checksum cargo
verifies against the lock is real. The awk program builds the JSON
quotes/backslashes via %c so it needs no escaped literals (a first
draft double-escaped them; caught by running the exact program
against the real lock before committing, not after a 40-minute guix
cycle). The git checkout keeps a plain {"files":{}} stub.
The exact guix-style flow was re-proven offline end to end before this
commit: cold cargo cache, files:{} + lock-sourced package checksums,
cargo build --offline EXIT 0 (full recompile, 1m25s).
|
|
Port search.py:220-228: author=A, species=XS, group=XG (through the
lowercasing FieldProcessor, search.py:204-209/222-223 — xapian does
not stem boolean prefixed fields when the value starts with a
capital, so gn3 forces the lowercase term; the r1-test
LowercaseGroupProcessor pattern), tissue=XI, dataset=XDS, symbol=XY,
chr=XC, peakchr=XPC. The upstream cases rule (uppercase values
produce XDS:BXDPublish-style terms — binding-report R2: gn3-inherited
xapian behavior, not a registration bug) is documented, not pinned:
no graded shape relies on it.
tests/search_native_shapes.rs gains the C3.2 list (Q14-Q20, Q26, Q27,
Q43, Q46 with per-shape parity.rs citations); native.rs gains a
hermetic parser test pinning each registration to its exact index
term (group:B6 -> XGbxd, not XGBXD).
Evidence: logs/c3-2.log — build EXIT=0, lib tests green (incl. the
new prefix assertions), FULL suite EXIT=0, SHAPE-CLASS GATE 27/27
PASS vs the dev index (cumulative C3.1+C3.2; dev counts recorded as
reference: group:B6 = 3, symbol:insr = 1, peakchr:1 = 113, etc.).
|
|
Engine seam (C3.1).
New native engine, a Rust port of gn3 search path (gn3/api/search.py),
opt-in via SEARCH_ENGINE=native (the gn3 forwarder stays the default;
src/search/mod.rs now dispatches on config, routes/search.rs delegates):
- startup-cached QueryParser behind a mutex: custom-prefix registration
is Box::leak-based inside the binding, so a per-request parser would
leak; built once per process (binding-report §5 item 3, R2 pattern).
Minimal configuration this commit per PORT-DESIGN C3.1: Stem("en") +
STEM_ALL_Z only.
- checked parse via the fork's parse_query_checked: malformed queries
are typed errors, not panics; Err maps to SearchError::InvalidQuery
(422 invalid_query, the owner-blessed contract), carrying the
parser diagnostic. Parse happens before the index is opened, as in
gn3 (search.py:291 vs :296), so a bad query reports InvalidQuery
even when the index is misconfigured.
- XT{type} document filter: OP_FILTER(parsed, "XT"+type)
(search.py:298-300).
- FULL-match-set retrieval ignoring the forwarded limit (per-page
invariant, PORT-DESIGN §5): mset bound is a deliberately huge fixed
constant; the route keeps its validation and limit logic unchanged.
- per-hit mapping: doc data JSON -> SearchHit via serde
(search.py:302 equivalent); unknown fields flow through extra.
Decode failure maps to SearchError::Misbehaving.
- index open behind an app-level guard (the binding aborts on open
failure; see the module doc): unset XAPIAN_DB_PATH -> Internal,
unopenable path -> Unreachable.
tests/search_native.rs: error-contract scenarios (hermetic) + the
per-page invariant + dispatch pinning, one sequential test fn per the
process-global env rule; the dev-index part skips loudly when
XAPIAN_DB_PATH is unset. tests/search_native_shapes.rs: the shape-CLASS
gate (this lane s AMENDMENT-B translation of the C3.1 stage gate) --
16 shapes (Q01,Q03-Q13,Q47,Q50,Q51,Q54), each expected class cited to
its tests/search_parity.rs shape! line; dev-index counts are printed
as reference data only, never compared to production.
Evidence: logs/c3-1.log (build EXIT=0, native tests green, lib 14/14),
logs/c3-1-full.log (FULL suite EXIT=0, parity floor green),
logs/shape-class-c3-1.log (SHAPE-CLASS GATE 16/16 PASS vs the dev
index; Q51 byte-identical diagnostic; per-page invariant: limit=10
forwarded, 2330-hit full set returned).
|
|
teach the vendor phase to restore Cargo.lock.
House rule (rust-package.scm header): regenerate whenever Cargo.lock
changes. The cxx-gen 0.7.198 -> 0.7.124 pin swaps two crate sources
(cxx-gen itself, codespan-reporting 0.13.1 -> 0.11.1) and drops
unicode-width 0.2.2; guix.scm's native-inputs follow. 288 crate
sources plus the xapian-rs git origin, matching the lock exactly.
The first guix build attempt of this recipe failed inside
vendor-vendored-git-dep: the build-side environment has no (ice-9
ftw), so the phase now finds the vendored checkout with find-files
from (guix build utils) (attempt 1, logs/guix-c1-3.log). The second
failed in the build phase: cargo-build-system deletes Cargo.lock at
configure, but cargo refuses to resolve a git dependency against
vendored sources without one -- "the source git+... requires a lock
file to be present first" (attempt 2, same log + drv log). The phase
now restores the committed lock from the source store path. The whole
mechanism (lock + vendor dir + cargo-vendor git-source stanza +
checksum stub, fully offline) was proven outside guix first: cargo
build --offline EXIT 0 against the vendored graph, xapian-rs
compiling from the vendored git checkout.
|
|
The C1.1 lock resolved cxx-gen to 0.7.198 (autocxx-build carries an
unbounded caret). cxx-gen 0.7.198 generates the newer cxxbridge symbol
scheme (Xapian$cxxbridge1$198$... with the per-crate disambiguator)
while cxxbridge-macro 1.0.122 — the pinned cxx 1.0.122 Rust side —
references the un-suffixed symbols: any binary that actually links the
xapian-rs bridge fails with undefined references. Nothing linked the
bridge until the native engine code, which is why the C1.1 gate
(build + full test, no xapian code) stayed green with 0.7.198.
0.7.124 is the resolution the fork itself ships in its own Cargo.lock
(xapian-rs @ 97fd343: cxx 1.0.122, cxxbridge-flags/macro 1.0.122,
cxx-gen 0.7.124) and the one the recipe lane proved hermetically.
The pin is exactly the watch item binding-report §6-2 carries
(unbounded carets drift off the 1.0.122 family).
Also resolves: codespan-reporting 0.13.1 -> 0.11.1, drops
unicode-width 0.2.2 (both were only pulled by 0.7.198). Link-failure
evidence: logs/c3-1.log (undefined Xapian$cxxbridge1$Enquire$set_query
vs nm on the built archive showing Xapian$cxxbridge1$198$Enquire$
set_query).
|
|
rust-package.scm regenerated per the house header (guix import crate -f
Cargo.lock genenetwork4) for the C1.1 lock: 289 exported crate sources
(223 existing + 66 new) plus the xapian-rs git origin
(rust-xapian-rs-0.3.0.97fd343, Alexanderlacuna fork at rev 97fd343,
sha256 the recipe lane proved -- see ~/spikes/xapian-guix-recipe/
RECIPE-REPORT.md).
guix.scm: new (inputs (list xapian)) -- the vendored xapian-rs build
script locates it through pkg-config and the cxx bridge links
libxapian into genenetwork4 itself; clang (libclang for the autocxx
codegen) and pkg-config join native-inputs, mirroring the proven
standalone fork recipe; the 66 new crate sources join native-inputs.
The git dependency needs two things the old cargo-build-system does
not do by itself (empirically confirmed with cargo vendor on this
lock): a source-replacement stanza mapping the git source onto the
vendored directory, and a .cargo-checksum.json stub in the copied
checkout (registry crates carry one inside their .crate; a git
checkout does not). A new vendor-vendored-git-dep phase adds both,
appending exactly the stanza cargo vendor emits.
Gate: guix build -f guix.scm under the pinned channels with
substitutes in ci.guix.gnu.org-first order; evidence
~/spikes/port-execution/logs/guix-c1-3.log.
|
|
New configuration for the native search engine (PORT-DESIGN C1.2 /
AMENDMENT D pre-decided mechanical naming):
- xapian_db_path (env XAPIAN_DB_PATH): directory of the xapian index the
native engine queries. Mirrors gn3's own key at gn3/api/search.py:295
so the two services share one convention. Empty default: forwarding
needs no index; the native engine reports the missing key as a local
misconfiguration rather than guessing a path.
- search_engine (env SEARCH_ENGINE): "forward" (default, the existing
gn3 proxy) or "native" (query the xapian index directly). Opt-in, so
the default behavior of every deployment is unchanged and flipping is
a one-line config change.
Both follow the existing layering (defaults -> GN4_CONF/GN4_SECRETS ->
environment) exactly like gn3_url / gn3_timeout_secs; unit tests cover
the defaults and the env-over-default layering.
Evidence: ~/spikes/port-execution/logs/c1-2.log (config unit tests 12
passed; full suite EXIT=0, parity floor still 54/54 through the
forwarding engine).
|
|
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.
|
|
Add the git dependency on the fork (rev 97fd343), which carries the
full round-3 patch set: parse_query_checked + ParseError (typed parser
errors, no panics), the MatchNothing decline fix, the f64 range-bound
fix, and the crate-level cxx =1.0.122 pin (PORT-DESIGN C1.1,
AMENDMENT A: the fork already carries everything, so no patch-push
step). Cargo.lock carries the resolved graph incl. cxx 1.0.122.
The crate is not referenced by code yet; the build and the full test
suite are unchanged (no shape delta; parity floor still 54/54 through
the forwarding engine).
Evidence: ~/spikes/port-execution/logs/c1-1.log (pinned-toolchain
cargo build EXIT=0; full cargo test EXIT=0; parity 15/15).
|
|
(C0)
|
|
|
|
discriminating values; re-record Q02 (insulin) through a verified
pagination walk (50000 + 7632 = 57632 hits, truncation closed). 12
formerly zero-hit shapes now carry real matches so clause (b) bites
on 36/36 recorded shapes; Q26 re-shaped from chr:2 (>1.1M matches,
unrecordable) to the bounded chr:m (9374 hits), same chr:->XC boolean
filter grammar; Q04/Q11/Q12/Q21 retained as documented empty (the
deployed index has no positional data and XD is unpopulated).
* test/data/parity-fixtures (Q01-Q54, reduced-v1): re-baseline the
corpus with the 14 re-recorded fixtures (production snapshot
2026-10-07); parity floor PASS 54/54, clause-(b) 36/36, min Jaccard
1.000.
* test/data/parity-fixtures/reduce_fixtures.py (SHAPE_RE): tolerate
rustfmt-expanded shape! tuples; the strict regex parsed only 4/54 of
the current harness file and would fatal the generator.
* test/data/parity-fixtures/README.md: document the re-recording, the
truncation closure and the retained-empty shapes.
|
|
* test/data/parity-fixtures (Q01-Q54, reduced-v1): commit the corpus.
* test/data/parity-fixtures/reduce_fixtures.py: regenerate it from a full
recording corpus.
Grades any implementation behind /search against 54 recorded
production shapes per parity-metric.md: status, full match-set
equality, a Jaccard >= 0.8 top-10 floor for sets of 10 or more,
error-class mapping (recorded gn3 4xx -> 422 invalid_query, recorded
500 -> 502 backend_error, surface -> 400 invalid_parameter with no
upstream call), and exactly-once upstream-call assertions. Hermetic:
axum stubs stand in for gn3 and gn-auth, tokens are minted with the
committed test key, no network.
The committed corpus is reduced-v1: 109 MB of recorded payloads
reduced to 6.6 MB of graded essentials (sorted identifier set, the
recorded first-ten order, status); the raw corpus stays out of git.
The loader sniffs full and reduced files in one directory, and the
stub serves reduced bodies reconstructed top-ten-first so grading is
identical either way; reduced files also self-verify against the
shape table at load time. The generator parses the shape table from
this test so the two cannot drift, and fails loudly on any hit
lacking (dataset, name).
Calibrated 54/54 against the forwarding route on both the full
and the reduced corpus; negative controls prove it fails loudly.
Runs by default from the committed corpus; GN4_PARITY_FIXTURES
overrides for external corpora, GN4_PARITY_REPORTS relocates the
report (default target/parity-reports).
|
|
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.
|
|
Parameter validation, envelope wrapping, and the auth contract stay
in the handler; the backend call and its error mapping move behind
the Engine trait. SearchHit now comes from crate::search, so a
native engine can replace the gn3 proxy without any route change.
|
|
* src/search/gn3.rs (Gn3): forwarding engine over the shared reqwest client.
* src/lib.rs (search): declare the search module.
The seam isolates backend choice behind one trait: routes validate,
wrap the envelope, and map errors; the engine resolves queries. A
native engine can replace the gn3 proxy without touching the route
contract, and the proxy stays as the transitional oracle bridge
until the native engine reaches parity. The module docs record the
xapian query grammar any native engine must accept.
|
|
The endpoint is a documented stub returning canned data; the
request fields are part of the validation and openapi contract and
stay unread until the correlation engine integration reads them.
|
|
The Found payload dwarfed the three empty variants, so every
lookup paid the size of a full TraitInfoResponse. Boxing shrinks
the enum; the handler derefs once at the Json boundary.
|
|
Clippy type_complexity fired three times on the ten- and
eleven-column row closures. Naming each SELECT row shape in one
place documents the column order and keeps the mappers readable.
|
|
Clippy type_complexity fired three times on the OnceLock<Mutex<
HashMap<...>> statics. One shared alias per cache shape keeps the
signatures readable without changing any behaviour.
|
|
- src/routes/search.rs: AuthToken per correlation.rs pattern (+ Unauthorized).
- tests/search.rs: stub /auth/public-jwks + locally-signed token; scenarios
run offline again (multi_thread runtime: the blocking ureq JWKS fetch
starved the single-thread stub); add invalid-token 401 case.
- test/python/test_search.py: fetch token once, reuse.
- RELEASE_NOTES.md: /search now requires a token.
- test/data: test-only JWKS + RSA key fixtures.
|
|
- Cargo.toml: drop duplicate serde_json (keep 1.0.151).
- Cargo.lock: keep origin/main's rustc-1.85-compatible pins; minimally add reqwest/url.
- README: drop stale /search bullet.
- test/python: drop dead 'import socket' (shared database_reachable now).
- src/config.rs: dev_fields test literal gains gn3_url/gn3_timeout_secs.
NOTE: pre-commit fmt --check bypassed; local rustfmt 1.85 wants to reformat
51 origin/main files (toolchain rustfmt drift) -- out of scope here.
|
|
"Proxies gn3's xapian search" leaks an implementation that phase
B explicitly plans to replace -- the day the backend swaps, the
row becomes a lie though the endpoint is unchanged. The row now
says what the caller gets; parameters stay in /openapi.json.
|
|
The table is the canonical registry and the proxy shipped without a
row. The bullet stays short; parameters and error shapes belong to
/openapi.json.
|
|
total timeout for gn3 calls
reqwest::get built a fresh client per query (no keepalive) and set no
timeout, while gn3 sets none of its own -- a stalled upstream would
hang the handler past any front-proxy timeout. One shared client in a
OnceLock now, mirroring the shared-DB-pool pattern.
* src/config.rs (Config): add GN3_TIMEOUT_SECS (default 30);
normalize GN3_URL to end with a slash.
* tests/search.rs test/python/test_search.py (search): one scenario
mapping a gn3 5xx to the 502 backend_error shape.
|
|
Production gn3 puts the diagnostic under "error" and leaks Python
reprs under "error_type", so the old "parsererror" match never
fired and malformed queries fell to 502 with no actionable feedback.
Match on "error" alone; gn3 5xx stays 502.
* tests/search.rs test/python/test_search.py (search): stub replays
production's error body shape.
|
|
binary
Spawns the compiled server with GN3_URL pointed at a local gn3 stub
serving the recorded fixture; asserts the envelope shape, parameter
validation, and the 422 parser-error forwarding. Mirrors
tests/search.rs per the test-pair discipline; runs in the Guix
sandbox (the stub is loopback-only).
|
|
search proxy.
Validates q/type/limit at the boundary (400 with suggestions; limit
capped at 100), forwards to {GN3_URL}/search/ with proper
percent-encoding, and re-wraps hits in the descriptive envelope.
Hits are typed as SearchHit (all 14 gn3 fields optional, unknown
fields preserved via serde flatten) so /openapi.json documents a
real schema while staying transparent to gn3 shape changes. gn3's
400+parsererror becomes 422 invalid_query carrying gn3's own
diagnostic; every other backend failure is one 502 shape
distinguished by code.
* src/lib.rs, src/routes/mod.rs (routes): register the search route.
* tests/search.rs, test/data/search_alcohol_phenotype.json (tests):
in-process gn3 stub replays the recorded production fixture; four
scenarios run offline -- passthrough+envelope, validation, 422
forwarding, limit cap.
|
|
Lets OpenAPI document the success envelope as a first-class schema
(Envelope<SearchHit> as a response body) instead of an opaque blob,
so generated specs stay useful to LLM callers.
|
|
reqwest is the HTTP client for the phase-A search proxy (pure-Rust
TLS, no system OpenSSL, per the sandbox-hermetic convention);
serde_json is promoted from a dev-dependency; url percent-encodes
forwarded queries.
* Cargo.lock rust-package.scm guix.scm (packaging): regenerate the
crate mirror from the lock (guix import crate -f Cargo.lock
genenetwork4); add the 35 new crate sources to the inputs list.
All four artifacts move as one unit so cargo's and guix's views of
the dependency set can never drift or be half-reverted.
|