Skip to content

Conversation

@bendichter
Copy link
Contributor

Add check_nwb_schema_version_official_release to validate that NWB files use official release versions rather than development or pre-release versions. This check is configured as CRITICAL for DANDI validation to ensure production data compatibility and reproducibility.

Motivation

fix #432

Add `check_nwb_schema_version_official_release` to validate that NWB files use official release versions rather than development or pre-release versions. This check is configured as CRITICAL for DANDI validation to ensure production data compatibility and reproducibility.
@bendichter bendichter requested a review from stephprince August 4, 2025 18:57
@bendichter bendichter marked this pull request as draft August 4, 2025 18:58
Comment on lines +36 to +41
import pynwb

# Get the schema version from the namespace catalog
manager = pynwb.get_manager()
core_namespace = manager.namespace_catalog.get_namespace("core")
schema_version = core_namespace.version
Copy link
Contributor

@stephprince stephprince Aug 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check uses the loaded namespace from PyNWB to check the schema version validity and not the nwbfile argument provided. I think it would be more direct to check the nwb_version attribute of the nwbfile provided. Thoughts?

Comment on lines +634 to +637
import unittest.mock

# Test development version
with unittest.mock.patch("pynwb.get_manager") as mock_manager:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comment on the check, but I think these tests could also be updated/simplified using mock nwbfiles with the nwb_version attribute manually changed instead of patching the namespace manager

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.32%. Comparing base (ef22c09) to head (6c17a8c).
⚠️ Report is 6 commits behind head on dev.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #607      +/-   ##
==========================================
+ Coverage   83.16%   87.32%   +4.16%     
==========================================
  Files          47       47              
  Lines        1562     1578      +16     
==========================================
+ Hits         1299     1378      +79     
+ Misses        263      200      -63     
Files with missing lines Coverage Δ
src/nwbinspector/checks/__init__.py 100.00% <ø> (ø)
src/nwbinspector/checks/_nwbfile_metadata.py 97.59% <100.00%> (+0.25%) ⬆️

... and 5 files with indirect coverage changes

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

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.

[Add Check]: Check for unofficial versions of schema

3 participants