Skip to content

M6 Bluetooth core, part A - #41

Merged
Bre77 merged 7 commits into
milestone/m5a-routerfrom
milestone/m6a-ble-core
Nov 2, 2026
Merged

Bre77 merged 7 commits into
milestone/m5a-routerfrom
milestone/m6a-ble-core

Conversation

@Bre77

@Bre77 Bre77 commented Nov 2, 2026

Copy link
Copy Markdown
Member

Bluetooth core, part A: the ./bluetooth entry, VehicleBluetooth over any BleTransport, and the confirmation ladder. No hardware has run this; every result below is against FakeBleLink and FakeVehicle.

Issue State
ENG-21 BLE-06 framing Done. All test_ble_reassembling_buffer.py cases and the doc 04 vectors pass.
ENG-58 BLE-07 transport and fake link Done. MTU 23 and 115 round trips, GATT call log, ESM and CJS consumers.
ENG-63 BLE-08 VehicleBluetooth core Done, except the test_ble_connect_failover.py cases that need BLE-12 (wake_up with wait) and BLE-15 (pair).
ENG-68 BLE-09 keepalive and status Done. No timer survives disconnect, checked with fake timers.
ENG-69 BLE-10 broadcast listeners Done.
ENG-74 BLE-11 confirmation ladder Done, except the doc 05 section 14 charge-port row, which is BLE-13.

Left for BLE-12: wake_up({ wait: true }) raises BluetoothTimeout, and wakeForCommand turns that into BluetoothCommandFailed, so a sleeping car with wake_if_asleep on fails safely with nothing sent. An awake car whose infotainment handshake timed out drops the link and raises, without the 20 s boot retry.

Homey fit. The core has no GATT dependency or native module. Every backend call is bounded here. maxWriteSize left out means 20 bytes. A connect that lands after its attempt was abandoned is closed, because the vehicle has three slots. A read timeout, or a failed write followed by a silent reply window, marks the link lost whatever isConnected says.

Where this differs from Python, on purpose:

  • sameFloat in verify plans: Python compares float32 with float32, but Node would compare the caller's double with the decoded float32, and report a command that ran as failed.
  • A state field the reply left out counts as an unreadable read. Python compares the proto default, which can falsely confirm or fail a command.
  • A mismatching broadcast only proves failure if the whole window ran out. A lost link ends Node's reply wait early, so it stays unconfirmed.
  • A keepalive read that times out marks the link lost, with no reconnect and no raise. Python only drops the read.
  • connect scans when no device is known (doc 05 calls this deliberate), and a not-found scan raises BluetoothTransportError, not ValueError.
  • connect() on a live link does nothing, where Python would open a second link.
  • confirmation's deprecated aliases are not ported; optimistic and verify_commands remain as read-only views.

Readers charge_state, climate_state, media_state and vehicle_state are here because verify plans need them. BLE-14 adds the rest.

test/helpers/fakevehicle.ts now addresses replies to the sender as a real car does, answers a VCSEC status read when vehicleStatus is set, and records decrypted commands.

🤖 Generated with Claude Code

Bre77 and others added 6 commits November 2, 2026 13:54
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 56 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 89 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML; Path: .coderabbit.yaml
  • Review profile: CHILL
  • Plan: Team
  • Run ID: fac60a54-eae3-45a7-bdec-eee407965530
Commits

Reviewing files that changed from the base of the PR and between 0e57cb8 and 5ab503e.

Files selected for processing: 32
  • .changeset/ble-broadcast-listeners.md
  • .changeset/ble-confirmation-ladder.md
  • .changeset/ble-framing.md
  • .changeset/ble-keepalive.md
  • .changeset/ble-transport.md
  • .changeset/ble-vehicle-core.md
  • AGENTS.md
  • package.json
  • src/bluetooth/async.ts
  • src/bluetooth/broadcast.ts
  • src/bluetooth/constants.ts
  • src/bluetooth/framing.ts
  • src/bluetooth/index.ts
  • src/bluetooth/names.ts
  • src/bluetooth/teslabluetooth.ts
  • src/bluetooth/transport.ts
  • src/bluetooth/vehiclebluetooth.ts
  • src/bluetooth/verify.ts
  • test/bluetooth/broadcast.test.ts
  • test/bluetooth/entry.test.ts
  • test/bluetooth/framing.test.ts
  • test/bluetooth/keepalive.test.ts
  • test/bluetooth/ladder.test.ts
  • test/bluetooth/transport.test.ts
  • test/bluetooth/vehiclebluetooth.test.ts
  • test/consumers/cjs.cjs
  • test/consumers/esm.mjs
  • test/helpers/blevehicle.ts
  • test/helpers/fakeblelink.ts
  • test/helpers/fakevehicle.ts
  • test/proto-coverage-lock.test.ts
  • tsdown.config.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Drops the three readers this branch landed from the coverage lock's pending list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Bre77
Bre77 changed the base branch from milestone/m3a-signed-core to milestone/m5a-router November 2, 2026 04:28
@Bre77
Bre77 added this pull request to stack #43 November 2, 2026 04:29
@Bre77
Bre77 merged commit 208b368 into main Nov 2, 2026
4 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.

1 participant