Repository navigation
Load the published reserved_tags.json and apply all of its rules - #915
Merged
Merged
Conversation
src/data/json/reservedTags.json is a verbatim copy of the file the HED specification publishes (section 3.2.8, Appendix A.6); the new reserved_tags.yml workflow fails when it drifts from hed-specification main, and .prettierignore keeps the pre-commit formatter off the copy. Every row applies in every standard schema version from 8.0.0: the file's requireValue, tagGroup and topLevelTagGroup supply what the 8.0.0 to 8.2.0 schemas lack on Delay and Duration. - One governing row per group (getGoverningTag): Delay is secondary beside Onset, Offset, Inset or Duration; a bare (Delay/3 s) needs its inner group. - Anchor and inner-group errors carry the row's code (TEMPORAL_TAG_ERROR, DEFINITION_INVALID, TAG_GROUP_ERROR for Event-context); a tag not allowed beside a reserved tag stays TAG_GROUP_ERROR (specification rule 6). - A group holding a column splice defers the anchor and inner-group minimum to the assembled annotation (rule 9); a splice inside a Definition or Event-context group is an error (rule 5, TAG_GROUP_ERROR e). - A bare Delay or Duration is TAG_REQUIRES_CHILD from the file's requireValue; Definition/MyDef/3 is DEFINITION_INVALID (l); the two-part tags come from valueForms; a Def-expand group with extras is DEF_EXPAND_INVALID (f). - HED 8.0.0, whose time units carry no conversionFactor: a Delay or Duration value with no unit or in the default unit written as s, second or seconds converts as is in a timeline table; ms or minute is still TEMPORAL_TAG_ERROR n. - The dead checkNonTopGroups is removed. Tests: tests/otherTests/reservedTags.spec.js (new, 57); spec_tests/hed-tests moves to e2753fb (the reserved-tag cases): testSpecs 1185 passed, 1 skipped (the schema-case block). The hed-specification probe rerun shows no verdict where hed-javascript and hed-python differ, in any of 8.0.0 to 8.4.0. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Splice validation rejects valid templates, and the conversion fallback incorrectly equates unrelated units.
3 open issues
What changed in this PR
Aligns HED validation with the published reserved-tag rules, including support for older schemas.
Changes:
- Loads the published rules and adds a drift-check workflow.
- Updates group, splice, definition-value, and legacy time-unit validation.
- Adds regression tests and updates expected diagnostics.
| File | Description |
|---|---|
types/index.d.ts |
Declares new unit helpers. |
tests/otherTests/reservedTags.spec.js |
Adds reserved-rule regression tests. |
tests/jsonTestData/tagParserTests.data.js |
Updates two-part value cases. |
tests/jsonTestData/stringParserTests.data.js |
Updates group and splice expectations. |
tests/jsonTestData/bidsTests.data.js |
Updates definition diagnostics. |
src/schema/entries.js |
Adds unit-form and conversion helpers. |
src/parser/tagConverter.js |
Enforces reserved-tag values. |
src/parser/reservedChecker.js |
Applies governing-row group rules. |
src/parser/parsedHedTag.js |
Validates value forms and legacy conversions. |
src/parser/definitionChecker.js |
Distinguishes Def-expand structure errors. |
src/issues/data.js |
Adds specific validation diagnostics. |
src/data/json/reservedTags.json |
Adopts the published rules file. |
CHANGELOG.md |
Documents validation changes. |
.prettierignore |
Preserves the published JSON formatting. |
.github/workflows/reserved_tags.yml |
Checks the copy against upstream. |
Review effort: Balanced
- The 8.0.0 default-unit fallback accepts an SI unit of the class only when the default unit is itself SI (second beside s), as hed-python does; a class whose default is not SI (intensityUnits: dB beside candela and cd) accepts only the default. - A column splice may supply the tag that governs a group (Onset beside Delay), so a row that can be secondary tolerates one anchor until assembly; two anchors are still rejected. - An inner group holding only splices may fill or vanish, so only groups with a tag count toward the maximum before assembly, and a splice anywhere in the group defers the minimum and the missing-anchor check. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…exact name is an unmodified form isUnmodifiedForm rejected every compound unit, so in 8.0.0 Speed/3 m-per-s did not convert while Speed/3 did. The exact unit name is accepted first, for compound and simple units alike. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.


src/data/json/reservedTags.json is a verbatim copy of the file the HED specification publishes (section 3.2.8, Appendix A.6); the new reserved_tags.yml workflow fails when it drifts from hed-specification main, and .prettierignore keeps the pre-commit formatter off the copy. Every row applies in every standard schema version from 8.0.0: the file's requireValue, tagGroup and topLevelTagGroup supply what the 8.0.0 to 8.2.0 schemas lack on Delay and Duration.
Tests: tests/otherTests/reservedTags.spec.js (new, 57); spec_tests/hed-tests moves to e2753fb (the reserved-tag cases): testSpecs 1185 passed, 1 skipped (the schema-case block). The hed-specification probe rerun shows no verdict where hed-javascript and hed-python differ, in any of 8.0.0 to 8.4.0.