Fix stale NWBFile.objects cache - #2252
Open
AtomicGlance wants to merge 1 commit into
Open
Conversation
AtomicGlance
force-pushed
the
codex/2242-refresh-objects
branch
from
September 3, 2026 20:08
f0340bd to
c6c1957
Compare
Author
|
I updated this branch onto the current PyNWB dev branch and resolved the release changelog conflict. The three cache regression tests and all 63 tests in ests/unit/test_file.py pass locally. The diff remains limited to cache invalidation, its tests, and the changelog. It is ready for review when convenient. |
Author
|
I rechecked the refreshed branch against the local source tree: the cache-specific tests pass (2 passed), and the existing |
AtomicGlance
force-pushed
the
codex/2242-refresh-objects
branch
from
September 9, 2026 18:42
c6c1957 to
ed7ed48
Compare
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.
Motivation
NWBFile.objectsis populated on first access but is not refreshed when containers are added to or removed from the file. This leaves callers with a stale object mapping, including when a nestedProcessingModuleis modified. A stale mapping can cause downstream writers and integrations to miss newly added containers.How to test the behavior?
The object mapping is now rebuilt each time
NWBFile.objectsis accessed. Regression tests cover direct additions, removals, and additions through a nested processing module, while preserving the existing object instances.Checklist
CHANGELOG.md.Fix #2242.ruff check src/pynwb/file.py tests/unit/test_file.pypasses.PYTHONPATH=src python -m pytest tests/unit/test_file.py -qpasses (63 tests).