Skip to content

fix: handle numeric JSON Code/value from Gen2 Miniservers in all commands - #99

Merged
discostu105 merged 1 commit into
mainfrom
claude/find-fix-bugs-Vykh0
Mar 23, 2026
Merged

fix: handle numeric JSON Code/value from Gen2 Miniservers in all commands#99
discostu105 merged 1 commit into
mainfrom
claude/find-fix-bugs-Vykh0

Conversation

@discostu105

Copy link
Copy Markdown
Owner

Summary

  • The Gen2 numeric JSON fix (14d6e45) only covered xml_attr, otel.rs, and commands/system.rs — but 10 other code paths still used .as_str() on parsed JSON LL/Code and LL/value fields, which returns None when Gen2 sends numeric values (e.g. "Code": 200 instead of "Code": "200")
  • Adds json_val_str() helper that handles string, integer, and float JSON values uniformly, applied across all affected locations
  • Fixes print_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 --check passes
  • cargo clippy -- -D warnings passes
  • cargo build --release succeeds
  • cargo test — all 292 tests pass (199 unit + 93 integration)
  • 5 new tests: json_val_str string/integer/float/null + print_resp with numeric Code
  • Manual test against Gen2 Miniserver: lox on, lox input set, lox token check

https://claude.ai/code/session_01GkGQALMGgpih96DkihUEx5

…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

codecov Bot commented Mar 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 25.00000% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 25.12%. Comparing base (9e86192) to head (7edb4f4).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/token.rs 0.00% 15 Missing ⚠️
src/commands/config_cmd.rs 0.00% 8 Missing ⚠️
src/commands/control.rs 0.00% 4 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            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     
Files with missing lines Coverage Δ
src/main.rs 47.28% <100.00%> (+2.32%) ⬆️
src/commands/control.rs 1.45% <0.00%> (ø)
src/commands/config_cmd.rs 0.00% <0.00%> (ø)
src/token.rs 7.74% <0.00%> (-0.48%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@discostu105
discostu105 merged commit 429aa80 into main Mar 23, 2026
7 checks passed
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.

2 participants