Skip to content

Content-node specs that fail on wrong code; Java's index failures - #576

Merged
adamjohnwright merged 7 commits into
mainfrom
fix/content-node-specs
Oct 20, 2026
Merged

adamjohnwright merged 7 commits into
mainfrom
fix/content-node-specs

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

Spec 006 (specs/006-content-service-to-node). From the review of everything merged since #485. The two reviewers of the content service's unit tests found tests that would pass on wrong code; this PR fixes them. Each change was shown failing under the mutation it exists to catch.

Tests

  • Lazy loads: the stand-ins for graph-core's lazy loads answered any query naming the relationship. They now answer by type, direction (Java's model, from domain-snapshot.json) and the dbId asked for, so a load in the wrong direction, or of another object, fails.
  • The attribute as sent: /query/{id}/stId and /normalPathway are held to naming the attribute as the request spelled it.
  • /query/ids and /ids/map: tests where objects are found. /ids is written in the HashSet order and /ids/map in the HashMap order; both were recomputed with JDK 11 by the reviewer.
  • Solr-path 500s: seven were checked by status alone. Each now names Java's NullPointerException answer.
  • Exact queries: stand-ins now answer only the query the service writes. That covers the diagram check (hasDiagram), the species lookup by exact name, the release (releaseNumber) and discover's load.
  • Citation: cited end to end. A pathway is cited by its DOI, a reaction by its page, both by the id as given (a versioned id, so citing the stId or dbId instead fails). The export's three formats each have their content type and extension.
  • Smaller: the mapping query's pattern is anchored at the end, targetResults must be in Java's order, and the no-report check waits on a later report instead of 50 ms.

One answer corrected. The review of this PR found four places answering the NullPointerException text where Java throws an ArrayIndexOutOfBoundsException, which Java's GlobalExceptionHandler answers with its own message, as node already does for the measured Index 0 out of bounds for length 0:

  • an occurrence with fewer than four parts, in /diagram/{d}/occurrences, /diagram/{d}/flag and /fireworks/flag;
  • an icon entity with fewer than four parts.

Each now names the index Java reads first past the end, in the order search-core's bytecode reads them. Each has a test, and all four fail on the code before.

/fireworks/flag with two Species of one name stays status-only: Java's message there is Spring Data's and has not been measured.

Checks

  • Content-node unit tests: 911 passed. implicit-any 812 → 794 (citation.spec typed); lint, loose and dead code unchanged.
  • On beta, rebuilt: the flag and Solr capture sets are identical before and after. Malformed occurrences don't occur in the real index.

🤖 Generated with Claude Code

adamjohnwright and others added 7 commits October 20, 2026 19:57
From the review of 20 Oct (spec 006). The stand-ins for graph-core's lazy
loads answered any query naming the relationship, so a load in the wrong
direction, or of another object, passed; they now answer by type,
direction and the dbId asked for, read from the query (directions as
domain-snapshot.json gives Java's model). /query/{id}/stId and
/normalPathway are held to naming the attribute as the request spelled it.
Each shown failing under the mutation it exists to catch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From the review of 20 Oct (spec 006). Each shown failing under the
mutation it exists to catch.

- /query/ids and /ids/map: a test where objects are found -- /ids in the
  HashSet order, /ids/map keyed by the ids as sent in the HashMap order
  (read from the text: JSON.parse moves a numeric key first). Writing
  either in the order sent now fails.
- Nine of Java's 500s on the Solr paths were checked by status alone;
  each now names Java's NullPointerException answer, so one answered as
  a plain Solr failure fails.
- Stand-ins that answered any query now answer only the query the service
  writes: the diagram-search object check (hasDiagram), the species by
  exact name, the release (releaseNumber), discover's load (whole text).
- /citation/pathway/{id} cited end to end: a pathway by its DOI, a
  reaction by its page, both by the id as given; /citation/export's three
  formats each with their type and extension.
- /references/mapping/{identifier}'s query pattern is anchored at the end;
  /search/query's targetResults are held in Java's order, not merely
  present; the no-report check waits on a later report, not 50ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The review of this branch found four places answering Java's
NullPointerException text where Java throws an
ArrayIndexOutOfBoundsException, which GlobalExceptionHandler answers with
its own message (handleUnclassified), as node already does for the
measured "Index 0 out of bounds for length 0": an occurrence of fewer
than four parts (extractRawOccurrence, for /diagram/{d}/occurrences and
/diagram/{d}/flag; fireworksFlagging for /fireworks/flag) and an icon
entity of fewer than four parts. Each now names the index Java reads
first past the end, in the order search-core's bytecode reads them
([0],[2],[3],[1]; [0],[3]; [0]..[3]); fromSolr answers a javaMessage as
Java's 500. The spec this branch had pinned to the wrong message is
corrected, and each site has a test (all four fail on the code before).

- /fireworks/flag with two Species of one name: back to status only --
  Java's message there is Spring Data's, and has not been measured.
- The citation is asked for by a versioned id, neither its stId nor its
  dbId, so citing either instead of the id as given fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The new tests added uses of an untyped `base` and of untyped globals,
raising the spec's implicit any (28 -> 34); typing them takes the module
down instead, and the services' total 812 -> 794.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… value logged

Three- and two-part occurrences fail at the same index whatever the read
order; one part fails at 2 in Java's ([0],[2],[3],[1]) and at 1 in a naive
one, so the spec now holds the order (shown failing under [0,1,2,3]). The
log line names the raw occurrence again, to find the document by.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After #575 the loose check held service.ts to its locked-in count, and
this branch's outOfBounds calls had raised it (1529 -> 1539): javaSplit
returned an untyped value. Typed, with fourParts (the first four parts,
or Java's index failure in the order given) at the four sites, the count
falls instead: loose 2769 -> 2709, implicit any 794 -> 789, both locked
in. Answers on beta unchanged (flag and Solr capture sets identical).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adamjohnwright
adamjohnwright merged commit 4b4c915 into main Oct 20, 2026
7 checks passed
@adamjohnwright
adamjohnwright deleted the fix/content-node-specs branch October 20, 2026 21:28
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