Skip to content

Port POST /data/query/ids and /ids/map to content-node - #509

Merged
adamjohnwright merged 2 commits into
mainfrom
port/query-ids
Oct 17, 2026
Merged

adamjohnwright merged 2 commits into
mainfrom
port/query-ids

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

Spec 006 T071: Reactome's batch lookup, up to twenty objects by id from a text/plain body. The site doesn't call it; integrators and client libraries do.

  • Reading ids: the body is split on , ;, newline and tab, and each id trimmed. Past twenty ids, the first twenty go into a HashSet, as Java does.
  • Lookup: each id goes through the same findById(id, OUTGOING) that /query/{id} uses, now one shared function, findObject. Ids are looked up one at a time.
  • /ids order: written in graph-core's HashSet<DatabaseObject> order, by DatabaseObject.hashCode.
  • /ids/map order: written in the HashMap order of the ids as sent.
  • Checking the orders: both are checked against orders computed by the JDK 11 runtime itself.
  • Java's errors:
    • 415 for a non-text body;
    • 422 naming the method for a missing body;
    • a 404 naming the ids as a Java list;
    • a 500 for a dbId past a long;
    • a GET of /ids/map answers as Java's attribute route does.
  • Routing: nginx, the dev proxy and the production server now send /data/query/ids and /ids/map to node, matrix parameter and trailing slash included. The ids exclusion added in Every content-node route takes a trailing slash, as Spring does #498 is removed.

Measured: byte-identical to Java live over ten requests: mixed id kinds and separators, duplicates, missing ids, over twenty ids. The one difference is the nested views' known key order, declared as /query/{id} declares it. nginx -t passes for every deployment.

🤖 Generated with Claude Code

adamjohnwright and others added 2 commits October 17, 2026 15:07
Reactome's batch lookup: up to twenty objects by id in a text/plain body.

- Ids read as Java reads them: split on , ; newline and tab, trimmed;
  past twenty, the first twenty in a HashSet (orthologyIds).
- Each id is findById(id, OUTGOING), the lookup /query/{id} does, now one
  function both use (findObject), asked one at a time.
- /ids writes graph-core's HashSet of DatabaseObjects in its order, by
  DatabaseObject.hashCode (dbId, stId, displayName, 31 apart; Long.hashCode
  past an int); /ids/map writes a HashMap of the ids as sent. Both orders
  checked against the JDK's own (11). Each object is its own lookup, so one
  reached by two ids is written in full twice, as Jackson's per-instance
  identity does.
- Java's errors: 415 for a body that is not text/plain, 422 naming the
  method for a missing one, a 404 naming the ids as a Java list, a 500 for
  a dbId past a long; a GET of /ids/map answers as Java's attribute route
  does (no object called "ids").
- Routed in nginx and the dev proxy, matrix parameter and trailing slash
  included; the ids exclusion #498 added comes out.

Byte-identical to Java live over ten requests -- mixed id kinds and
separators, duplicates, missing ids, over twenty ids -- bar the nested
views' known key order, declared as /query/{id} declares it. Spec 006 T071.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
graph-core's trimId splits an id on '.' and takes the first part; "." (or
"..") splits to nothing, and Java answers the whole batch with a 500
("Index 0 out of bounds for length 0"). Node skipped the id and answered
200 with the rest -- a fail-open. Java looks ids up one at a time, so the
first bad id decides between that and a dbId past a long: both are now
one in-order pass (findByIdFailure). Byte-identical to Java live on both
endpoints, each order of the two, and "..x" (which Java reads as an
empty id, not a failure). Spec 006 T071 ticked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adamjohnwright
adamjohnwright merged commit 8da3415 into main Oct 17, 2026
7 checks passed
@adamjohnwright
adamjohnwright deleted the port/query-ids branch October 17, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant