fix: preserve real config data through JSON export/import (M7)#104
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
config_to_json hardcoded display full_update_mC and reserved_pin_2..8 to "0x0", and the binary_input export omitted the 8 GPIO reserved_pins and the reserved blob (which carries the ADC-ladder thresholds and power_off_flags/hold_sec). A binary -> JSON -> binary round-trip therefore silently zeroed real hardware pins and firmware fields. Export the real reserved_pins and full_update_mC, and export the reserved blobs as hex (new _hex_bytes) so unmodeled fields living inside them survive. The import side reconstructs reserved_pins from the per-pin fields and parses the reserved blob via _parse_hex_bytes, which stays backward compatible with legacy "0x0" values. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JRrm95f1qNZzDM9r2SB6KW
8f53d27 to
2c86017
Compare
3 tasks
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
M7 — JSON export silently zeroed real config data (🟠)
config_to_jsonhardcoded displayfull_update_mCandreserved_pin_2..8to"0x0", and thebinary_inputexport omitted the 8 GPIOreserved_pinsand thereservedblob (which carries the ADC-ladder thresholds andpower_off_flags/power_off_hold_sec). So a binary → JSON → binary round-trip written back to a device silently zeroed real hardware pins and firmware fields.Fix
reserved_pins(asreserved_pin_N) andfull_update_mC.reservedblobs as hex (new_hex_bytes) so fields living inside them (ADC thresholds, power-off) survive without being individually modeled.reserved_pinsfrom the per-pin fields and parses the reserved blob via_parse_hex_bytes, which stays backward compatible with legacy"0x0"values (parsed as all-zero bytes).Test plan
uv run pytest -q→ 446 passed (3 new: display pins/full_update_mC/reserved survive round-trip, binary_input pins + reserved blob survive, legacy"0x0"still parses as zeros)ruff,mypyclean🤖 Generated with Claude Code