Repository navigation
ensureMex: verify blosc.encode resolves to a copy with its MEX on every call - #153
Merged
Merged
Conversation
The persistent cache returned available=true without re-checking the
path, and availability was judged by exist('blosc.encode','file'),
which is true for any +blosc package, including a source checkout of
blosc-matlab with no compiled MEX. After a path reset (or with a stray
checkout ahead on the path) callers then hit "Undefined function
'blosc_mex'" instead of falling back to the Python tool.
- Add ndr.util.blosc.checkMexResolution: blosc.encode, encodeChunk and
decode must each resolve to a +blosc folder with
private/blosc_mex.<mexext>.
- ensureMex re-checks this on every call (which + isfile, no
download); if the cached install no longer resolves it is addpath'd
to the top again, and if it is still shadowed available=false with a
reason naming the shadowing folder.
- Use the same check for the final availability and in
discoverExistingMex.
- Add TestEnsureMex covering stray copies without a MEX and an install
removed from the path after a successful call.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011v7R5uZ1S7cptasH3CmUV8
Contributor
CI showed addpath(cached.path) leaving an already-on-path install behind a +blosc copy added later, so testStrayAheadOnPathIsOvertakenByInstall failed. Remove the folder from the path first, then add it with -begin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011v7R5uZ1S7cptasH3CmUV8
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #153 +/- ##
==========================================
- Coverage 55.34% 54.12% -1.22%
==========================================
Files 165 166 +1
Lines 9708 9747 +39
==========================================
- Hits 5373 5276 -97
- Misses 4335 4471 +136
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Bug
On macOS (R2024b,
mexmaca64) an NDI lightsheet test failed with:Diagnosis:
which -all blosc.encoderesolved only to a source checkout of blosc-matlab (its+blosc/privatehad justcoerceBytes.m, no compiled MEX), whilendr.util.blosc.ensureMex()still reportedavailable: 1for the downloaded v0.2.1 copy inprefdir, whose folder was no longer on the path.Two bugs in
ensureMex:persistent cachedshortcut returned the cached struct without re-checking the path, so after something removed the install folder from the path (a test path fixture restoring the path,restoredefaultpath, a path reset in an init script) every later call still said available.exist('blosc.encode','file') == 2, which is true for any+bloscpackage, including one with noprivate/blosc_mex.<mexext>.Fix
ndr.util.blosc.checkMexResolution():blosc.encode,blosc.encodeChunkandblosc.decodemust each resolve (which) to a+bloscfolder withprivate/blosc_mex.<mexext>(isfile). Cheap enough for the per-chunk hot path; never downloads.ensureMex's cached shortcut now runs that check. If it fails and the cached install is still on disk, the install is moved back to the top of the path and re-checked; if it is still shadowed (e.g. the stray copy is in the current folder) it returnsavailable=falsewith areasonnaming the shadowing folder, so callers fall back to the Python path instead of erroring. If the install vanished from disk, the normal install flow runs.rmpaththenaddpath -begin(moveToTopOfPath): CI showed thataddpathon a folder already on the path does not move it ahead of a+blosccopy added later.discoverExistingMexuse the same check.infofields unchanged.Tests
tools/tests/+ndr/+unittest/+util/+blosc/TestEnsureMex.m(temp folders; path and current folder restored at teardown):+bloscwithout MEX ahead on the path →checkMexResolutionnot ok, reason names the folder (no network/MEX needed);ensureMexnever reports available;Not run locally (no MATLAB here, per AGENTS.md). CI on Linux: 406 passed, 0 failed, 3 skipped (pre-existing sonpipe assumptions); all six new tests pass.
🤖 Generated with Claude Code
https://claude.ai/code/session_011v7R5uZ1S7cptasH3CmUV8