Skip to content

Conversation

@rly
Copy link
Contributor

@rly rly commented Sep 23, 2025

Motivation

In NWB schema < 2.2.0, the neurodata type NWBContainer had no neurodata_type_inc. Starting in NWB schema 2.2.0, neurodata_type_inc was set to Container (from hdmf-common).

Currently, in NWBGroupSpec, if data_type_inc is not set, then it is set to NWBContainer. So when reading old files with cached NWB schema < 2.2.0, NWBContainer which doesn't have data_type_inc set will have it set to NWBContaienr. Then data_type_def == data_type_inc which should not be allowed and messes up inc spec resolution. After hdmf-dev/hdmf#1312 is merged, this situation will raise an error.

This PR prevents setting data_type_inc = "NWBContainer" when data_type_def = "NWBContainer". Same for NWBData.

How to test the behavior?

Load the old file https://github.com/NeurodataWithoutBorders/pynwb/blob/dev/tests/back_compat/1.0.3_nwbfile.nwb
with the new HDMF spec resolution

Checklist

  • Did you update CHANGELOG.md with your changes?
  • Have you checked our Contributing document?
  • Have you ensured the PR clearly describes the problem and the solution?
  • Is your contribution compliant with our coding style? This can be checked running ruff check . && codespell from the source directory.
  • Have you checked to ensure that there aren't other open Pull Requests for the same change?
  • Have you included the relevant issue number using "Fix #XXX" notation where XXX is the issue number? By including "Fix #XXX" you allow GitHub to close issue #XXX when the PR is merged.

@codecov
Copy link

codecov bot commented Sep 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.19%. Comparing base (fa6a214) to head (06ed1f6).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #2135   +/-   ##
=======================================
  Coverage   95.19%   95.19%           
=======================================
  Files          28       28           
  Lines        2849     2851    +2     
  Branches      736      736           
=======================================
+ Hits         2712     2714    +2     
  Misses         83       83           
  Partials       54       54           
Flag Coverage Δ
integration 74.04% <50.00%> (-0.13%) ⬇️
unit 85.16% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rly rly requested a review from stephprince September 23, 2025 22:19
@rly rly merged commit bf3294e into dev Sep 29, 2025
26 checks passed
@rly rly deleted the legacy_data_type_inc branch September 29, 2025 17:00
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.

3 participants