Skip to content

EMPTY: don't cache a failed download; clearCache() resets the cache - #10

Merged
stevevanhooser merged 1 commit into
mainfrom
claude/pensive-galileo-j24fio
Oct 21, 2026
Merged

stevevanhooser merged 1 commit into
mainfrom
claude/pensive-galileo-j24fio

Conversation

@stevevanhooser

Copy link
Copy Markdown
Contributor

Summary

EMPTYProvider cached an empty index when its download failed. One timeout or 429 from GitHub then made every EMPTY lookup a "not found" for the life of the process, and clearCache() couldn't undo it because it never touched that cache. This is the "transient failure made permanent" pattern AGENTS.md warns about. It has already caused trouble once: the bridge file records that this path hid a 404'ing URL, so EMPTY's not-found cases passed without testing anything.

Changes

  • EMPTYProvider._load_ontology: a failed download now raises and caches nothing. lookup() turns the error into NDIOntologyLookupError, with the original error chained, and the next lookup downloads again.

  • clearCache() now also resets EMPTYProvider._cache, so it forces a fresh download.

  • Bridge file corrections. The note added in Add 7 new ontology providers and enhance OM with file-based unit lookup #9 paired MATLAB's lookupOBOFile cache with EMPTYProvider._cache, and that was wrong:

    • Nothing in ndi-ontology-matlab calls lookupOBOFile, so the cache MATLAB's clearCache empties is always empty.
    • EMPTY.m caches nothing; it downloads its OWL file on every lookup.

    The clearCache, lookupOBOFile and EMPTY entries now say so.

A deliberate difference from MATLAB

Python keeps a per-process cache of the EMPTY download; MATLAB keeps none. The cache stays because it's faster and, after this change, it can no longer hold a failure. The bridge's EMPTY entry records this.

Two further differences are left as they are and recorded in the bridge as unexamined: Python reads empty-base.json where EMPTY.m reads the .owl files, and Python has no fallback to the development branch. Porting those would be a separate change.

Tests

  • TestEMPTYProvider previously had one test that hit the live network and passed offline only because of the cached-empty fallback. It's replaced with four offline tests:
    • lookup by id
    • not found returns an empty result
    • a failed download raises with its cause chained, isn't cached, and the next lookup succeeds without clearCache()
    • the download is cached until clearCache()
  • The last two fail on the old code and pass on the new.
  • black, ruff and the offline suite pass: 146 passed, 3 skipped.

Generated by Claude Code

EMPTYProvider._load_ontology cached an empty index when the download
failed, so one timeout or 429 made every EMPTY lookup a "not found" for
the life of the process, and clearCache() could not undo it. It now
raises and caches nothing; lookup() chains the cause into
NDIOntologyLookupError, and the next lookup downloads again.
clearCache() now resets the cache too.

Also corrects the bridge note added with the last sync: MATLAB's
lookupOBOFile is not EMPTY's counterpart. Nothing in ndi-ontology-matlab
calls it, and EMPTY.m caches nothing at all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017iFBFMQmEZaz21d9ZFJbiH
@stevevanhooser
stevevanhooser merged commit cf1d33f into main Oct 21, 2026
6 checks passed
@stevevanhooser
stevevanhooser deleted the claude/pensive-galileo-j24fio branch October 21, 2026 14:32
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.

2 participants