fix(proto): pin protobuf gencode to 6.32.0 for Home Assistant compatibility#40
Merged
Conversation
…1.5.2 Home Assistant core pins protobuf==6.32.0, but the 1.5.1 gencode was stamped 6.33.4 and calls ValidateProtobufRuntimeVersion(6, 33, 4, ...), which refuses to load on the 6.32.0 runtime (gencode newer than runtime => VersionError). This forced a core-wide protobuf bump when dropping the library into HA. Regenerate every *_pb2.py under tesla/vehicle/proto/ from the unchanged .proto sources using protoc v32.0 (tools/regenerate_protos.sh with protoc-32.0 on PATH), so the gencode is stamped 6.32.0. Only the version stamp lines change; the serialized descriptors are byte-identical, so this is a pure toolchain/version change with no schema drift. The .pyi stubs are unaffected (no version stamp). Raise the protobuf floor to >=6.32.0 to match the gencode: gencode 6.32.0 requires the runtime to be >= 6.32.0, so the previous >=6.31.1 floor was unsafe (a resolved 6.31.1 would VersionError at import). The floor is not raised above 6.32.0, so HA's exact pin still satisfies it. No upper cap: protobuf 7.x loads major-6 gencode without error, so a <7 cap would only exclude valid runtimes. Document the reproducible regen (protoc v32.0 -> 6.32.0 gencode, and the floor-must-match-gencode rule) in AGENTS.md. Bump version 1.5.1 -> 1.5.2. Verified with protobuf==6.32.0: all nine *_pb2 modules import cleanly and the full test suite passes (37 passed); 6.31.1 fails as expected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Make tesla-fleet-api importable under protobuf 6.32.0 so it can drop into Home Assistant core (which pins protobuf==6.32.0) without forcing a core-wide protobuf bump, then cut patch release 1.5.2. The 1.5.1 protobuf gencode under tesla_fleet_api/tesla/vehicle/proto/ was stamped 6.33.4 and calls ValidateProtobufRuntimeVersion(6,33,4,...), which protobuf refuses to load on a 6.32.0 runtime (gencode newer than runtime => VersionError). Decisions made: (1) Regenerated all nine *_pb2.py from the UNCHANGED .proto sources using the standalone protoc v32.0 toolchain via the repo's canonical tools/regenerate_protos.sh (protoc-32.0 on PATH); under unified protobuf versioning protoc vX.Y stamps Python gencode 6.X.Y, so v32.0 yields 6.32.0. This is deliberately a toolchain/version-only change: only the version-stamp lines change and the serialized descriptors are byte-identical (no schema drift). Generated files were regenerated, NOT hand-edited (AGENTS.md forbids editing them). The .proto sources are intentionally untouched. (2) Raised the pyproject protobuf floor from >=6.31.1 to >=6.32.0. This is a correctness fix, not preference: I empirically verified gencode 6.32.0 fails to import under runtime 6.31.1 (VersionError) but succeeds under 6.32.0, so the old floor was unsafe. The floor is intentionally not raised ABOVE 6.32.0 so Home Assistant's exact 6.32.0 pin still satisfies it. No upper cap was added on purpose: protobuf 7.x loads major-6 gencode without error, so a <7 cap would only exclude valid runtimes. (3) Bumped version 1.5.1 -> 1.5.2 in pyproject.toml, tesla_fleet_api/init.py, and the tracked egg-info; deliberately did NOT create/push a git tag or publish (the release tag is pushed after merge by the maintainer). (4) Documented the reproducible regen (protoc v32.0 -> 6.32.0 gencode) and the floor-must-match-gencode rule in AGENTS.md. Verified: with protobuf==6.32.0 all nine _pb2 modules import cleanly and the full test suite passes (37 passed); suite also green under the lockfile's resolved protobuf. The uv.lock and egg-info updates are regenerated artifacts consistent with these changes. Note: pre-existing ruff-format warnings on unrelated tessie/ files exist on base HEAD and are not part of this change.
What Changed
tesla/vehicle/proto/*_pb2.pymodules with the protoc v32.0 toolchain so theValidateProtobufRuntimeVersionstamp is6.32.0instead of6.33.4, letting the package import under Home Assistant's pinnedprotobuf==6.32.0(the.protosources are untouched, so only the version-stamp lines change — serialized descriptors are byte-identical).protobuffloor inpyproject.tomlfrom>=6.31.1to>=6.32.0to match the stamped gencode (verified: gencode 6.32.0 fails to import under runtime 6.31.1 and loads cleanly under 6.32.0 and 7.x), and bumped the package version1.5.1→1.5.2acrosspyproject.toml,__init__.py, and egg-info, withuv.lockregenerated to match.AGENTS.md/tools/regenerate_protos.sh, and bumpedupgradeProtoc.shPROTOC_VERSIONto32.0for consistency.Risk Assessment
✅ Low: A toolchain/version-only change: proto diffs are verified to be pure version-stamp edits with byte-identical descriptors, the protobuf floor correctly matches the stamped gencode, and the version bump is consistent across all tracked files.
Testing
Confirmed the diff makes only the intended toolchain/version changes (9 gencode files re-stamped 6.33.4→6.32.0, floor →>=6.32.0, version →1.5.2). The decisive check was an end-to-end import matrix: installing the built package into a clean venv and forcing each protobuf runtime showed all nine pb2 modules and the top-level package import cleanly under protobuf 6.32.0 (Home Assistant's exact pin) and under 7.34.1, while 6.31.1 raises VersionError — exactly proving the HA-compatibility goal and that the raised floor is a correctness fix with no unnecessary upper cap. The full pytest suite passes (37 passed). This is a library/tooling change with no UI surface, so no visual artifact applies; evidence is the CLI import-matrix transcript.Evidence: protobuf runtime import-compatibility matrix
protobuf==6.32.0 (HA pin): gencode import OK (9/9), import tesla_fleet_api OK v1.5.2 protobuf==6.31.1 (old floor): VersionError on all 9 (gencode 6.32.0 > runtime 6.31.1) protobuf==7.34.1: gencode import OK (9/9), import tesla_fleet_api OK v1.5.2Pipeline
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.
Inspected diff: 9*_pb2.pyfiles changed 6.33.4→6.32.0 stamp only;pyproject.tomlfloor 6.31.1→6.32.0; version 1.5.1→1.5.2 across pyproject/init/egg-infoEnd-to-end import matrix — installed the built package into a fresh uv Python 3.14 venv and forced each runtime:protobuf==6.32.0→ all 9 gencode modules +import tesla_fleet_api(v1.5.2) OK;protobuf==6.31.1→ VersionError on all 9 (confirms old floor was unsafe);protobuf==7.34.1→ all 9 OK (confirms no upper cap needed)uv run pytest tests→ 37 passed, 8 subtests passedConfirmed working tree clean after removing transientbuild/artifact from package install🔧 **Document** - 1 issue found → auto-fixed ✅
upgradeProtoc.sh:1- upgradeProtoc.sh hardcodes PROTOC_VERSION=31.1, which installs a protoc that stamps gencode 6.31.1 — below the new 6.32.0 floor and inconsistent with the shipped gencode and the documented Home Assistant compatibility requirement (protoc v32.0). Left unfixed because it is an executable variable, not a doc comment, and needs a human call on whether this legacy root-level script is still canonical alongside tools/regenerate_protos.sh.🔧 Fix: Bump upgradeProtoc.sh PROTOC_VERSION to 32.0 for gencode pin
✅ Re-checked - no issues remain.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.