Repository navigation
Use start and stop in multi-segment read errors - #912
Conversation
tompollard
left a comment
There was a problem hiding this comment.
This fixes #907 as described, and it can merge. I have two small suggestions, neither blocking. The offline suite (2,137 passed, 4 skipped), Ruff and CI pass, and it merges cleanly with #911.
What I checked
On main (a8ad0c4) and on this branch, I compared the errors from read_signals, read_record and read_segments for nine invalid windows:
startequal to or past the length;stoppast the length;- negative
startandstop; - empty and reversed windows;
- non-integer
startandstop.
I ran these on 100, v102s and s25047. The only changes are the six multi-segment read_signals messages that used sampfrom/sampto. Every other message is identical, and no message mentions the legacy names any more.
Suggestions
-
The three readers still word the same mistakes differently. For
v102s:Input read_signals/read_recordread_segmentsstart=225000stop must be greater than start start must be shorter than the record length stop=225001stop must be shorter than the signal length stop must not exceed the record length "stop must be shorter than the signal length" is also slightly wrong, since
stopmay equal the length.read_segments' "must not exceed the record length" is the accurate wording. Using one set of messages for all three modern readers would finish what #907 was after. -
The rewrite now exists three times in
record.py(lines 3688, 3856 and 3886), each matching message prefixes and replacing text. A small helper would remove the copies. Better still,_check_read_inputscould take the argument names to use, so the modern readers never producesampfrom/samptoin the first place. The legacyRecord.check_read_inputscould keep passing its own names. Then the wording fix in suggestion 1 would need changing in only one place.
|
Thanks, both suggestions improve this PR. In 198e15e I moved the legacy-to-modern range translation into one helper and aligned I kept the legacy validator's own wording unchanged so |
Summary
Fixes #907.
read_signalsnow translates legacysampfrom/samptowording to its publicstart/stopnames for invalid windows on multi-segment records. A shared helper keeps the modernread_signalsandread_recordmessages aligned withread_segments, including accurate wording thatstopmay equal the record length. Empty records keep their existing error. This is separate from the format-8 decoding fix in #911.Checks
read_signals,read_record, andread_segments, checking both invalid bounds on single- and multi-segment records.