FIX: Improve errors for duplicate tags (issue #738)#739
Merged
Conversation
|
Claude code review could not run. The request to the Claude API failed (possible causes: billing limit reached, token expired, or service unavailable). Review this PR manually. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves duplicate-tag error reporting by ensuring duplicate-tag detection failures are returned as regular Issue objects (instead of thrown exceptions), so BIDS validators can attach context like TSV line numbers and sidecar key/file information.
Changes:
- Catch
IssueErrorthrown duringParsedHedStringnormalization (e.g.,duplicateTag) and return it via the parser’s standard[parsedString, errors, warnings]contract. - Update BIDS JSON-driven tests to assert
duplicateTagissues includetsvLineand/orsidecarKey/filePath, and add targeted regression cases. - Adjust normalizer test expectations to align with the new non-throwing behavior (normalized output becomes
undefinedwhen parsing returnsnull).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/jsonTestData/normalizerTests.data.js | Updates expected normalized output for duplicate-tag failures to match the parser’s new return behavior. |
| tests/jsonTestData/bidsTests.data.js | Adds/updates expected BIDS-wrapped issues so duplicate-tag errors include TSV line numbers and sidecar key/file context; adds regression tests. |
| src/parser/parser.js | Converts IssueError from normalized-form computation into returned parse issues so downstream callers can enrich them with BIDS context. |
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.
The duplicate tag errors were not reporting where the error occurred (e.g., line numbers in tsv and key values in json), only the file in which they occurred and what tags were duplicated.