Repository navigation
Type ControlEventSchedulingInfo.priority as a string in TypeScript - #81
Merged
Bre77 merged 1 commit intoNov 1, 2026
Conversation
Add [jstype = JS_STRING] to the uint64 priority and enable ts-proto's useJsTypeOverride=true, so a max-backup priority of 2^64 - 1 no longer throws on encode or loses the whole get_backup_events reply on decode. Add the energy_v1r_envelopes golden fixture with TypeScript and Python tests.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
Bre77
marked this pull request as ready for review
October 31, 2026 22:31
Bre77
deleted the
feature/eng-4-pw-1-make-priority-a-string-in-tesla-protocol-typescript
branch
November 1, 2026 11:37
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.
Assignee: @Bre77 (bre77)
Resolves ENG-4.
Summary
ControlEventSchedulingInfo.priorityis auint64, and a max-backup event is scheduled at2^64 - 1. In the generated TypeScript the field was anumber. That meant encoding the value threwinvalid uint64, and decoding anyMessageEnvelopecarrying it threwValue is larger than Number.MAX_SAFE_INTEGER, so the wholeget_backup_eventsreply was lost.proto/energy_device/teg_api.proto:uint64 priority = 3 [jstype = JS_STRING];scripts/generate.sh: addeduseJsTypeOverride=truetoTS_OPTS. The bare option has no effect in ts-proto 2.7.7.ControlEventSchedulingInfo.priority, which is nowstringand decoded withreader.uint64().toString(), and removes thelongToNumberhelper, which nothing uses any more. On the Python side only the serialized descriptor changes; Python ignoresjstype.fixtures/golden/energy_v1r_envelopes.json: the 20 local v1r request envelopes from document 09, plus aget_backup_eventsreply whose manual backup event has priority2^64 - 1. Tests arepackages/typescript/test/energy-v1r-envelopes.test.tsandpackages/python/tests/test_energy_v1r_envelopes.py. Both decode every envelope, check the expected payload is set, re-encode to the same bytes, and check the scheduling info. The TypeScript test also builds the schedule request with priority"18446744073709551615"and gets the golden bytes.minor. Under pragmatic versioning that is an ANNOUNCE bump, chosen because the type change breaks TypeScript callers; the wire bytes do not change.The fixture note on
reconnect_grid: the captured bytes include an explicitforce = false(10 00). Neither generated encoder writes a proto3 default, so that one entry has acanonical_hexthat the re-encode check compares against.Acceptance
prioritytype isstring."18446744073709551615". Checked in both the TS and Python tests.longToNumberhelper.buf breaking --against-config buf.yamlpasses underWIRE_JSONlocally.build_catalog.pygives no diff.Checks run locally
pnpm generate(output is clean and committed),buf lint,buf breaking,upstream_coverage.py --mode pinned,check_reply_coverage.py,test_build_catalog.py,pnpm build,pnpm tsc,node --test(49 pass), and Pythonunittest(19 pass).