Repository navigation
Remove temporary writer parity implementations - #898
Conversation
tompollard
left a comment
There was a problem hiding this comment.
This removes the temporary comparison code cleanly: 1,299 lines out, 187 in. The fixture map covers what the parity test protected, and it can merge. As promised in the map, I ran the independent comparison against main (76468a3) once more, since this is the last point where the old side still exists. Everything matches. The fixture and boundary tests pass (44 passed), as do the offline suite (1,932 passed, 4 skipped), Ruff and the warnings-as-errors docs build.
What I checked
-
All 26 fixture cases come from 5.17.0. I checked out the
v5.17.0tag, copied in this branch's fixture test, and regenerated every case into a temporary folder. All files and bytes match the checked-in fixtures, including the four newlegacy_*cases (Record.wrsampwith calculated physical calibration, expanded digital channels with different samples per frame, a byte offset, and the fixed-layoutMultiRecord.wrsampmaster with its segments). -
Nothing still uses the removed code. The only
_legacynames left insrc/are unrelated public names (deprecated_legacy_name,to_legacy_record). Intests/, the only ones are the fixture generator functions. -
The modern writers match
main:- every readable sample header through
write_recordandSignalRead.write; - 3,000 random sparse records through
write_record; - the 15 invalid header-field cases;
- the 480 flattened multi-segment writes across all four writers.
All file names, bytes and errors are identical.
- every readable sample header through
-
The public
Recordmethods matchmain. I ranrdrecord(..., m2s=True).wrsamp()andrdheader(...).wrheader()on every sample header, pluswrheader,wrsamp,check_field_cohesionandcheck_sig_cohesionon 3,000 malformedRecords. All 12,440 outcomes are identical, including error messages, printed diagnostics, files left behind and the record's state afterwards. This includes then_sig=Nonecases fixed in #897. -
Inputs are unchanged. My 1,464-write
SignalRead.writecheck still shows no changed arrays, masks or retained fields, with the same 232 expected errors.
Minor, non-blocking
In the map, the "All .dat formats" row relies on test_record.py round trips for formats 80, 212, 16 and 24 in expanded layout. Those check values, not bytes. Each of those formats does have a uniform byte fixture (record_inferred_format, masked_mixed_formats and calculated_calibration), and 16 and 212 also have expanded ones. If you want every format pinned in both layouts, format_80_expanded and format_24_expanded cases would complete it. They'd need generating from v5.17.0, like the others. That's optional, since the per-format encoder isn't part of #866.
With this, the writer refactor in #866 is done apart from the benchmark against 5.17.0 and the #744/#749 decision.
|
Thanks for rerunning the independent comparisons, particularly the public I agree the expanded 80 and 24 byte fixtures would complete the format-by-layout matrix. The PR map distinguishes the existing value round trips from fixed-byte coverage, and this change does not touch the per-format encoder, so I'll leave those optional fixtures for a change that needs that extra byte-level guard. All CI checks are green, and #898 is ready to merge. After it lands, I'll run the writer benchmark against 5.17.0 and write up the #744/#749 decision, including why the parallel-list redesign was deferred. |
Summary
Remove the temporary old-versus-new writer implementations and parity test used during #866. Public
RecordandMultiRecordwriting methods remain. DirectRecord.wr_dat_filescalls still use their existing field-based path; its private helper has a descriptive name.Before deleting the comparison path, its last run passed 374 cases and skipped 44 known unreadable sample records. I added fixed-byte fixtures generated with the v5.17.0 tag for
Record.wrsampwith calculated physical calibration, expanded digital channels with different samples per frame, and a byte offset, plus a fixed-layoutMultiRecord.wrsampcase. These join the existing modern writer fixtures.Coverage retained after removing
test_header_encoder_parity.pytest_writer_byte_fixtures.py; the full corpus comparison ran before removal and will be repeated independently against main during review. The full corpus matrix is not a permanent fixture.record_line_detailsfixturemasked_mixed_formatsfixturecalculated_calibration,record_inferred_format, and newlegacy_physical_calibrationfixtures.datformats, uniform and expandedformat_32,format_508,format_516, andformat_524fixtures in both layouts; existingtest_record.pyformat round trips cover the other writable formatsexpanded_mixed_spf,masked_mixed_formats, and newlegacy_expanded_digitalfixtureslegacy_byte_offsetfixturetest_invalid_checksum_declarations_leave_no_filesRecord.calc_checksumtest_write_model_boundaries.py::test_modern_write_does_not_call_record_checksum_methodflattened_multisegmentfixed-byte fixture andtest_signal_roundtrip.py::test_write_flattened_multisegment_view; full-length corpus comparisons remain a review checkraw_skewandaligned_skewfixtures,test_signal_roundtrip.py::test_write_full_raw_skew_view, and the required/declared alignment testswrite_recordavoids aRecordadaptertest_write_model_boundaries.py::test_write_record_does_not_create_a_record_adapterSignalRead.writebyte comparisons (selected and masked)masked_mixed_formats,raw_skew,aligned_skew, andarchivefixtures, plustest_signal_roundtrip.pySignalRead.writeavoidsRecord.wrsamptest_write_model_boundaries.py::test_signal_read_write_does_not_call_record_writerwrite_signalsavoids constructingRecordtest_write_model_boundaries.py::test_write_signals_does_not_construct_a_recordlegacy_fixed_masterfixture and existingvariable_masterfixture; full sample matrix remains a review checktest_writer_byte_fixtures.py::test_invalid_header_errors_match_5_17_0The fixtures compare complete header and signal-file bytes. The archive fixture compares member bytes because ZIP timestamps may vary. No user-visible writer behavior is changed, so there is no changelog entry.
Checks
Part of #866. After this lands, I will benchmark all three writers against 5.17.0, then write up the #744/#749 result-type and channel-metadata decision. The parallel-list change is deferred to that decision.