Repository navigation
Make ADC header validation order deterministic - #860
Conversation
tompollard
left a comment
There was a problem hiding this comment.
This fixes #855. The changelog entry needs the same format fix as #858; otherwise it's ready to merge.
What I checked
- The record from my original finding,
n8_evoked_raw_95_F1_R9, now reportsadc_resunder all sixPYTHONHASHSEEDvalues I tried. Onmainit alternated betweenadc_resandadc_zero. - Iterating over
signal_specs.indexcan't drop a field, becausewrite_fieldsis built only from that index. Written headers can't change either, becausewr_header_filealready emits fields inSIGNAL_SPECSorder. - The two other loops over a
setinrecord.pyare harmless. The unsupported-format list is sorted before it's reported, and the mismatched-field loop only deletes keys. - The offline suite (1,716 passed, 4 skipped), Ruff, the strict docs build and CI pass.
Changelog format
changelog.d/deterministic-adc-errors.rst uses a Fixed heading with a bullet rather than the bold heading and indented paragraph in changelog.d/README.rst. When I simulated the release (merging #858, #859 and this PR, then running towncrier build), this entry put a Fixed / ----- pair into docs/changes.rst, and the strict docs build failed with ERROR: Unexpected section title or transition. For example:
**Report invalid ADC fields in a stable order**
Signal header fields are validated in specification order, so a record with
several invalid ADC fields reports the same first error on every run.
tompollard
left a comment
There was a problem hiding this comment.
Thanks, 0272a1c fixes the changelog entry. I reran the release simulation with the current heads of this PR, #858 and #859: merged onto main, towncrier build, then the docs build with -W. The entry renders as a bold heading with its paragraph, and the strict build passes. The code is unchanged since my last review, and CI is green, so this is ready to merge.
Summary
Validate signal header fields in specification order instead of iterating over a set. Records with multiple invalid ADC fields now report the same first error regardless of
PYTHONHASHSEED.The new test supplies invalid
adc_resandadc_zero, checks the selected field order, and verifies that validation reportsadc_resbefore writing a header. This addresses the case in #855.Verification
Closes #855.