You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Core API: stringly-typed state, null as the only error, no explicit API mode; not yet library-grade #120
One of the master plan's locked decisions is "Library-grade docs and API hygiene from now on". The current core API falls short of that in several ways.
Domain values are strings.
TeslaCommands.Charge.chargingState: String? turns the proto oneof into "Charging", "Complete", … (TeslaCommands.kt#L59-L71).`` Those strings are compared in core (BatterySample.isCharging), in the app (`chargingStateText`), in the CSV, in demo data and in tests.
TeslaConnection.sessions: List<String> holds enum names, and the UI checks contains("DOMAIN_VEHICLE_SECURITY") (MainScreen.kt#L487, BleTrackingService.kt#L121).``
parseActionStatus returns enum.name.
A typo or a rename still compiles and then fails silently. Use enums or the generated Wire types instead.
null is the only error signal.
TeslaSession.import/encrypt/decrypt and TeslaCrypto.decryptGcm (where runCatching{…}.getOrNull() swallows every exception) all return null, whether the cause is a wrong VIN, a bad tag, an exhausted counter or a malformed message. All the app can log is "session verification failed".
Error handling is also inconsistent: some parsers (TeslaVcsec.parse*, TeslaCommands.parse*) throw on malformed input while TeslaPairing catches, so callers wrap everything in runCatching.
Explicit API mode is off. Everything in core is public by default: AntiReplayWindow.updateSlidingWindow, TeslaCrypto.randomBytes, the Metadata hash contexts, the BleFramer constants, and so on. Turn on kotlin { explicitApi() } now and decide what is public before the binary-compatibility validator arrives in Phase 3.
Keying contradicts ADR-0004.
ADR-0004 makes the advertised name the identity and the address an attribute, but BleUiState.connections is keyed by address (BleModels.kt#L58-L72),`` while links are keyed by name.
UI and notification code join the two through vehicle.address lookups.
When an address changes, the old entry stays behind in the state.
The same helper exists several times. There are two private ByteArray.toHex() copies (TeslaBleController.kt#L1446, SettingsScreen.kt#L355), alongside the stdlib toHexString() that Format BLE names with stdlib toHexString #104 adopted in core. Three test files each define their own String.hex().
TeslaConnection.sessions: List<String> still holds enum names, and the UI compares "DOMAIN_VEHICLE_SECURITY" as a string (MainScreen.kt:497, BleTrackingService.kt:227).
ByteArray.toHex() is still duplicated (TeslaBleController.kt:1555, SettingsScreen.kt:513, SessionHandshake.kt:243, PairingFlow.kt:427).
BleUiState.connections is still keyed by address (BleModels.kt:66), against ADR-0004.
No explicitApi() anywhere in the build files.
Not verified: whether the sealed result / typed error item survived the move to :protocol.
Activity
Use enums for charging and shift states (#120)
dzid26 commentedon Oct 21, 2026
Checked against main (8cbaab0) on 2026-10-21.
Done
chargingStateKindandStateKinds.ktin:protocol(ADR-0008), consumed bycore/history/ChargeStateMapping.kt.Still open
TeslaConnection.sessions: List<String>still holds enum names, and the UI compares"DOMAIN_VEHICLE_SECURITY"as a string (MainScreen.kt:497,BleTrackingService.kt:227).ByteArray.toHex()is still duplicated (TeslaBleController.kt:1555,SettingsScreen.kt:513,SessionHandshake.kt:243,PairingFlow.kt:427).BleUiState.connectionsis still keyed by address (BleModels.kt:66), against ADR-0004.explicitApi()anywhere in the build files.:protocol.Keeping this open for the remaining items.
Generated by Claude Code
dzid26 commentedon Oct 21, 2026
Update: the duplicated
ByteArray.toHex()helpers are gone, replaced by the stdlibtoHexString()in #317 (merged as 8ca58f3).Generated by Claude Code