Accept header-end and field-end lines with no space after the '#' - #7
Merged
Merged
Conversation
The specification defines both separators as
comment token + separator token + end-of-line token
where the separator token is "three or more" dash or slash characters.
No whitespace token sits between the comment token and the separator
token. The validator required one:
regex_header_end = r"^#\s+---(-*)$"
regex_fields_end = r"^#\s+///(/*)$"
so a conforming file written "#-----" was rejected outright, with
"Header-end line ('# ---') not found. Analysis can't proceed."
This is not a hypothetical reading of the grammar. 258 of the 272 files
in the XAS Data Library -- the reference collection published by the XDI
working group itself -- write the header-end line as "#-----" with no
space. Every one of them failed to parse. Running the validator over
that collection now yields zero header-end failures where before it
yielded 272.
The spec's illustrative example does show a space, and that form keeps
working; the change only stops requiring it. Fewer than three dashes,
or a leading "##", are still rejected.
The field-end separator has the identical defect. No file encountered
writes it without a space, so nothing observed is fixed by that half of
the change -- it is included because it is the same bug in the same
grammar rule, and leaving one of the two would be arbitrary.
Adds tests/separators_without_space.xdi, which is valid.xdi with both
separators unspaced, and asserts both forms validate clean.
Note: tests/test_WrongFields.py::test_invalid_column fails both before
and after this change, on unmodified main. It expects the error key
"column['1']" where the validator produces "column.1". Left alone as
unrelated.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Owner
|
Thank you. We can not reproduce the error you mentioned related to test |
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 problem
The specification defines both separator lines as
where the header-end token is "three or more dash characters" and the field-end token is "three or more forward slash characters". No whitespace token sits between the comment token and the separator token.
The validator requires one:
so a conforming file written
#-----is rejected outright withHeader-end line ('# ---') not found. Analysis can't proceed.Why it matters in practice
258 of the 272 files in the XAS Data Library write the header-end line as
#-----with no space. That is the reference collection published by the XDI working group. Every one of those files failed to parse.Measured over the whole collection:
The remaining validation errors in that collection are genuine data non-conformance — non-ISO
Scan.start_time,Sample.temperaturewritten asroom temperaturerather than float + units — and are untouched by this change.What changed
The spec's illustrative example does show a space, and that form keeps working — the change only stops requiring it. Fewer than three dashes, or a leading
##, are still rejected.The field-end separator has the identical defect. No file I encountered writes it without a space, so nothing observed is fixed by that half; it is included because it is the same bug in the same grammar rule, and fixing one and not the other would be arbitrary. Happy to drop it if you would rather keep the diff to what is demonstrably broken.
Tests
Adds
tests/separators_without_space.xdi—valid.xdiwith both separators unspaced — and asserts both the spaced and unspaced forms validate clean.tests/test_WrongFields.py::test_invalid_columnfails both before and after this change on unmodifiedmain: it expects the error keycolumn['1']where the validator producescolumn.1. Left alone as unrelated.🤖 Generated with Claude Code