Skip to content

fix: stats semver wire alignment using a zero sentinel#3036

Open
atharvalade wants to merge 4 commits intoapache:masterfrom
atharvalade:fix/map-stats-semver-misalignment-2979
Open

fix: stats semver wire alignment using a zero sentinel#3036
atharvalade wants to merge 4 commits intoapache:masterfrom
atharvalade:fix/map-stats-semver-misalignment-2979

Conversation

@atharvalade
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #2979

Rationale

Stats wire encoding could omit iggy_server_semver when None, while multiple deserializers assume a fixed 4-byte semver slot (0 sentinel), risking downstream field misalignment.

What changed?

When semver was None, the binary stats encoder could skip semver bytes (and in protocol encoder also skip tail fields), which could shift subsequent fields for decoders expecting fixed layout.
Now semver is always encoded as 4 bytes using 0 as the sentinel for None, and tail fields (threads_count, free_disk_space, total_disk_space) are always encoded.
The stats decoder now normalizes semver 0 back to None, and tests were updated/added to lock this layout and sentinel behavior.

Local Execution

  • Passed
  • Pre-commit hooks not ran

AI Usage

  • Opus 4.6
  • exploration and identification
  • ran cargo fmt --check, cargo clippy, targeted cargo test -p iggy_binary_protocol responses::system::get_stats, and repository CI scripts for trailing whitespace/newline and license headers
  • yes all code can be explained

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 87.09677% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.74%. Comparing base (411a697) to head (f4f152b).

Files with missing lines Patch % Lines
.../binary_protocol/src/responses/system/get_stats.rs 87.09% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3036      +/-   ##
============================================
- Coverage     71.74%   71.74%   -0.01%     
  Complexity      943      943              
============================================
  Files          1121     1121              
  Lines         93800    93795       -5     
  Branches      71124    71130       +6     
============================================
- Hits          67301    67291      -10     
+ Misses        23863    23852      -11     
- Partials       2636     2652      +16     
Components Coverage Δ
Rust Core 72.35% <87.09%> (-0.01%) ⬇️
Java SDK 62.30% <ø> (ø)
C# SDK 67.43% <ø> (-0.21%) ⬇️
Python SDK 81.43% <ø> (ø)
Node SDK 91.44% <ø> (+0.12%) ⬆️
Go SDK 38.68% <ø> (ø)
Files with missing lines Coverage Δ
.../binary_protocol/src/responses/system/get_stats.rs 86.90% <87.09%> (-0.24%) ⬇️

... and 21 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@atharvalade atharvalade force-pushed the fix/map-stats-semver-misalignment-2979 branch from f617351 to ad1fa0a Compare March 27, 2026 15:46
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.

map_stats skips writing iggy_server_semver when None, risking binary stream misalignment

3 participants