Warn instead of error when reading values invalid per the NWB schema#830
Draft
ehennestad wants to merge 10 commits into
Draft
Warn instead of error when reading values invalid per the NWB schema#830ehennestad wants to merge 10 commits into
ehennestad wants to merge 10 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #830 +/- ##
==========================================
- Coverage 95.31% 95.30% -0.01%
==========================================
Files 218 220 +2
Lines 7634 7668 +34
==========================================
+ Hits 7276 7308 +32
- Misses 358 360 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ae75126 to
5c1ae5a
Compare
3 tasks
b5a87a5 to
76ce128
Compare
Contributor
|
decision here is to push out a fix for the problems users are facing today, specifically validation of dataset shape and schema-locked value (e.g. "volts"). Then we can perhaps think about expanding to other types of validation in the future. |
This was referenced Jul 1, 2026
* Add DynamicTableBase class for handwritten DynamicTable behavior Introduce matnwb.neurodata.DynamicTableBase, an abstract handle base class that owns the handwritten DynamicTable behavior the generated schema class cannot express: row and column mutation, row retrieval, table conversion, clearing, and consistency validation. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Generate DynamicTable classes with a custom base class fillClass attaches matnwb.neurodata.DynamicTableBase as a superclass for DynamicTable via a customBaseClasses map, rather than injecting table methods inline. The constructor and custom-constraint hooks now route the consistency check through obj.ensureDynamicTableConsistency(). Remove the now-unused fillDynamicTableMethods. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Regenerate types against DynamicTableBase DynamicTable now inherits matnwb.neurodata.DynamicTableBase and drops its inline table methods; DynamicTable descendants call obj.ensureDynamicTableConsistency() from their constructors and custom-constraint checks. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Remove obsolete dynamictable add* wrappers addColumn, addRow, and addTableColumn are superseded by DynamicTableBase methods that call the addVararg* helpers directly. Document addVarargRow. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Update DynamicTable tests for new addRow/addColumn signatures Remove assertions that passing a MATLAB table to addRow/addColumn throws NWB:DynamicTable; the new repeating-argument signatures reject that input via argument validation instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Route clear via the DynamicTable's clear method in dynamicTableTest --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1b9cbfe to
6d1fda0
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.
Fix #776
Problem
MatNWB currently treats schema-invalid values as hard errors while reading NWB files. This is too strict: a single non-conforming value can make an otherwise usable file unreadable.
Solution
Update validators to use
matnwb.common.validation.reportSchemaViolation. Schema violations remain errors during normal object construction and export, but become warnings during file reads so the original values remain accessible.The following validators are updated in this PR:
checkTypevalidateSoftLinkcheckDtypecheckConstraintcheckConfigandgetOutermostIndexColumnNameConstant-value validation (
checkConstant) and shape validation (validateShape) are handled separately in #845.Tests
Checklist
Fix #XXwhereXXis the issue number?🤖 Generated with Codex