daf truncation bugs#677
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the robustness and correctness of DAF file handling, particularly concerning data truncation and persistence. It addresses critical bugs that led to data corruption and incorrect record counts after truncation, while also improving the stability of the truncation process for various data sizes. The changes enable more reliable and flexible manipulation of DAF files, allowing for operations like re-truncation and proper handling of small datasets. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request fixes a data offset issue in the DAF::persist function and corrects indexing logic in the Type2ChebyshevSet and Type3ChebyshevSet data types. Specifically, the end_idx calculation and num_records assignment were adjusted to prevent potential panics and ensure correct data slicing. The review comments suggest improving the DAF::persist function by handling errors gracefully with IoResult instead of using .unwrap(), and point out a remaining off-by-one error in the end_idx calculation for Chebyshev data sets, where a 1-based index from spline_idx is not correctly converted to a 0-based index for slicing.
|
Thanks for the bug fix, @themouli ! I'm surprised that the off by one at the end of the chebyshev segments wasn't caught in the validation test cases since these should cover the full ephem definition. I think there is (or was?) a test case that checked the Thanks |
|
Hello @ChristopherRabotin, thanks for letting me know about the test case. The test ( The summary headers were written correctly, but the actual Chebyshev coefficient data was written at the wrong byte offset. The new test loads the files as an actual SPK, queries an epoch within the truncated range, and verifies a non-zero result comes back. The query would fail with a decoding error or return garbage data (not checked in the last test). Thanks |
d219424 to
1b5f3a9
Compare
|
Fixed the formatting issue and squashed the commits. |
Summary
num_recordscalculation after Chebyshev truncation (chebyshev.rs,chebyshev3.rs), which caused the last record to be unreachable in truncated segmentspersist()(daf.rs), which wrote data starting 1024 bytes too late, corrupting the file structure and making truncated files unqueryable. Closes Truncation and removal of DAF data corrupt data (summaries OK) #262end_idxintruncate()to prevent panics when truncating segments with few records (e.g. Mercury/Venus relative to their barycenters, or any body truncated to its full time range)Improvements
Bug Fixes
#262
Testing and validation