about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)Author
2026-10-07Merge origin/main (e912c87: /search gains lod, locus, sort/order) intoAlexander_Kabui
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.
2026-10-07* tests/benchmark.rs: add the answerable small_benchmark.csv questions.Pjotr
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>
2026-10-07* src/routes/search.rs (search): add lod, locus, and sort/order.Pjotr
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>
2026-10-07src/search/native.rs, src/search/mod.rs, tests/search_native*.rs: applyAlexander_Kabui
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).
2026-10-07Add GET /groups/{group}/case-attributesPjotr Prins
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
2026-10-07Add tests for denying a genuinely <1-year-old non-public datasetPjotr Prins
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
2026-10-07src/search/native.rs (native engine): register the probabilistic prefixes ↵Alexander_Kabui
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.
2026-10-07src/search/native.rs (native engine): register the boolean prefixes (C3.2).Alexander_Kabui
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.).
2026-10-07src/search/native.rs (native engine): port the xapian query path behind the ↵Alexander_Kabui
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).
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-07Merge branch 'parity-harness': 54-shape parity harness + re-baselined corpus ↵Alexander_Kabui
(C0)
2026-10-07tests/search_parity.rs (search parity): re-shape 13 weak shapes toAlexander_Kabui
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.
2026-10-07* tests/search_parity.rs (search parity): add the 54-shape harness.Alexander_Kabui
* 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).
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.
2026-10-05search: require a token; restore hermetic /search coverageAlexander_Kabui
- 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.
2026-10-05* src/routes/search.rs (search): share one reqwest client with aAlexander_Kabui
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.
2026-10-05* src/routes/search.rs (search): map any gn3 4xx with an error body to 422Alexander_Kabui
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.
2026-10-05* src/routes/search.rs (search): add GET /search, the phase-A gn3Alexander_Kabui
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.
2026-10-05Rename /dev/token to /get-test-token; require a token everywherePjotr Prins
Rename: POST /dev/token -> POST /get-test-token (src/routes/dev.rs, TestToken replacing DevToken), matching tests/get_test_token.rs and test/python/test_get_test_token.py (renamed from tests/dev_token.rs/test_dev_token.py). Config::dev_token_enabled() and the GN_AUTH_DEV_* config keys keep their names -- they're about the dev-token feature generically, not tied to this one route's path. Every endpoint now requires a valid token, not just the dataset_probeset*/traits* family: species(_by_name/_datasets), groups(_by_name/_strains/_traits*/_datasets) and dataset_by_name all gain an AuthToken parameter. /, /version, /openapi.json and /get-test-token itself are the only exceptions -- a health check, a version check, the spec describing all this, and the endpoint that hands out a token in the first place (which would be circular if it needed one). Rather than repeating security(("bearer_token" = [])) on every #[utoipa::path], ApiDoc now declares it once as the document's default security(...), and the three exceptions besides /get-test-token (/, /version) override it with their own empty security() -- standard OpenAPI semantics (an operation's own security, even empty, overrides the document default; an absent one inherits it). error::Unauthorized, a new #[derive(utoipa::IntoResponses)] type wrapping ApiError, is the shared 401 every gated handler now references bare in its own responses(...) list instead of writing out the same (status = 401, description = "...", body = ApiError) tuple by hand. Verified the resolved security per operation in a live /openapi.json. tests/common::auth_token() (Rust) and the new test/python/auth_helpers.auth_token() (Python, deduplicating what four files previously each defined locally) now try this server's own POST /get-test-token first, falling back to GN4_TEST_AUTH_TOKEN -- every previously-ungated test file gains a token check and switches to get_with_token; the whole suite, both languages, now runs with zero manually-provisioned tokens given GENENETWORK4_DEV_MODE=true GENENETWORK4_BIND=127.0.0.1 for the test run. ServerTestCase gains EXTRA_ENV so each Python test class can start its own server with dev mode on. Verified both configured (auto-fetch) and unconfigured (GN4_TEST_AUTH_TOKEN fallback, and full skip when neither is set, e.g. the Guix build sandbox) paths. README.md, docs/gn-auth.md and RELEASE_NOTES.md updated throughout for the rename and the new blanket token requirement. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
2026-10-05Add POST /dev/token, a dev-only gn-auth token issuerPjotr Prins
Calls gn-auth's own password grant (POST /auth/token) for gn-auth's well-known development user and returns the result, so local testing no longer needs a manual curl/gn-auth round trip of its own. Only ever registered -- not just rejected at request time, genuinely absent from the router and from /openapi.json -- when two new Config fields are both set: dev_mode (GENENETWORK4_DEV_MODE) and a loopback bind (GENENETWORK4_BIND, also new). Both are config, not something genenetwork4 infers from its actual network exposure, by design: dev mode alone, or a loopback bind alone, each leave it disabled, and the check (Config::dev_token_enabled) is a plain function so the condition itself has direct unit test coverage rather than only being exercised indirectly through the route. src/main.rs now binds to config.bind instead of a hardcoded "0.0.0.0", via a proper SocketAddr rather than string formatting -- the latter would mishandle an IPv6 bind address like "::1" (needs brackets). GN_AUTH_DEV_CLIENT_ID/_CLIENT_SECRET/_USERNAME/_PASSWORD default to gn-auth's own published dev fixtures (flask init-dev-clients, gn_auth/wsgi.py), so this works unconfigured against an unmodified dev gn-auth instance -- confirmed live, including using the returned token against a real gated endpoint (/traits/BXD/10001), not just checking the token response's shape. tests/dev_token.rs covers all four combinations of the two settings in one sequential test function (mutating the same two env vars from more than one #[tokio::test] in a file would race, since they run concurrently by default) plus the /openapi.json visibility check. test/python/test_dev_token.py mirrors this using separate test classes instead, which is safe here since each spawns its own server subprocess with its own environment (ServerTestCase gains EXTRA_ENV for this). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
2026-10-04Add GET /traits/{dataset}/... spanning ProbeSet and Publish dataPjotr Prins
A new, additional endpoint family that addresses both trait categories the same way -- (dataset, trait) -- matching GeneNetwork2's own generic wqflask.api.router.trait_sample_data/get_trait_info, rather than the two category-specific shapes genenetwork4 already has (/datasets/{dataset}/probesets... and /groups/{group}/traits...), which are unchanged and keep working exactly as before. - db::resolve_trait_dataset(name) resolves a dataset name against ProbeSetFreeze first, then the new db::PublishDataset (a PublishFreeze row, via the new get_publish_freeze_by_name) -- whichever matches decides the category. This means only dataset names are ever "guessed" across categories, not trait names/ids, which is the much smaller and safer surface: GN2's own equivalent tries ProbeSet.Name and PublishXRef.Id against the same bare trait string and silently falls back, which can return the wrong trait on a same-named collision. get_publish_freeze_by_name accepts a PublishFreeze's own Name/ShortName/Id or its owning group's Name/InbredSetName/FullName/ Id, mirroring GN2's own flexible matching (e.g. "BXDPublish" or "BXD"). - GET /traits/{dataset}: list every trait in a dataset, tagged by category. - GET /traits/{dataset}/{trait}: one trait's metadata. A non-numeric trait against a Publish dataset is a 404 (can't match a PublishXRef.Id), not a 500. - GET /traits/{dataset}/{trait}/values: that trait's per-strain values. TraitValue and ProbeSetValue are already identical in shape, so this unifies with no information loss, unlike the metadata endpoint above. Metadata responses are a tagged union ({"category": "probeset"| "publish", ...}) wrapping ProbeSetInfo/TraitInfo unchanged, rather than a lossy common-fields schema -- the two share little beyond mean/locus/lrs/additive. utoipa generates this as a oneOf with a category discriminator, verified against /openapi.json. Gated the same way as /datasets/{dataset}/probesets..., extended to Publish data for the first time: /groups/{group}/traits itself is still not gated, but reaching the same data through /traits/{group} now requires a token and checks PublishFreeze.public/confidentiality. No gn-auth-side change was needed -- POST /auth/data/authorisation already dispatches *Publish-suffixed dataset names to its phenotype resource resolver (gn_auth/auth/authorisation/data/phenotypes.py), the exact mechanism this integration already relies on for mRNA data. auth::VIEW_RESOURCE_PRIVILEGE moves from routes::datasets (private) to routes::auth (pub) so routes::traits can reuse it instead of duplicating the string. tests/traits.rs and its Python mirror cover both categories (including both ways of addressing a Publish dataset), the 401/403/404 cases, and the non-numeric-trait-against-Publish-dataset edge case, run against a real gn-auth instance. The Publish branch's deny path itself is only exercised via gn-auth's "unlinked dataset" fallback (already proven for ProbeSet) -- no non-public PublishFreeze exists in the database this was tested against. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
2026-10-04Add GET /species/{species}/datasetsPjotr Prins
Lists the expression (ProbeSet) datasets belonging to a species, across all of its groups -- the species-scoped equivalent of /groups/{group}/datasets (db::get_species_datasets joins ProbeSetFreeze through ProbeFreeze and InbredSet to InbredSet.SpeciesId, reusing the existing Dataset struct). GeneNetwork2's own species-scoped variant of wqflask.api.router.get_datasets_for_group still requires a group name (species only disambiguates it); this doesn't. Not gated on gn-auth, matching its /groups/{group}/datasets sibling: this returns dataset metadata (names, public/confidentiality flags), not trait data, unlike the /datasets/{dataset}/probesets family. tests/species_datasets.rs and its Python mirror cover the mouse-group and unknown-species cases. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
2026-10-04Add GET /groups/{group}/traits and GET /datasets/{dataset}/probesetsPjotr Prins
List endpoints for the two trait domains, each the listing equivalent of an existing singular endpoint: - GET /groups/{group}/traits: every published (phenotype) trait in a group (db::get_group_traits), same fields/join as /groups/{group}/traits/{trait_id}, no token required -- matching its singular sibling, which isn't gated either. A large group (BXD has 15000+ phenotype traits) can take several seconds and tens of megabytes to return in full; no pagination yet, matching GeneNetwork2's own wqflask.api.router.fetch_traits, which has no default limit either. - GET /datasets/{dataset}/probesets: every expression (ProbeSet) trait in a dataset (db::get_dataset_probesets), same fields/join as /datasets/{dataset}/probesets/{probeset}. Gated the same way as that singular endpoint -- a valid token is required unconditionally, and a non-public dataset is checked against gn-auth once for the whole dataset via a new auth::authorise_dataset, rather than once per probeset in the list. Leaving this listing ungated would have let a caller read out a whole non-public dataset's trait data in one request, bypassing the gate just added to the singular endpoint. auth::authorise_dataset wraps authorise_trait with an empty trait name: gn-auth resolves a trait's resource purely from its dataset name, so the trait half of a "Dataset::Trait" string never affects which privileges come back. Verified directly against the live instance both for an unlinked non-public dataset (403, deny) and folded into dataset_probesets's own test for the public/embargo-aged bypass path. tests/group_traits.rs, tests/dataset_probesets.rs and their Python mirrors cover both, run against a real gn-auth instance for the gated one. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
2026-10-04Gate GET /datasets/{dataset}/probesets/{probeset}/values on gn-authPjotr Prins
Same treatment as dataset_probeset_info: require a valid AuthToken unconditionally, and for a dataset that isn't publicly readable, check group:resource:view-resource via authorise_trait -- denied is a 403, gn-auth unreachable is a 502. Unify DatasetProbesetLookup/DatasetProbesetInfoLookup back into one generic enum (with the new Forbidden variant) now that both dataset_probeset_info and dataset_probeset_values need it, rather than keeping two near-identical enums. tests/dataset_probeset_values.rs and its Python mirror gain the same 401/403 cases as dataset_probeset_info's, run against a real gn-auth instance; the 403 case reuses UTHSC_BXD_Cochlea_0225, confirmed to have both ProbeSet metadata and ProbeSetData values rows so the test exercises the authorization check rather than ProbesetNotFound. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
2026-10-04Gate GET /datasets/{dataset}/probesets/{probeset} on gn-authPjotr Prins
Require a valid gn-auth bearer token on this endpoint unconditionally. For a dataset that isn't publicly readable, check the group:resource:view-resource privilege via a new auth::authorise_trait, the "Dataset::Trait"-keyed equivalent of authorise (POST /auth/data/authorisation instead of /auth/resource/authorisation) -- gn-auth resolves the resource itself from the dataset name, so no separate resource-id lookup is needed here. A trait never linked to a gn-auth resource (gn-auth answers 404) is treated as "no privileges", not a request failure. Denied requests get a 403; a failure to reach/parse gn-auth's answer gets a 502, distinct from both that and this service's own 500s. is_publicly_readable now also takes the dataset's CreateTime and treats anything older than 5 years as public regardless of its public/confidentiality flags -- a confidentiality embargo isn't meant to last forever. No admin/sysadmin bypass is implemented. Register a "bearer_token" OpenAPI security scheme (src/lib.rs) so the new security(...) annotation on this endpoint's #[utoipa::path] has something to point at. tests/dataset_probeset_info.rs and its Python mirror gain cases for the missing-token (401) and denied-but-existing (403) outcomes, run against a real gn-auth instance set up as described in docs/gn-auth.md; the 403 case uses UTHSC_BXD_Cochlea_0225, a real non-public, non-embargoed dataset never linked into gn-auth. tests/common gains get_with_token and auth_server_available/auth_token helpers for this. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
2026-10-04Add token verification and gn-auth resource authorization.Pjotr Prins
* Cargo.toml (jsonwebtoken, ureq): New dependencies, RS256 JWT verification and gn-auth's HTTP API respectively. ureq pulls in ring for RSA verification, needing a C compiler at build time -- already provided by cargo-build-system's standard inputs, nothing added to guix.scm for it. Promote serde_json from dev-dependencies to dependencies; src/auth.rs needs it outside tests now. (mysql-common-derive, simple_asn1, time): Pin to the newest versions still compatible with the Guix-packaged rustc 1.85.1 (same trap as before: ureq's dependency chain pulls darling 0.23/time 0.3.46+, both needing rustc 1.88). * rust-package.scm: Regenerate with `guix import crate -f Cargo.lock genenetwork4`. * guix.scm (genenetwork4-git)[native-inputs]: Update crate list to match. * src/auth.rs (AuthToken): New extractor. Verifies a bearer token's RS256 signature and standard time claims (exp/nbf, checked only when present -- gn-auth's own validator treats them as optional too) against gn-auth's JWKS, cached and refreshed periodically (OnceLock<Mutex<HashMap<...>>>, same shape as db::pool()) rather than fetched per request. (is_publicly_readable): New function. Matches GeneNetwork2's own threshold (public > 0 AND confidentiality < 1, used throughout wqflask/api/router.py) for whether a dataset needs an authorization check at all; InbredSet/group rows carry a public column too, but GN2 never filters on it, so groups/species endpoints need no gating. (authorise): New function. Wraps gn-auth's POST /auth/resource/authorisation, caching the per-(user, resource) answer briefly (AUTHORISATION_TTL) so repeated requests for the same resource by the same user don't each cost a round trip. Not yet called from any route -- see RELEASE_NOTES.md. * src/config.rs (Config)[auth_server_url]: New field, AUTH_SERVER_URL config key, matching GeneNetwork3's own key of the same name. * src/error.rs (ApiError): Derive Debug; needed by tests/auth.rs's .unwrap() on a Result<_, ApiError>, and every error type should implement it regardless. * src/lib.rs: Register the new auth module. * tests/auth.rs: New file. Runs AuthToken verification and authorise() (including its cache) against a real gn-auth instance; set GN4_TEST_AUTH_TOKEN/GN4_TEST_RESOURCE_ID (see docs/gn-auth.md), skips otherwise. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
2026-10-04Format with cargo fmt, matching 924bcf3's project-wide pass.Pjotr Prins
* src/db.rs, src/routes/groups.rs, tests/dataset_by_name.rs, tests/group_by_name.rs, tests/group_trait_info.rs: Run cargo fmt. No behavior change -- this code was written before the project adopted cargo fmt formatting in 924bcf3 and landed unformatted during the rebase that merged the two histories. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
2026-10-04Add ProbeSetXRef endpoints: datasets, probesets, probeset values.Pjotr Prins
The expression (ProbeSet) counterpart to the PublishXRef endpoints: ProbeSetXRef has no single Id column of its own (its primary key is DataId; the natural key is the pair (ProbeSetFreezeId, ProbeSetId)), so a trait here is addressed by dataset name plus ProbeSet.Name instead of a single numeric trait id. * src/db.rs (Dataset): New struct, one ProbeSetFreeze row. (get_group_datasets): New function. Joins ProbeSetFreeze and ProbeFreeze by group Id, matching GeneNetwork2's wqflask.api.router.get_datasets_for_group. (get_dataset_by_name): New function. Matches Name, Name2, FullName, ShortName or numeric Id, matching wqflask.api.router.get_dataset_info's ProbeSet-branch matching logic. A dataset name is globally unique on its own, unlike a group's traits, so this isn't scoped by group. (ProbeSetInfo): New struct, a probe's ProbeSetXRef mapping stats plus its ProbeSet gene annotation. (get_dataset_probeset_info): New function, matching wqflask.api.router.get_trait_info's ProbeSet branch. (ProbeSetValue): New struct. (get_dataset_probeset_values): New function, matching wqflask.api.router.trait_sample_data's ProbeSet branch. * src/lib.rs (DatasetProbesetLookup): New enum, the expression-dataset equivalent of GroupTraitLookup -- distinguishes a missing dataset from a missing probeset in an existing dataset. (group_datasets): New handler for GET /groups/{group}/datasets. (dataset_by_name): New handler for GET /datasets/{dataset}. (get_dataset_probeset_info_result, dataset_probeset_info): New function and handler for GET /datasets/{dataset}/probesets/{probeset}. (get_dataset_probeset_values_result, dataset_probeset_values): New function and handler for GET /datasets/{dataset}/probesets/{probeset}/values. (app): Register all four. * tests/group_datasets.rs, tests/dataset_by_name.rs, tests/dataset_probeset_info.rs, tests/dataset_probeset_values.rs, test/python/test_group_datasets.py, test/python/test_dataset_by_name.py, test/python/test_dataset_probeset_info.py, test/python/test_dataset_probeset_values.py: New files. Br_U_0803_M (dataset) / 100001_at (probeset, gene symbol Cd3g) in BXD are real rows used as fixtures. * tests/openapi.rs, test/python/test_openapi.py: Check the four new paths are in the generated spec. * README.md: Document the four new endpoints and list the new test files. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
2026-10-04Add GET /groups/{group}/traits/{trait_id}; time DB tests; share pool.Pjotr Prins
* src/db.rs (TraitInfo): New struct. Joins PublishXRef, Phenotype and Publication; LEFT JOIN on the latter two since a handful of PublishXRef rows have no matching row. SQL column aliases are written to match mysql_common's UpperCamelCase conversion exactly, so no field needs a #[mysql(rename = "...")] override. (get_group_trait_info): New function. (pool): New function. mysql::Pool::new eagerly opens its default 10 connections before returning (about 7s against this database); every query function here used to call it per request, paying that cost on every single API call. Builds the Pool once behind a OnceLock<Mutex<Option<Pool>>> and shares the cheap, Arc-backed handle from then on (OnceLock::get_or_init can't be used alone since Pool::new is fallible and get_or_try_init is still unstable). (get_all_species, get_species_by_name, get_all_groups, get_group_by_name, get_group_strains, get_group_trait_values, get_group_trait_info): Use it instead of building their own Pool. * src/lib.rs (GroupTraitLookup): Generalize over the found value (was Vec<db::TraitValue>-specific), so group_trait_info can share it with group_trait_values. (get_group_trait_info_result): New function. (group_trait_info): New handler for GET /groups/{group}/traits/{trait_id}. (app): Register it. * tests/common/mod.rs: New file. get() issues a GET against genenetwork4::app() and warns on stderr if it takes over a second -- this is what surfaced the Pool::new cost above. * tests/species.rs, tests/species_by_name.rs, tests/groups.rs, tests/group_by_name.rs, tests/group_strains.rs, tests/group_trait_values.rs: Use tests/common::get instead of building each request by hand. * tests/group_trait_info.rs, test/python/test_group_trait_info.py: New files. * tests/openapi.rs, test/python/test_openapi.py: Check the new path is in the generated spec. * README.md (GET /groups/{group}/traits/{trait_id}): Document it. (Tests): List the new test files; document tests/common::get's timing warnings and how to see them. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
2026-10-04Add GET /groups/{group}/traits/{trait_id}/values, publish trait data.Pjotr Prins
* src/db.rs (TraitValue): New struct. (get_group_trait_values): New function. Joins PublishData, Strain and PublishXRef by group Id and PublishXRef.Id, matching gn-guile's gn.data.dataset:get-bxd-publish-name-value-dict generalized beyond BXD: PublishXRef.Id alone isn't unique across groups, only the pair (InbredSetId, Id) is, the same way GeneNetwork2's wqflask.api.router.trait_sample_data combines trait_name with a group or dataset to resolve a Publish trait. * src/lib.rs (GroupTraitLookup): New enum, distinguishes a missing group from a missing trait in an existing group. (get_group_trait_values_result): New function, looks up a group then its trait, returning a GroupTraitLookup. (group_trait_values): New handler for GET /groups/{group}/traits/{trait_id}/values. 404s as group_not_found or trait_not_found depending on what get_group_trait_values_result found. (app): Register it. * tests/group_trait_values.rs, test/python/test_group_trait_values.py: New files. * tests/openapi.rs, test/python/test_openapi.py: Check the new path is in the generated spec. * README.md (GET /groups/{group}/traits/{trait_id}/values): Document it, including that only Publish (phenotype) traits are supported so far, not ProbeSet or Geno traits. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
2026-10-04Format all Rust sources with cargo fmt (no behavior change)Alexander_Kabui
Line-wrapping and canonical import ordering only (verified with git diff -w). Establishes rustfmt's output as the canonical style before the search/correlation work lands.
2026-10-04Fix DB tests: probe SQL_URI credentials, not just the portAlexander_Kabui
The old skip check connected to 127.0.0.1:3306, so tests ran (and failed with 500) whenever a server was listening but the configured credentials were rejected. tests/common/mod.rs now attempts a real connection with the configured SQL_URI; tests skip only when the database is genuinely unusable, and run for real otherwise.
2026-10-03Add GET /groups/{group}/strains, mirroring gn-guile's strain-id-names.Pjotr Prins
* src/db.rs (Strain): New struct. (get_group_strains): New function. Joins Strain and StrainXRef by group Id, optionally filtered to strains used for mapping, matching gn-guile's gn.data.strains:strain-id-names (same InbredSetId and used-for-mapping? arguments), returning strain names as well as ids. * src/lib.rs (GroupStrainsParams): New struct, the used_for_mapping query parameter. (group_strains): New handler for GET /groups/{group}/strains. Looks the group up the same way group_by_name does, for the same 404 shape on an unknown group. (app): Register it. * tests/group_strains.rs, test/python/test_group_strains.py: New files. * tests/openapi.rs, test/python/test_openapi.py: Check the new path is in the generated spec. * README.md (GET /groups/{group}/strains): Document it, including the used_for_mapping filter excluding BXD's parent strains. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
2026-10-03Match group by numeric Id, use Group alias for InbredSet fields.Pjotr Prins
* src/db.rs (get_group_by_name): Also match CAST(Id AS CHAR), so a numeric Id works like GeneNetwork2's wqflask.api.router.get_group_info plus gn-guile's gn.data.population:population-info, which looks a group up by Id only. (GroupDetail): Rename inbred_set_id, inbred_set_name, inbred_set_code fields to group_id, display_name, group_code, adding #[mysql(rename = "...")] overrides so FromRow still matches the InbredSetId, InbredSetName, InbredSetCode MariaDB columns; InbredSet stays a MariaDB-only name, not a Rust identifier. * src/lib.rs (group_by_name): Update the "group" path parameter description to mention matching by numeric Id too. * tests/group_by_name.rs (group_by_name_bxd_returns_group_row): Update assertion for the display_name field rename. (group_by_name_numeric_id_returns_same_group_row): New test. * test/python/test_group_by_name.py: Likewise. * README.md (GET /groups/{group}): Document matching by numeric Id and the group_id/display_name/group_code field names. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
2026-10-03Add /groups and /groups/{group} endpoints.Pjotr Prins
* src/db.rs (Group): New struct. Summary of one InbredSet row, matching the shape of GeneNetwork2's GET /api/v_pre1/groups response. (get_all_groups): New function. Mirrors GeneNetwork2's wqflask.api.router.get_groups_list (no species filter yet). (GroupDetail): New struct, deriving FromRow instead of being built from a tuple like SpeciesDetail, since InbredSet has 14 columns, more than mysql_common's FromRow is implemented for tuples (up to 12). FromRow matches by column name (PascalCase of the field name via #[mysql(rename_all = "PascalCase")]), except public, which is lowercase in the schema and needs its own #[mysql(rename = "public")]. (get_group_by_name): New function. Mirrors GeneNetwork2's wqflask.api.router.get_group_info, but returns every column instead of a fixed subset. * src/lib.rs (app): Add /groups and /groups/{group} routes. (groups, group_by_name): New handlers, following the same ApiError/request-id/spawn_blocking pattern as species/species_by_name. (group_by_name): On no match, set ApiError's next to /groups. * tests/groups.rs: New file. Checks BXD is present (used throughout the GeneNetwork2 and GeneNetwork3 test suites as a fixture group, always present in the database); skips rather than fails when no database is reachable, same as species.rs. * test/python/test_groups.py: New file. Likewise. * tests/group_by_name.rs: New file. Checks BXD's full row and an unknown-group 404 case, same pattern as species_by_name.rs. * test/python/test_group_by_name.py: New file. Likewise. * tests/openapi.rs (openapi_json_describes_all_endpoints): Check for /groups and /groups/{group} among the documented paths. * test/python/test_openapi.py (test_openapi_json_describes_all_endpoints): Likewise. * README.md: Document /groups and /groups/{group}.
2026-10-03Add shared ApiError response shape and request-id tracking.Pjotr Prins
* Cargo.toml (dependencies): Add tower-http, features request-id and util. * src/error.rs: New file. ApiError, modeled on RFC 7807 (Problem Details for HTTP APIs) plus code, operation_id, spec_url, request_id and next. type and spec_url are relative paths since this service has no fixed public domain. Implements axum::response::IntoResponse. * src/lib.rs (app): Add SetRequestIdLayer and PropagateRequestIdLayer, assigning each request an x-request-id and copying it onto the response. (request_id_string): New function. (species, species_by_name): Take an Extension<RequestId> parameter. Return Result<_, ApiError> instead of Result<_, (StatusCode, String)>. (species_by_name): On no match, set ApiError's next to /species, so a caller with a wrong species name can discover the valid ones. * tests/species_by_name.rs (species_by_name_unknown_species_returns_404): Check the full ApiError body (status, code, operation_id, spec_url, next) and that request_id matches the x-request-id response header, instead of only the status code. * test/python/test_species_by_name.py (test_species_by_name_unknown_species_returns_404): Likewise. * README.md: Add an Error handling section documenting the ApiError shape and each field. * rust-package.scm: Regenerate with guix import crate -f Cargo.lock genenetwork4. Adds crate-source definitions for tower-http and its new transitive dependencies. * guix.scm (genenetwork4-git)[native-inputs]: Add rust-tower-http-0.7.1, rust-getrandom-0.4.3 and rust-r-efi-6.0.0.
2026-10-03Add /species/{species} for a single species' full row.Pjotr Prins
Checked for an existing implementation first: GeneNetwork2's wqflask/api/router.py has /api/v_pre1/species/<species_name>, matching Name, FullName or SpeciesName, but returning only a 4-column subset (Id, Name, FullName, TaxonomyId). GeneNetwork3's gn3/db/wiki.py has only internal name-to-id lookups for the wiki feature; its /species is SPARQL-based metadata, not a Species table row. gn-guile's species code (gn/data/species.scm) is also SPARQL/RDF metadata, not backed by db_webqtl. * src/db.rs (params): Import. (SpeciesDetail): New struct, one full row of the Species table. (get_species_by_name): New function. Same match logic as GeneNetwork2's get_species_info (Name, FullName or SpeciesName), but selects every column instead of a fixed subset. * src/lib.rs (app): Add /species/{species} route. (species_by_name): New handler. 404 if no species matches. * tests/species_by_name.rs: New file. Tests mouse specifically (Name=mouse is always present) and an unknown-species 404 case; skips rather than fails when no database is reachable, same as species.rs. * test/python/test_species_by_name.py: New file. Likewise. * tests/openapi.rs (openapi_json_describes_all_endpoints): Check for /species/{species} among the documented paths. * test/python/test_openapi.py (test_openapi_json_describes_all_endpoints): Likewise. * README.md: Document /species/{species}.
2026-10-03Add /openapi.json describing the REST API.Pjotr Prins
* Cargo.toml (dependencies): Add utoipa, feature axum_extras; add utoipa-axum. * src/lib.rs: Use utoipa_axum::router::OpenApiRouter and routes! instead of axum::Router and route!, so paths register into an OpenApi document as well as the router. (ApiDoc): New struct, deriving utoipa::OpenApi with title, description and license. (app): Add /openapi.json, serving the OpenApi document split out of OpenApiRouter via split_for_parts. (hello_world, version, species): Add #[utoipa::path(...)] attributes describing each endpoint's responses. (VersionInfo): Derive utoipa::ToSchema in addition to Serialize. * src/db.rs (Species): Likewise. * tests/openapi.rs: New file. Checks /openapi.json's info.title and that it lists all three endpoints. * test/python/test_openapi.py: New file. Likewise. * README.md: Document /openapi.json. * rust-package.scm: Regenerate with guix import crate -f Cargo.lock genenetwork4. Adds crate-source definitions for utoipa, utoipa-gen, utoipa-axum and pastey. * guix.scm (genenetwork4-git)[native-inputs]: Add rust-utoipa-6.0.0, rust-utoipa-gen-6.0.1, rust-utoipa-axum-0.3.0 and rust-pastey-0.2.3.
2026-10-03Assert mouse and rat are present in /species.Pjotr Prins
* tests/species.rs (species_returns_ok_with_species_list): Assert the returned names include mouse and rat, which are always present in the database. * test/python/test_species.py (test_species_returns_ok_with_species_list): Likewise.
2026-10-03Add /species endpoint backed by MariaDB.Pjotr Prins
* Cargo.toml (dependencies): Add mysql, default-features = false, features minimal-rust and derive (minimal pulls in flate2/zlib, which fails to compile here; minimal-rust uses flate2's pure-Rust backend instead). * Cargo.lock: Regenerate. Picks up mysql and its roughly 100 transitive dependencies; also bumps libc to 0.2.190 and tokio to 1.53.2 from re-resolution. * src/db.rs: New file. sql_uri, Species, get_all_species. Mirrors GeneNetwork3's gn3.db.species.get_all_species: same query, same ordering. Connection string from the SQL_URI environment variable (same config key GeneNetwork3 uses), defaulting to mysql://webqtlout:webqtlout@127.0.0.1/db_webqtl. * src/lib.rs (app): Add /species route. (species): New handler. Runs db::get_all_species on a blocking thread, since mysql::Conn is synchronous. * tests/species.rs: New file. Checks for a database on 127.0.0.1:3306 first and skips with a message instead of failing when none is reachable, since the Guix build sandbox has no network. * test/python/test_species.py: New file. Likewise. * README.md: Document /species, SQL_URI, and the skip-without-database behavior of species.rs and test_species.py. * rust-package.scm: Regenerate with guix import crate -f Cargo.lock genenetwork4. Adds crate-source definitions for mysql's transitive dependencies; bumps rust-libc and rust-tokio to the versions above. * guix.scm (genenetwork4-git)[native-inputs]: Add every new rust-package.scm entry mysql pulled in (roughly 100 packages, including rust-mysql-28.0.3, rust-mysql-common-0.37.3, rust-uuid, rust-url, rust-sha1, rust-sha2, rust-flate2).
2026-10-01Add /version endpoint, extract shared python test helper.Pjotr Prins
* .gitignore: Add __pycache__. * src/lib.rs (app): Add /version route. (VersionInfo, version): New struct and handler, returning name, short_name, version, release, date, and git as a JSON record. * build.rs: New file. Embeds GN4_GIT_HASH and GN4_COMMIT_DATE via cargo:rustc-env, read from git rev-parse and git show of HEAD. * Cargo.toml (dependencies): Add serde with derive feature. [dev-dependencies]: Add serde_json. * tests/version.rs: New file. * test/python/server_test_case.py: New file. ServerTestCase, wait_for_port, BINARY, HOST, PORT moved here from test/python/test_hello_world.py. * test/python/test_hello_world.py: Use server_test_case.ServerTestCase instead of duplicating setUpClass and tearDownClass. * test/python/test_version.py: New file. * guix.scm: Add (gnu packages version-control) to use-modules. (genenetwork4-git)[native-inputs]: Add git-minimal. (genenetwork4-git)[arguments]<#:phases>[python-rest-test]: Run test/python with python3 -m unittest discover instead of invoking test_hello_world.py directly, so test_version.py also runs.
2026-10-01Move tests outPjotr Prins