fix(cpn): initialise all serialised fields in FrSkyData::clear() - #7440
Merged
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthrough
ChangesFrSkyData field initialization on clear
Estimated code review effort: 1 (Trivial) | ~3 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
FrSkyData::clear() resets its fields one by one rather than with a memset, and it omitted varioCenterSilent and ignoreSensorIds. Both are serialised to a model's YAML, so a freshly-cleared model emitted whatever happened to be in those bytes. For varioCenterSilent (a bool written as int, read back through a 1-bit radio field) this showed up as a non-idempotent round-trip: a stray byte like 45 was emitted, then masked to 1 on reload. Initialise both fields in clear(). Add a regression test that poisons the storage before clearing, so it fails deterministically if a serialised field is ever left out again. Found via the model YAML round-trip test added in #7438; the regression test here builds/runs once that PR reactivates the companion gtests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pfeerick
force-pushed
the
fix-frsky-clear-uninit-fields
branch
from
July 13, 2026 00:14
d99d9c6 to
ea0e11f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FrSkyData::clear()resets its members field-by-field (not viamemset), and it omittedvarioCenterSilentandignoreSensorIds. Both are serialised to a model's YAML, so a freshly-cleared model emitted whatever bytes happened to be in those fields.For
varioCenterSilent(aboolwritten asint, read back through the radio's 1-bit field) this manifested as a non-idempotent YAML round-trip: a stray byte such as45was emitted on the first save, then masked to1on reload — sosave → load → savedid not converge.Fix
Initialise both fields in
clear():Regression test
companion/src/tests/frsky_clear_test.cpppoisons the storage (memset(..., 0x2D, ...)) before callingclear()and asserts both fields are reset, so it fails deterministically if a serialised field is ever left out ofclear()again.Verified locally (on the harness branch): the test fails before the fix and passes after.
Notes
main(the harness is reactivated by refactor(cpn): introduce BoundedString<N> for ModelData string fields #7438). The regression test here therefore builds and runs in CI once refactor(cpn): introduce BoundedString<N> for ModelData string fields #7438 lands; the fix itself is independent and compiles onmaintoday (thefirmwareslibrary builds cleanly).🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests