fix(vehicle): align BLE and cloud command parity#60
Merged
Conversation
added 5 commits
July 10, 2026 13:42
trigger_homelink on the Fleet REST path gated lat/lon with a truthy "if lat and lon" check, silently dropping a valid 0.0 coordinate. The BLE signed-command path already guards with "is not None" and forwards 0.0 correctly, so the two transports built different instructions from the same call. Match the REST path to the BLE semantics and lock the parity in with a cross-transport test.
The Fleet REST adjust_volume rejected out-of-range volumes with a ValueError before building the request; the BLE signed-command path forwarded any float to the vehicle unchecked. Same call, different behavior. Apply the identical 0.0-11.0 guard on the BLE path so both transports reject the same inputs, and extend the cross-transport parity test.
Document the parity contract between the Fleet REST and BLE signed-command paths, the non-bug form differences that must not be "fixed", and the two open divergences (clear_pin_to_drive_admin action mapping, navigation_gps_request order signature) left for live verification.
A docstring should not announce a bugfix; the fix speaks for itself. Restore the original trigger_homelink docstring in both commands.py and fleet.py.
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
BLE program capstone: audit cross-transport parity between the Teslemetry/Fleet cloud REST command path (VehicleFleet) and the BLE signed-command protobuf path (Commands/VehicleBluetooth), verifying that the same Python call builds semantically equivalent vehicle instructions on both transports. Fix genuine parameter-handling mismatches; leave documented form differences and response-body form differences (REST JSON dict vs decoded protobuf) alone.
Two genuine cross-transport bugs found and fixed, one commit each with cross-transport mocked tests:
Deliberate decisions a diff reader won't know: I intentionally did NOT 'fix' several form differences that look like asymmetries but are protocol reality - set_scheduled_departure's preconditioning_enabled/off_peak_charging_enabled (no proto fields), window_control lat/lon and navigation_sc_request id (no proto fields), navigation_request type/locale/timestamp_ms (REST share-intent framing), and media_volume_up (no Tesla REST endpoint, BLE-only). I also deliberately LEFT UNFIXED two suspected divergences that need live car verification and are security/behavior-sensitive: clear_pin_to_drive_admin builds DrivingClearSpeedLimitPinAction (speed-limit PIN, not PIN-to-Drive - suspected mismapping) and navigation_gps_request's order param is required on BLE but optional on cloud (null-order wire semantics undecided). These are documented in AGENTS.md and flagged in the report for the captain rather than changed autonomously. New test file tests/test_cross_transport_parity.py exercises both transports with mocked _request and mocked _send. Live cloud/BLE/stream execution was not driven autonomously (single-held BLE connection, physical-car risk); parity determination is code-authoritative.
What Changed
trigger_homelinkpreserves valid0.0coordinates and BLEadjust_volumeenforces the same0.0-11.0range as the cloud path.Risk Assessment
✅ Low: The branch is narrowly scoped to two parity fixes plus focused mocked coverage, and I did not find material correctness, security, performance, or maintainability risks in the changed code.
Testing
Exercised the new cross-transport parity tests, an evidence-producing mocked cloud/BLE command probe, and the full pytest suite; all passed, with reviewer-visible JSON evidence captured under
/tmp/no-mistakes-evidence/01KX525PX40B34XPPARFMRXD3Y.Evidence: Cross-transport parity evidence
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
uv run pytest tests/test_cross_transport_parity.py tests/test_ble_mocked_media_commands.py -quv run python - <<'PY' | tee /tmp/no-mistakes-evidence/01KX525PX40B34XPPARFMRXD3Y/cross_transport_parity_evidence.jsonuv run pytest tests -q✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.