feat(proto): sync command protobuf definitions - #46
Merged
Conversation
added 2 commits
July 9, 2026 17:44
…n.proto Semantic-diffed the library's proto/ against Teslemetry/api's src/proto/command/ (Release 944). Most shared protos were already identical; the only real deltas were three new UniversalMessage.Domain enum values and the session.proto file the library was missing. - Add session.proto (Session.SessionStore) with its google/protobuf timestamp import, following the existing proto/tesla/ namespacing convention in tools/regenerate_protos.sh. - Add DOMAIN_AUTHD, DOMAIN_ENERGY_DEVICE, DOMAIN_ENERGY_DEVICE_AUTH to universal_message.proto's Domain enum. - vcsec.proto's diff was pure formatting (brace/indent style); no semantic changes needed. car_server.proto already carries SetLowPowerModeAction/SetKeepAccessoryPowerModeAction that the api tree lacks, so it was left untouched. teslapower.proto stays as the library-specific, non-generated proto it already was. - Regenerated Python bindings with protoc v32.0 (matching the HA-compatible 6.32.0 gencode pin documented in AGENTS.md).
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
Rationalize this library's protobuf definitions against the newer Teslemetry/api command protos (fresh clone of Teslemetry/api, Release 944, at /home/brett/firstmate/projects/api/src/proto/command/, read-only reference) and bring the library's proto/ sources and generated Python bindings up to date. Pure proto/codegen task - deliberately does not touch the vehicle/BLE command classes (tesla_fleet_api/tesla/vehicle/*), which a separate crew owns.
Did a full semantic diff of all 9 shared proto files (common, errors, keys, managed_charging, signatures, vehicle, car_server, universal_message, vcsec) plus checked for protos present in one tree but not the other:
Regeneration: no protoc was on PATH in this environment, so downloaded protoc v32.0 specifically (matching this library's documented HA-compatibility pin: gencode must be stamped <= 6.32.0 to match Home Assistant core's protobuf==6.32.0 pin, and protoc vX.Y stamps gencode 6.X.Y under unified protobuf versioning). Added session.proto to the PROTOS array and the 'own' import-rewrite set in tools/regenerate_protos.sh (the library's own documented codegen mechanism - found via that script's header comment), then ran it to regenerate all _pb2.py/_pb2.pyi files. Also manually added 'from . import session_pb2' to the hand-maintained tesla_fleet_api/tesla/vehicle/proto/init.pyi stub (this file is not touched by the regen script) for consistency with the other pb2 modules.
Verified: fresh Python import of the new/changed modules works, confirmed the new Domain enum values and SessionStore message are present at runtime, full existing pytest suite (58 tests) passes, pyright strict mode reports 0 errors, ruff check passes. Reverted unrelated uv.lock/egg-info version drift (1.5.2 -> 1.5.4) that running 'uv run' commands caused as a side effect - that drift predates this task and is out of scope.
What Changed
session.protosource plus generatedsession_pb2bindings and exported the new module from the proto package stub.universal_message.protoand generated bindings with the newDOMAIN_AUTHD,DOMAIN_ENERGY_DEVICE, andDOMAIN_ENERGY_DEVICE_AUTHenum values.session.protois included in future protobuf code generation.Risk Assessment
✅ Low: The change is narrowly scoped to protobuf source updates, generated bindings, and regeneration script wiring, with no material correctness, packaging, or compatibility issues found in the reviewed diff.
Testing
Exercised the existing pytest suite plus an end-user style Python import/serialization check showing the new protobuf enum values and
SessionStorebinding work at runtime; all checks passed and the worktree was cleaned afterward.Evidence: Runtime protobuf 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 testsCreated/tmp/no-mistakes-evidence/01KX2XG5GW600W025MRRS76KMQ/proto_runtime_evidence.txtby importinguniversal_message_pb2andsession_pb2, checking the new Domain enum values against the Teslemetry/api reference proto, round-tripping aRoutableMessageusingDOMAIN_ENERGY_DEVICE, round-trippingSessionStore, and confirming the generated protobuf stamp is(6, 32, 0).Cleaned transient test artifacts from the worktree and confirmedgit status --shortwas clean.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.