fix(vehicle): document BLE read limits and cover state readers#49
Merged
Conversation
added 3 commits
July 9, 2026 18:57
…icle_data() to all endpoints Covers the PR-2 read-path gap: every BLE state reader now has a mocked-transport regression test, and vehicle_data(endpoints=None) defaults to all BLE endpoints (matching the cloud vehicle_data() ergonomics) with the proto-vs-REST divergence and the live-verified response-size cap documented in the docstring.
…default A no-arg vehicle_data() defaulting to every endpoint reliably raises TeslaFleetMessageFaultResponseSizeExceedsMTU on real hardware (a multi-endpoint composite call overflows the vehicle's own signed-command response-size cap) - a footgun for a public method. endpoints stays required; the cap and the per-substate-reader/narrow- subset workaround remain documented, with auto-chunking noted as a possible future enhancement rather than implemented here.
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-2 of the BLE production-readiness program (read-path completeness + vehicle_data ergonomics), scoped SAFE-TO-SELF-MERGE (read-only + additive + docs, no actuation). Added mocked-transport regression tests for all 14 BLE state readers (vehicle_state, charge_state, climate_state, drive_state, location_state, closures_state, charge_schedule_state, preconditioning_schedule_state, tire_pressure_state, media_state, media_detail_state, software_update_state, parental_controls_state, vehicle_data) in tests/test_ble_mocked_state_readers.py, plus a new vcsec_vehicle_status_reply() helper in tests/ble_mocked_transport.py. Live-verified all 13 individual readers read-only against the real car (m5-btproxy.local, VIN LRW3F7EK4NC716336) with well-formed protos - no actuation command was ever sent.
Initially made BLE vehicle_data(endpoints=None) default to 'all BLE endpoints' to mirror the cloud vehicle_data() ergonomics, per the master plan's PR-2 scope. Live testing then surfaced a real vehicle-side constraint: the vehicle's signed-command implementation enforces its own response-size cap independent of BLE transport chunking - a composite vehicle_data() call requesting 2+ endpoints together (including the all-endpoints default) reliably raises TeslaFleetMessageFaultResponseSizeExceedsMTU, while single-endpoint calls and the individual per-substate readers succeed fine. The user reviewed this finding and explicitly rejected the all-endpoints default as a footgun for a public method that would always fault when called with no args. Per their direction, I reverted vehicle_data() to require endpoints as before (no default), kept the MTU-cap docstring documentation, and noted multi-endpoint auto-chunking (split under the cap, merge replies) as a possible future enhancement without implementing it. AGENTS.md was updated with both the response-size-cap gotcha and a new infotainment-boot-delay gotcha (wake_up() acks before infotainment is ready; first INFO read after waking may need a short wait/retry) discovered during live verification.
Deliberate scope boundaries: no actuation commands were touched or tested; no transport/chunking behavior changes were implemented (documented as future work only); the git-excluded scripts/ble-harness/ directory (restored from a snapshot, extended with a read-only 'readall' subcommand) is intentionally out of the PR diff.
What Changed
vehicle_data()decoding.vehicle_data()endpoints explicit and documented the vehicle-side response-size cap that makes multi-endpoint BLE reads fail withTeslaFleetMessageFaultResponseSizeExceedsMTU.Risk Assessment
✅ Low: The final branch diff is narrowly scoped to BLE vehicle_data documentation, AGENTS notes, and mocked read-path tests, with no production behavior change introduced in this range.
Testing
Inspected the BLE/doc/test diff, ran the focused 14-reader mocked BLE regression suite, generated reviewer-visible JSON evidence from mocked end-to-end reader calls showing domains/request fields/reply types, then ran the full test suite; all tests passed, and transient worktree artifacts from testing were cleaned up.
Evidence: BLE state-reader request/response evidence
JSON evidence records 14 BLE read paths. It shows each substate reader sent one mocked signed read request, with INFO-domain GetVehicleData fields for individual readers, VCSEC GET_STATUS for vehicle_state, and explicit single-endpoint vehicle_data([BluetoothVehicleData.CHARGE_STATE]).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.
git diff --stat c28d86eccc27f03f5335b3c5243a42043ef44b83..d10ca630acb7bf1581cf4b0dfd27c1c32a3976e3git diff c28d86eccc27f03f5335b3c5243a42043ef44b83..d10ca630acb7bf1581cf4b0dfd27c1c32a3976e3 -- tesla_fleet_api/tesla/vehicle/bluetooth.py tests/ble_mocked_transport.py tests/test_ble_mocked_state_readers.py AGENTS.mduv run pytest tests/test_ble_mocked_state_readers.py -vvuv run python /tmp/no-mistakes-evidence/01KX31WFX8ABB4FQ17RSPW776E/ble_state_reader_evidence.py > /tmp/no-mistakes-evidence/01KX31WFX8ABB4FQ17RSPW776E/ble_state_reader_evidence.jsonuv run pytest tests✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.