test(vehicle): cover BLE closures and locks commands#50
Merged
Conversation
added 3 commits
July 9, 2026 19:44
Covers door_unlock, auto_secure_vehicle, charge_port_door_open/close, and the 8 individual door commands (door_lock already had coverage). Live-verify against the test car confirmed door_lock/door_unlock/auto_secure_vehicle round-trip correctly; charge_port_door_* and 7 of 8 individual doors are deferred (see AGENTS.md gotcha) so this PR ships mocked-transport regression tests for the full group with live-verify status tracked separately.
Records which commands are live-verified (locks) vs unit-test-only pending a captain-present session (charge port cable was engaged; individual doors leave a door physically ajar with no powered close on this Model 3).
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-3 of the BLE production-readiness program: first live-actuation batch for the closures/locks command group (door_lock, door_unlock, auto_secure_vehicle, charge_port_door_open/close, and the 8 individual door open/close commands). This is HOLD-FOR-CAPTAIN: it introduces the first real BLE actuation of the car, testable safely because these are inherited Commands methods already present on VehicleBluetooth (verification work, not new command implementations).
Delivered: mocked-transport regression tests (tests/test_ble_mocked_closures_locks.py) covering all 12 commands in the group, following the existing MockedBleTransportTestCase pattern from PR-0/1. door_lock already had coverage in test_ble_mocked_commands.py.
Live verification against the real car (VIN LRW3F7EK4NC716336, Model 3, via the git-excluded scripts/ble-harness/ helper and m5-btproxy.local): door_lock, door_unlock, and auto_secure_vehicle were each live-verified with a full snapshot->act->verify->restore->confirm cycle and all passed. Deliberate scope reduction, confirmed with the human operator (firstmate/captain) before shipping:
Also fixed, along the way: a real bug in the (git-excluded, not part of this diff) live-test harness script (scripts/ble-harness/ble_harness.py) - its door_lock/door_unlock CommandSpec restore conditions were inverted, which caused one real restore failure during testing (the harness tried to unlock the car when it should not have). This was caught immediately, the car was manually confirmed re-locked via a read-only state check before any further testing, and the harness logic was corrected before continuing. This harness fix is NOT part of the shipped diff (the directory is git-excluded local tooling) but is noted here for context on why one of the live-test transcripts shows a transient restore failure that was not a library bug.
Documentation: added a 'BLE individual-door powered-close gotcha' entry to AGENTS.md documenting the no-powered-close finding for future crews (e.g. the captain-present PR-CAP session), and a live-verify-status docstring in the new test module clarifying which commands are live-verified vs. unit-test-only-pending-captain-session.
End state: car confirmed locked (door_lock/door_unlock/auto_secure_vehicle tests left it locked); the rear passenger door required a human to physically push it shut after the live probe (outside the scope of anything further I could do remotely).
What Changed
door_unlock,auto_secure_vehicle, charge-port door open/close, and the 8 individual Bluetooth door commands, including signed VCSEC payload assertions.VehicleBluetoothindividual door docstrings and Bluetooth docs so close-command OK acknowledgements are not treated as proof that a door physically latched.Risk Assessment
✅ Low: The change is limited to mocked BLE regression tests and a documentation note, with no runtime library behavior changed.
Testing
Targeted mocked BLE closures/locks tests passed, a reviewer-visible JSON transcript was generated showing public API calls, success responses, routed VCSEC domain, and decoded payloads for all commands in scope, then the full test suite passed.
Evidence: BLE closures/locks mocked API transcript
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_ble_mocked_commands.py::DoorLockTests tests/test_ble_mocked_closures_locks.pyGenerated/tmp/no-mistakes-evidence/01KX34DE1QENP22ECF5C21GS3R/ble_closures_locks_mocked_api_transcript.jsonby exercising eachVehicleBluetoothclosures/locks method against the mocked BLE transport and decoding the signed VCSEC payloadsuv run pytest tests✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.