feat: add AlignedDynamicTable category validation utilities#833
Conversation
AlignedDynamicTable category utilities
There was a problem hiding this comment.
Fixes bug where column height calculation ignored a non-zero offset for a DataPipe. Probably rare, non-zero offset is supported by api and should be accounted for.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## codex/report-schema-violation-context #833 +/- ##
=========================================================================
- Coverage 95.38% 95.13% -0.26%
=========================================================================
Files 221 223 +2
Lines 7894 7913 +19
=========================================================================
- Hits 7530 7528 -2
- Misses 364 385 +21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR introduces first-class category utilities for AlignedDynamicTable by adding a shared non-generated base class that implements addCategory/getCategory, schema-category routing, and unified runtime validation to enforce category/row-height alignment. It also updates the code generator to emit schema-category discovery hooks and updates the icephys tutorial + unit tests to reflect the new API and stricter alignment validation.
Changes:
- Add
matnwb.neurodata.AlignedDynamicTableBaseand integrate it into generatedAlignedDynamicTableclasses for category registration/lookup and alignment validation. - Improve DynamicTable height/id inference utilities (
getTableHeight,getColumnHeight,initDynamicTableId) and add unit tests. - Update generator logic (constructor/custom-constraint/property hooks) to support schema-defined category discovery and auto-registration; update the icephys tutorial accordingly.
Reviewed changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tutorials/private/mcode/icephys.m | Updates tutorial usage to avoid pre-listing categories with populated tables and uses addCategory for custom categories. |
| +types/+util/+dynamictable/+internal/initDynamicTableId.m | Refactors id initialization to handle existing ids/DataPipes more carefully. |
| +types/+util/+dynamictable/+internal/getTableHeight.m | Returns both inferred height and whether height is “established”. |
| +types/+util/+dynamictable/+internal/getColumnHeight.m | Adjusts unbound DataPipe height inference to include offset + queued data. |
| +types/+hdmf_common/AlignedDynamicTable.m | Mixes in AlignedDynamicTableBase and switches validation to ensureAlignedTableConsistency. |
| +types/+core/IntracellularRecordingsTable.m | Uses new alignment consistency validation and auto-registers schema category names on assignment. |
| +tests/+unit/dynamicTableTest.m | Adds tests for new height semantics and id initialization behavior. |
| +tests/+unit/alignedDynamicTableTest.m | Adds comprehensive tests for addCategory/getCategory and alignment validation. |
| +tests/+doubles/SchemaCategoryAlignedTable.m | Test double for a schema-defined category property. |
| +tests/+doubles/ElementIdentifiersStub.m | Minimal ElementIdentifiers test double. |
| +tests/+doubles/DynamicTableStub.m | Minimal DynamicTable test double. |
| +tests/+doubles/AlignedDynamicTableStub.m | Minimal AlignedDynamicTable test double using the new base class. |
| +matnwb/+neurodata/AlignedDynamicTableBase.m | New core implementation of category utilities + alignment validation. |
| +file/isDynamicTableDescendant.m | Removes old descendant check helper. |
| +file/getPropertyHooks.m | Adds generator hooks for AlignedDynamicTable.categories validation + category postset registration. |
| +file/fillCustomConstraint.m | Generates checkCustomConstraint for AlignedDynamicTable to enforce consistency. |
| +file/fillConstructor.m | Generates constructor-time consistency checks for AlignedDynamicTable descendants. |
| +file/fillClass.m | Adds AlignedDynamicTableBase as a superclass and generates schema-category discovery method blocks. |
| +file/+internal/isDescendantOf.m | New generalized “is descendant of” helper for generator logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
55d3826 to
ad0fcb0
Compare
AlignedDynamicTable category utilitiesAlignedDynamicTable category validation utilities
…ategories when table is uninitialized
commit 89aaadded34998b5256f3d27b2d6ba73a860a042
Author: ehennestad <ehennestad@gmail.com>
Date: Mon Jun 22 14:41:36 2026 +0200
Update AlignedDynamicTableBase.m
one line validation
commit a756a89f9be70116f32d1c9a23fa44744ff73485
Author: ehennestad <ehennestad@gmail.com>
Date: Mon Jun 22 14:39:20 2026 +0200
refactor: clarify aligned dynamic table helpers
commit a5d5dc30493a5745c069b4b6dcb2fd9bd9cf0397
Author: ehennestad <ehennestad@gmail.com>
Date: Mon Jun 22 13:28:48 2026 +0200
refactor: clarify aligned table consistency validation
commit b5bb8313d0bab73236da507dfe405fdd277124db
Author: ehennestad <ehennestad@gmail.com>
Date: Mon Jun 22 13:24:21 2026 +0200
refactor: extract aligned table height establishment
commit 6716530829ed69e5571624c6fe37fd9236c1394c
Author: ehennestad <ehennestad@gmail.com>
Date: Mon Jun 22 13:03:43 2026 +0200
refactor: rename aligned table consistency validation
commit a9bda90e128ec29bd6401e7aac46b7aeecf1cd9c
Author: ehennestad <ehennestad@gmail.com>
Date: Mon Jun 22 12:49:36 2026 +0200
feat: add aligned dynamic table base
Updated docstrings
LLM assisted docstring tightening
Add test exercising validateUniqueCategoryNames
Add tests for improved coverage
Add test checking that empty datapipe ids are filled if table has/gets established height
ad0fcb0 to
60d8028
Compare
80d8e8f
into
codex/report-schema-violation-context
|
Accidentally merged via merge queue when base was changed from main to another branch because stacking was needed |
Accidentally merged to wrong branch, see PR #837 instead