about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPjotr Prins <pjotr.public01@thebird.nl>2026-10-05 07:47:10 +0000
committerPjotr <wrk@bosa.lan>2026-10-05 07:47:10 +0000
commit8140dc2a8d7e24f4e530bd471819d18c66b732ee (patch)
treea82000741e7f0ff8f2fa0af1df6770bdaadb16fe
parent551bb2f8a6aaa420b6bdd4729e4fb2bd2f739b5d (diff)
downloadgenenetwork4-8140dc2a8d7e24f4e530bd471819d18c66b732ee.tar.gz
doc: Fix staleness in README.md and RELEASE_NOTES.md
Three claims left over from before "every endpoint requires a token"
(previous commit) were actually wrong, not just stale phrasing:

- RELEASE_NOTES.md's intro still said "not all endpoints will require a
  token" -- the opposite of what the rest of the file by then described.
- README's /traits/{dataset} entry and RELEASE_NOTES.md's /traits/...
  entry both still said /groups/{group}/traits "isn't gated" -- true
  for resource-level authorization, false for the token requirement
  added in the same commit that should have updated this.

Also fixed real staleness independent of this turn: README's Tests
section enumerated specific Rust/Python test file pairs needing a live
database, a list that had silently fallen behind several rounds of new
endpoints (missing species_datasets, group_traits, dataset_probesets,
traits, get_test_token). Replaced the enumeration with a description of
which tests need what and why, so it can't go stale the same way again.
Also documented AUTH_SERVER_URL/GENENETWORK4_DEV_MODE/GENENETWORK4_BIND
for the "run the test suite with a self-provisioned token" path the
previous commit added, which the cargo test / python -m unittest
invocations here hadn't mentioned yet.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
-rw-r--r--README.md49
-rw-r--r--RELEASE_NOTES.md20
2 files changed, 39 insertions, 30 deletions
diff --git a/README.md b/README.md
index e713a94..6b0f1e8 100644
--- a/README.md
+++ b/README.md
@@ -330,14 +330,14 @@ accepts: the `PublishFreeze`'s own `Name`/`ShortName`/`Id` (e.g.
 `PublishFreeze`, so the two are near-interchangeable in practice.
 
 - `GET /traits/{dataset}` - every trait in `dataset`, tagged by
-  category. 404 if no dataset matches. Gated the same way as
-  `/datasets/{dataset}/probesets` -- a valid token is required
-  unconditionally, and a non-public dataset is checked against gn-auth
-  once for the dataset as a whole. This is new for Publish data:
-  `/groups/{group}/traits` (unchanged) still isn't gated, but reaching
-  the same phenotype traits through `/traits/{group}` now requires a
-  token, since `PublishFreeze.public`/`confidentiality` feed into the
-  same `is_publicly_readable` check ProbeSet data already uses.
+  category. 404 if no dataset matches. A non-public dataset is checked
+  against gn-auth once for the dataset as a whole
+  (`auth::authorise_dataset`), same as `/datasets/{dataset}/probesets`.
+  This is still more than `/groups/{group}/traits` checks for the same
+  phenotype data: both endpoints require a token now, but only this one
+  also checks `PublishFreeze.public`/`confidentiality` and, for a
+  non-public dataset, gn-auth -- `/groups/{group}/traits` (unchanged)
+  stops at the token.
 
   ```json
   [
@@ -593,24 +593,29 @@ Two test suites exercise the same endpoints:
   GENENETWORK4_BINARY=target/release/genenetwork4 python3 -m unittest discover -v test/python
   ```
 
+Either suite can fetch its own token from a live gn-auth automatically
+(see "Development mode" above) -- set `AUTH_SERVER_URL` plus
+`GENENETWORK4_DEV_MODE=true GENENETWORK4_BIND=127.0.0.1` before running
+either command above, and nothing further needs setting up by hand. A
+run without those set still works, skipping (not failing) every test
+that needed a token it couldn't get -- set `GN4_TEST_AUTH_TOKEN`
+instead if you'd rather provide one manually without turning dev mode
+on.
+
 Both suites also run automatically as part of `guix build -f guix.scm`
 (the Rust tests in the `check` phase, the Python tests in a
 `python-rest-test` phase after install).
 
-`species.rs`/`test_species.py`, `species_by_name.rs`/
-`test_species_by_name.py`, `groups.rs`/`test_groups.py`,
-`group_by_name.rs`/`test_group_by_name.py`, `group_strains.rs`/
-`test_group_strains.py`, `group_trait_values.rs`/
-`test_group_trait_values.py`, `group_trait_info.rs`/
-`test_group_trait_info.py`, `group_datasets.rs`/
-`test_group_datasets.py`, `dataset_by_name.rs`/
-`test_dataset_by_name.py`, `dataset_probeset_info.rs`/
-`test_dataset_probeset_info.py` and `dataset_probeset_values.rs`/
-`test_dataset_probeset_values.py` need a live MariaDB on
-`127.0.0.1:3306` (see `SQL_URI` above); unlike the other tests they
-check for that connection first and skip with a message rather than
-fail when none is
-reachable, since the Guix build sandbox has no network/database access.
+Every test under `tests/*.rs`/`test/python/test_*.py` for an endpoint
+that touches the database (which is most of them -- `hello_world`,
+`version`, `openapi` and `get_test_token`'s own disabled/wrong-config
+cases are the exceptions) checks for a live MariaDB on `127.0.0.1:3306`
+first (see `SQL_URI` above) and skips with a message rather than
+failing when none is reachable, since the Guix build sandbox has no
+network/database access. Likewise, any test for an endpoint that
+requires a token (every endpoint except those four) checks for one
+first and skips if none is available -- see "Development mode" above
+for how the test suite gets one automatically.
 
 The Rust tests in `tests/*.rs` that hit the database issue their
 requests through `tests/common::get`, which times the request and
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 51a43a7..69f1c02 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -2,8 +2,10 @@
 
 ## Unreleased (`gn-auth` branch)
 
-Work towards securing endpoints with per-user tokens issued by
-gn-auth. Not all endpoints will require a token -- see
+Securing endpoints with per-user tokens issued by gn-auth. Every
+endpoint now requires one (see "Every endpoint now requires a valid
+token" below); which further, resource-level authorization (if any) an
+endpoint also checks is a separate, per-endpoint matter -- see
 `docs/gn-auth.md`.
 
 ### Added
@@ -58,12 +60,14 @@ gn-auth. Not all endpoints will require a token -- see
   never guessed across categories. Responses are tagged
   (`{"category": "probeset"|"publish", ...}`) rather than collapsed to
   a lossy common schema. Gated the same way as
-  `/datasets/{dataset}/probesets...`, extended to Publish data too (new
-  protection: `/groups/{group}/traits` itself still isn't gated) --
-  `authorise_trait`/`authorise_dataset` already works unchanged for
-  Publish datasets, since gn-auth's own `/auth/data/authorisation`
-  already dispatches `*Publish`-suffixed dataset names to its
-  phenotype resource resolver.
+  `/datasets/{dataset}/probesets...`, extended to resource-level
+  authorization for Publish data too, which `/groups/{group}/traits`
+  itself still doesn't check (see "Every endpoint now requires a valid
+  token" below for the separate, blanket token requirement that does
+  cover it) -- `authorise_trait`/`authorise_dataset` already works
+  unchanged for Publish datasets, since gn-auth's own
+  `/auth/data/authorisation` already dispatches `*Publish`-suffixed
+  dataset names to its phenotype resource resolver.
 - `POST /get-test-token` (`src/routes/dev.rs`; named `/dev/token` very
   briefly before this): development-only convenience endpoint that
   calls gn-auth's password grant for its well-known dev user and