fix(vehicle): correct BLE navigation GPS command encoding#54
Merged
Conversation
added 3 commits
July 9, 2026 21:57
Live-verified navigation_request, navigation_gps_request, navigation_sc_request, navigation_waypoints_request, navigation_gps_destination_request, dashcam_save_clip, flash_lights, set_keep_accessory_power_mode, and set_low_power_mode against the test car in one held BLE connection - all ACKed OK. Fixed a real bug found live: navigation_gps_request called the protobuf nested enum wrapper as if it were callable, raising TypeError on every attempt before a message was ever sent.
e0214e1 to
8a35dfb
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.
Intent
PR-8 of the BLE production-readiness program: live-verify the NAV/dashcam/power-mode command group over the real BLE transport. Live-verified all 11 target calls (navigation_request, navigation_gps_request, navigation_sc_request, navigation_waypoints_request, navigation_gps_destination_request, dashcam_save_clip, flash_lights, set_keep_accessory_power_mode on+off, set_low_power_mode on+off) against the test car (VIN LRW3F7EK4NC716336) over m5-btproxy.local, all in a single held BLE connection using the best-effort-wake + poll-confirm strategy from the resolved decisions doc (wake_up() raises a false-negative BluetoothTimeout that must be caught and ignored, confirmed instead by retrying a state read; hold the connection across the whole batch rather than reconnecting per command). These are all ACK-only ('result: True') ACTUATION commands with no BLE state prover - the nav commands set a harmless destination needing no restore, and the two power-mode commands were deliberately toggled True then False in the same session to leave no lasting state change, per the master plan's classification of this group as benign but still real actuation (HOLD-FOR-CAPTAIN). While live-testing, found and fixed a genuine pre-existing bug: navigation_gps_request built its order field as NavigationGpsRequest.RemoteNavTripOrder(order), calling a protobuf nested-enum wrapper (EnumTypeWrapper) as if it were a callable Python IntEnum - it isn't, so the call raised TypeError before any message reached the car. Fixed by passing order=order directly (with a pyright ignore), matching the already-correct sibling navigation_gps_destination_request. Added tests/test_ble_nav_misc_commands.py with mocked-transport regression coverage for all 9 underlying command methods (proving proto construction and ACK-decoding, including a dedicated regression test for the enum bug), and documented both the wake-false-negative pattern and the enum bug as durable project knowledge in AGENTS.md. No production behavior changed except the one-line bug fix; everything else is test-only.
What Changed
navigation_gps_requestby passing the raw protobuf enum value instead of calling the enum wrapper, matching the working GPS destination path.Risk Assessment
✅ Low: The production change is a narrow one-line protobuf enum construction fix with focused mocked-transport coverage, and I found no material regressions in the surrounding command paths.
Testing
Focused tests passed for all 11 BLE nav/dashcam/power-mode command cases, and the evidence transcript shows each call producing an AES-GCM signed
DOMAIN_INFOTAINMENTcommand with an OK ACK, includingnavigation_gps_requestencoding the raw enum order without the oldEnumTypeWrappercall failure.Evidence: BLE nav/misc decoded command transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
tests/test_ble_nav_misc_commands.py:3- The new test docstring commits the full live test vehicle VIN and local proxy hostname. For a public library, that is unnecessary evidence detail and expands the privacy footprint; redact it to a generic identifier while keeping the live-verification note.🔧 Fix: Redact live test identifiers
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
Inspected the target diff fortesla_fleet_api/tesla/vehicle/commands.pyandtests/test_ble_nav_misc_commands.pyagainst base commit0a8b33cccefb98bcdc5250c6709614378f89a4d8.uv run pytest tests/test_ble_nav_misc_commands.pyGenerated/tmp/no-mistakes-evidence/01KX3B3PZNN8XWG4NBEGKTANKB/ble_nav_misc_command_transcript.jsonby exercising all 11 target BLE command calls throughVehicleBluetoothwith mocked BLE transport, decrypting each signed command, and recording ACK/domain/payload details.Removed transient pytest/cache artifacts created in the worktree after testing.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.