Skip to content

Track down the NodeNorm Biolink type changes on exp - #108

Open
gaurav wants to merge 2 commits into
mainfrom
track-down-nodenorm-types-change
Open

Track down the NodeNorm Biolink type changes on exp#108
gaurav wants to merge 2 commits into
mainfrom
track-down-nodenorm-types-change

Conversation

@gaurav

@gaurav gaurav commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

uv run pytest --target exp tests/nodenorm/test_nodenorm_types.py fails because the position of biolink:OntologyClass has changed. This PR makes those failures legible and records what actually changed, so we can decide whether to accept the new values as the baseline or fix NodeNorm.

1. Report every difference at once

Each of the four tests looped over its CURIEs and asserted per-CURIE, so the first mismatch aborted the test and hid the rest — tracking down the change meant fixing one expectation at a time to reveal the next.

The four near-identical request/compare blocks are now one check_biolink_types() helper that collects every mismatch across every CURIE into a single assertion, and distinguishes a membership change (calling out which types are missing and which are unexpected) from a pure reordering:

4 difference(s) found:

MESH:D014867: Biolink types differ (reordered only)
  expected: [...]
  actual:   [...]
  missing from actual: []
  unexpected in actual: []

NCIT:C34373: Biolink types differ (membership differs)
  ...
  unexpected in actual: ['biolink:OntologyClass']

That commit is behaviour-preserving — no expected values change.

2. What changed on exp

Three differences, all consistent with a Biolink model version bump rather than a change in Babel's data:

# Change Affected CURIEs
1 biolink:OntologyClass now returned where it previously wasn't, inserted after the second-most-specific type MESH:D014867 (SmallMolecule), NCIT:C34373 (Disease) — but not UNII:K16AIQ8CTM (ChemicalEntity)
2 biolink:GeneOrGeneProductOrGeneFamily is a new type on gene cliques, directly after biolink:GeneOrGeneProduct NCBIGene:22059, PR:Q9Y6J0
3 biolink:OntologyClass moves from index 10 to index 2 under DrugChemical conflation MESH:D014867

(3) is the change that prompted this investigation, and it falls out of (1): OntologyClass now arrives with the main clique's types instead of being appended by the conflation tail. Membership is identical; only the order differs.

Questions for review

  • Is (1) intended? The inconsistency is suspicious: MESH:D014867 and NCIT:C34373 gained OntologyClass, but UNII:K16AIQ8CTM did not.
  • Is (2) simply a new class in the Biolink model we should accept?
  • Do we care about (3) at all, given the type set is unchanged? If ordering is only meaningful for the first (most specific) type, these tests may be over-asserting.

Note on other targets

The expectations now match exp only. dev, prod, test and ci still return the previous baseline and so now fail with the exact inverse differences. That is deliberate — making the tests pass on every target would need version-conditional expectations that hide the very difference we're trying to decide on. Once exp is promoted, this should go green everywhere; if we'd rather stay on the old baseline until then, the second commit can simply be reverted.

🤖 Generated with Claude Code

gaurav and others added 2 commits July 24, 2026 03:35
Each of these four tests looped over its CURIEs and asserted per-CURIE, so the
first mismatch aborted the test and hid every other difference. Tracking down
what changed in NodeNorm meant fixing one expectation at a time to reveal the
next.

Replace the four near-identical request/compare blocks with a shared
check_biolink_types() helper that collects every mismatch across every CURIE
and reports them in a single assertion, distinguishing membership changes
(with the missing/unexpected types called out) from pure reorderings.

No expected values change here; this commit is behaviour-preserving.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Running these tests against `exp` shows three differences from the previous
baseline, all consistent with a Biolink model version bump rather than a
change in Babel's data:

1. `biolink:OntologyClass` is now returned for cliques that previously lacked
   it -- MESH:D014867 (SmallMolecule) and NCIT:C34373 (Disease) -- inserted
   after the second-most-specific type. It is still absent from
   UNII:K16AIQ8CTM (ChemicalEntity).
2. `biolink:GeneOrGeneProductOrGeneFamily` is a new type on gene cliques
   (NCBIGene:22059, PR:Q9Y6J0), directly after `biolink:GeneOrGeneProduct`.
3. As a consequence of (1), `biolink:OntologyClass` now arrives with the main
   clique's types for MESH:D014867 instead of being appended by DrugChemical
   conflation, so its position moves from index 10 to index 2. The membership
   is unchanged; only the order differs. This is the change that originally
   prompted this investigation.

These expectations now match `exp` only: dev, prod, test and ci still return
the previous baseline and so now fail with the exact inverse differences.
That is deliberate -- making the tests pass everywhere would require
version-conditional expectations that hide the very difference we want to
decide on.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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