Repository navigation
fix: normalise routing_path from bytes to list[int] for PacketBuilder compatibility - #99
Merged
Merged
Conversation
… compatibility Direct-message sends failed because contact.out_path was stored as concatenated bytes (bytes.fromhex) but PacketBuilder.create_text_message validates routing_path as a flat list of byte values. Three-part fix: - Store out_path as list[int] in _seed_contact_book and _sync_contact_to_book (client.py) - Widen the Contact.out_path type annotation to accept both forms since openhop_core callbacks still assign bytes (contact_book.py) - Normalise byte paths via _text_message_contact() on a shallow copy in send_text and send_repeater_command (operations.py) Fixes #98
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.
Problem
Sending direct messages fails with:
Group chat messages are unaffected.
Root cause
MeshcoreClient._seed_contact_book()storedcontact.out_pathas concatenated bytes viabytes.fromhex().PacketBuilder.create_text_message()(openhop_core 1.1.3) validatesrouting_pathas a flat list of byte values and rejects bytes.Changes
Three files (+ new test):
client.py — Store
out_pathaslist[int]instead of bytes in both_seed_contact_book()and_sync_contact_to_book()contact_book.py — Widen
Contact.out_pathtype annotation tolist[int] | bytes | Nonesince openhop_core callbacks still assign bytesoperations.py — Add
_text_message_contact()that normalises byte paths tolist[int]on a shallow copy before passing toPacketBuilder.create_text_message(), applied in bothsend_text()andsend_repeater_command()Verification
test_dm_routing_path.py)Closes #98