Repository navigation
Use one channel snapshot for header and signal writes - #848
Conversation
tompollard
left a comment
There was a problem hiding this comment.
Looks good to merge. The signal-value check now uses the same fmt and samps_per_frame snapshot as the header and the encoder, so all three agree.
What I checked
- I wrote every single-segment record in
sample-datawithwrsamp, both uniform and expanded (141 writes), on this branch and on the merge base. Every written file is byte-identical, and the record's fields after writing are unchanged. The 21 writes that fail onmainfail in the same way here. - I ran the new test against
main. Both cases fail there: the value check reads the editedfmt("80") and raisesIndexError, even though the header and the encoder still use "212". On this branch, both pass. - Offline suite (1,662 passed, 4 skipped), Ruff, the strict docs build and CI all pass.
One behaviour change, which I think is an improvement
wrsamp(expanded=True) no longer modifies the record. On main, a samps_per_frame of [None, 1] becomes [1, 1] on the record after writing; on this branch it stays [None, 1]. The header and data files are identical either way. Nothing in the write path reads the list after this point, so a write that leaves its input alone seems better. A direct call to check_sig_cohesion without a snapshot still fills in the defaults, as before.
Optional
- The test only edits
fmt. A second case that editssamps_per_frame[0]after the header would cover the new length check in the expanded branch. - The test could also assert that
samps_per_frameis unchanged after an expanded write, so the behaviour above is deliberate rather than incidental.
|
Thanks for checking the output against the merge base, including all 141 writes. I agree that leaving I added both suggested tests in 38f694a. One changes |
Summary
get_write_fields()lookup from the normal write path. Direct calls without a snapshot retain their existing behavior.This advances #749 and #744. It does not change the public
Recordfields.Validation