Skip to content

fix: Complete VSRI implementation and improve code quality#150

Open
cjrolo wants to merge 12 commits intomainfrom
vsri-improvements
Open

fix: Complete VSRI implementation and improve code quality#150
cjrolo wants to merge 12 commits intomainfrom
vsri-improvements

Conversation

@cjrolo
Copy link
Collaborator

@cjrolo cjrolo commented Jan 16, 2026

Summary

Completes the VSRI (Very Small Rolo Index) implementation by fixing critical bugs and improving code quality across the codebase.

VSRI Fixes

Critical Bug Fixes

  • Fix float division bugs in get_sample() and fits_segment()
    • Integer division was producing incorrect results when timestamps didn't align exactly
    • Now checks for exact alignment with modulo operator before dividing
  • Improve error handling in load() function
    • Replace unwraps with proper error propagation
    • Provide clear error messages for invalid data

Documentation & Configuration

  • Document MAX_INDEX_SAMPLES as configurable
  • Fix doc test imports
  • Fix clippy warning for empty line after doc comment

Code Quality Improvements

  • Replace BinConfig struct with bincode_config() function
  • Remove unused constants: POLYNOMIAL_COMPRESSOR_ID, IDW_COMPRESSOR_ID
  • Remove unused vsri import from main.rs
  • Fix clippy warnings (needless borrows, into_iter on ref)

Testing

  • All 85 tests passing
  • Clippy clean with -D warnings

Related Issues

Addresses VSRI completion as part of repository modernization (#7, #9, #11 related)

cjrolo and others added 12 commits October 21, 2024 23:30
VSRI Fixes:
- Fix float division bugs in get_sample() and fits_segment()
- Improve error handling in load() - replace unwraps with proper error propagation
- Document MAX_INDEX_SAMPLES as configurable
- Fix doc test imports and empty line after doc comment

Code Quality Improvements:
- Replace BinConfig struct with bincode_config() function
- Remove unused POLYNOMIAL_COMPRESSOR_ID and IDW_COMPRESSOR_ID constants
- Remove unused vsri import from main.rs
- Fix clippy warnings (needless borrows, into_iter on ref)

All tests passing (85 tests total)
Clippy clean with -D warnings
Fixes identified in PR #150 review:

1. **VSRI Frame Tagging**: CompressorFrame::compress_vsri now correctly
   sets self.compressor = Compressor::VSRI so VSRI data is properly
   tagged in serialized files

2. **VSRI Decompression**:
   - Added CompressorFrame::decompress_vsri() method
   - Added CompressedStream::decompress_vsri() method
   - Added CompressorFrame::is_vsri() helper method
   - VSRI files can now be round-tripped successfully

3. **CLI Safety**: Removed VSRI from CompressorType enum to prevent
   users from selecting --compressor=vsri which would cause panic
   - VSRI is for internal timestamp compression only
   - Not applicable to f64 data compression

4. **Better Error Handling**: Changed Compressor::decompress VSRI case
   from panic to log warning and return empty vec, allowing graceful
   handling if VSRI frame is accidentally processed as f64

Testing:
- Added test_vsri_roundtrip test to verify complete cycle
- All 86 tests passing
- Clippy clean with -D warnings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant