fix: handle numeric JSON Code/value from Gen2 Miniservers in all commands - #99
Merged
Conversation
…ands The Gen2 numeric JSON fix (14d6e45) only covered xml_attr, otel.rs, and commands/system.rs. Multiple other code paths still used .as_str() on parsed JSON LL/Code and LL/value fields, which returns None when the Miniserver sends numeric values (e.g. "Code": 200 instead of "Code": "200"). Affected code paths: - print_resp: all command responses showed ✗ and "?" on Gen2 - cmd_input set / cmd_set: always reported error on Gen2 - token check/refresh/revoke: showed wrong status on Gen2 - token acquire: keyexchange and gettoken WS flows failed on Gen2 Adds json_val_str() helper that handles string, integer, and float JSON values uniformly. Includes 5 new tests for the helper and Gen2 behavior. https://claude.ai/code/session_01GkGQALMGgpih96DkihUEx5
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #99 +/- ##
==========================================
+ Coverage 24.93% 25.12% +0.19%
==========================================
Files 16 16
Lines 4656 4672 +16
==========================================
+ Hits 1161 1174 +13
- Misses 3495 3498 +3
🚀 New features to boost your workflow:
|
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
xml_attr,otel.rs, andcommands/system.rs— but 10 other code paths still used.as_str()on parsed JSONLL/CodeandLL/valuefields, which returnsNonewhen Gen2 sends numeric values (e.g."Code": 200instead of"Code": "200")json_val_str()helper that handles string, integer, and float JSON values uniformly, applied across all affected locationsprint_resp,cmd_input set,cmd_set,token check/refresh/revoke, and the entire token auth WebSocket flow (keyexchange, gettoken, ws_read_json_value)Test plan
cargo fmt --checkpassescargo clippy -- -D warningspassescargo build --releasesucceedscargo test— all 292 tests pass (199 unit + 93 integration)json_val_strstring/integer/float/null +print_respwith numeric Codelox on,lox input set,lox token checkhttps://claude.ai/code/session_01GkGQALMGgpih96DkihUEx5