Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: decoder component expansion #474

Merged
merged 7 commits into from
Oct 4, 2024
Merged

Conversation

muktihari
Copy link
Owner

@muktihari muktihari commented Oct 3, 2024

Previous implementation of component expansion does not accommodate containing field's value more than 32 bits. This results in expanding incorrect components for messages that has more than 32 bits such as "Hr" event_timestamp_12 (up to 120 bits) and "RawBbi" data (up to 240 bits).

By design, field's value requiring expansion can hold up to 255 bytes (2040 bits) data, this is obviously way more bits than Go's primitive single value can hold. To handle this, I implement new type "bits" struct that can store up to 2048 bits data, enable us to do bitwise operation over it for component expansion.

To test the correctness, I use sample data from "testdata/from_official_sdk/activity_poolswim_with_hr.csv", as it contains 96 bits data to be expanded and the new implementation produces the correct values as in the CSV file.

@muktihari muktihari added the bug Something isn't working label Oct 3, 2024
@muktihari muktihari added this to the Unreleased milestone Oct 3, 2024
@muktihari muktihari self-assigned this Oct 3, 2024
@codecov-commenter
Copy link

codecov-commenter commented Oct 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.94%. Comparing base (aa68a94) to head (3e8383d).

Additional details and impacted files
@@           Coverage Diff            @@
##           master     #474    +/-   ##
========================================
  Coverage   99.94%   99.94%            
========================================
  Files          42       42            
  Lines        3689     3816   +127     
========================================
+ Hits         3687     3814   +127     
  Misses          2        2            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@muktihari muktihari marked this pull request as ready for review October 4, 2024 06:08
@muktihari muktihari merged commit 26b9f79 into master Oct 4, 2024
5 checks passed
@muktihari muktihari deleted the fix/decoder-component-expansion branch October 4, 2024 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants