Skip to content

fix(annotate): a prediction reads the graph of its donor set - #1300

Merged
github-actions[bot] merged 1 commit into
developfrom
fix/annotate-reads-its-donor-set-graph
Nov 24, 2026
Merged

github-actions[bot] merged 1 commit into
developfrom
fix/annotate-reads-its-donor-set-graph

Conversation

@frapercan

@frapercan frapercan commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

What broke

On the public store, "Anota tus proteinas" answered "Prediction failed" for every submitted sequence. The embedding job succeeded; the predict_go_terms job it chains refused to run:

OntologySnapshot a4ab085e is not the snapshot AnnotationSet 08b0b2aa draws its terms from (710e81b5). Every predicted term comes from a donor annotation, so the two cannot differ ...

Why

_resolve_dispatch_resources picked two things independently, both by load time:

  • the newest annotation set, by created_at;
  • the most recently loaded ontology snapshot, by loaded_at.

The two agree only when the graph a store loaded last happens to be the one its newest set draws on.

  • The store now serving the public site loaded its six graphs on 2026-11-23 between 11:55 and 12:13. The last two were releases/2016-10-29 and releases/2019-11-02. Its newest set, GOA 227, draws on releases/2025-07-22.
  • The store it replaced agreed by chance: its newest set, GOA 235, draws on releases/2026-06-15, the last graph it loaded.

The refusal in predict_go_terms is correct; the resolver was not.

The change

  • The donor set is the one whose source was published last (source_published_at), that is, the latest cut. The load time only breaks ties, and a set without a publication date sorts last.
  • The snapshot is that set's own (ontology_snapshot_id). It is never looked up on its own: every predicted term comes from a donor annotation.
  • Code removed: _newest_ontology_snapshot, now unused, and its 409, since a set always names its snapshot.

What each store resolves to (read-only queries, 2026-11-24):

Store Current code This change
Public GOA 227 with releases/2019-11-02 (refused) GOA 227 with releases/2025-07-22
Dev GOA 227 with releases/2025-07-22 the same
The store the public one replaced GOA 235 with releases/2026-06-15 the same

Every annotation set in the three stores has a publication date.

Tests

  • TestNewestAnnotationSet.test_orders_by_the_source_publication_first pins the ordering.
  • TestDispatchReadsTheDonorSetsGraph pins that the snapshot is the set's own and that no separate query runs.
  • Three request tests wired a snapshot answer into the session's sequence of results. They now give the set its snapshot instead.
  • ruff format 0.15.17 (the gate's version) also put two pre-existing with patch.object(...) statements of the same test file on one line each.
  • Locally, tests/test_annotate_router.py passes, and so do the four other files that reach /annotate: test_auth_anonymous_annotate.py, test_endpoint_gating_sweep.py, test_every_operation_declares_its_spec.py and test_serve_offline_reconciliation.py. lint-gates.sh is green (ruff-format, ruff-check, smells, sets, openapi-refs).

To reach the public site

This needs a merge into develop, then a deploy on the production node.

/annotate picked the newest annotation set by load time and, on its own,
the most recently loaded ontology snapshot. On a store built out of
order the two disagree. On 2026-11-24 the public store had loaded the
2019-11-02 graph last while its newest set, cut 227, draws its terms from
2025-07-22, and predict_go_terms refused every submitted sequence
("is not the snapshot AnnotationSet ... draws its terms from").

The donor set is now the one whose source was published last (the latest
cut), the load time breaking ties, and the snapshot is that set's own.
Every predicted term comes from a donor annotation, so no separate lookup
can be right where the set's own snapshot is not.
@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.64%. Comparing base (7edfb68) to head (0dda7ca).
⚠️ Report is 3 commits behind head on develop.

❌ Your project check has failed because the head coverage (83.90%) is below the target coverage (85.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1300      +/-   ##
===========================================
- Coverage    85.69%   85.64%   -0.05%     
===========================================
  Files          471      471              
  Lines        37374    37408      +34     
===========================================
+ Hits         32026    32037      +11     
- Misses        5348     5371      +23     
Files with missing lines Coverage Δ
protea/api/routers/annotate.py 94.18% <100.00%> (+0.36%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@frapercan
frapercan marked this pull request as ready for review November 24, 2026 13:32
@github-actions
github-actions Bot merged commit 3bdd66c into develop Nov 24, 2026
20 of 21 checks passed
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