Skip to content

Load the published reserved_tags.json and apply all of its rules - #915

Merged
VisLab merged 3 commits into
hed-standard:mainfrom
VisLab:reserved_fixes
Oct 17, 2026
Merged

VisLab merged 3 commits into
hed-standard:mainfrom
VisLab:reserved_fixes

Conversation

@VisLab

@VisLab VisLab commented Oct 17, 2026

Copy link
Copy Markdown
Member

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.

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>
@VisLab VisLab added tests Issues related to testcases validation Tag validation issues javascript Pull requests that update Javascript code required-update labels Oct 17, 2026
@VisLab
VisLab requested a balanced review from Copilot October 17, 2026 14:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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

Comment thread src/parser/parsedHedTag.js Resolved
Comment thread src/parser/reservedChecker.js Resolved
Comment thread src/parser/reservedChecker.js Resolved
- 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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new unit helper rejects exact compound-unit names, preventing valid factorless default-unit conversions.

1 open issue
3 resolved since last review

Review effort: Balanced

Comment thread src/schema/entries.js Resolved
…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>
@VisLab
VisLab merged commit 9bbe86c into hed-standard:main Oct 17, 2026
14 checks passed
@VisLab
VisLab deleted the reserved_fixes branch October 26, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update Javascript code required-update tests Issues related to testcases validation Tag validation issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants