Repository navigation
EMPTY: don't cache a failed download; clearCache() resets the cache - #10
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EMPTYProvidercached 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, andclearCache()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 intoNDIOntologyLookupError, with the original error chained, and the next lookup downloads again.clearCache()now also resetsEMPTYProvider._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
lookupOBOFilecache withEMPTYProvider._cache, and that was wrong:lookupOBOFile, so the cache MATLAB'sclearCacheempties is always empty.EMPTY.mcaches nothing; it downloads its OWL file on every lookup.The
clearCache,lookupOBOFileand 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.jsonwhereEMPTY.mreads the.owlfiles, and Python has no fallback to the development branch. Porting those would be a separate change.Tests
TestEMPTYProviderpreviously 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:clearCache()clearCache()black,ruffand the offline suite pass: 146 passed, 3 skipped.Generated by Claude Code