fix: Set contact routing path so repeater admin login works#77
Conversation
…ect routing Login packets were always sent as FLOOD because ContactBook Contact objects never had out_path/out_path_len set. Repeaters couldn't route responses back to flood-originated requests. Now path data from adverts (both packet events and mesh.network.node_discovered) propagates to Contact objects, and _seed_contact_book sets paths from stored peer data on startup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c3851dd1f9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not path_hops: | ||
| inbound_path = b"" | ||
| path_len_encoded = 0 |
There was a problem hiding this comment.
Preserve existing route when advert has no path data
When path_len_encoded is missing, this branch unconditionally sets path_len_encoded = 0 for any contact with a public key and no path_hops. In mesh.contact.new/similar events that carry identity but no routing info, _sync_contact_to_book() will overwrite a previously learned direct route with flood routing (out_path_len=0), so repeater responses can fail again until another routed advert arrives.
Useful? React with 👍 / 👎.
| advert_lat_raw = data.get("advert_lat") or data.get("lat") | ||
| advert_lon_raw = data.get("advert_lon") or data.get("lon") |
There was a problem hiding this comment.
Read zero coordinates without truthy fallback
Using or here drops legitimate 0.0 coordinate values (equator/prime-meridian cases) because 0.0 is falsy, so the code may fall through to a missing alternate key and convert a valid coordinate into None. That prevents has_location from becoming true and silently skips location updates for affected peers.
Useful? React with 👍 / 👎.
- Only derive path from path_hops when the event carries routing data
("path_hops" key present), so identity-only events like mesh.contact.new
don't overwrite a previously learned route.
- Use `is not None` instead of `or` for lat/lon fallback to preserve
legitimate 0.0 coordinates.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@codex fix the linting issues |
|
To use Codex here, create an environment for this repo. |
|
@codex fix the linting issues |
Summary
Testing
|
- Change Contact.out_path from list|None to bytes|None to match actual usage - Add Contact.out_path_len field (default -1 = unknown/flood) - Preserve existing path data in add_contact() when updating from a dict without path info, preventing route clobbering - Update tests to match new types and preservation semantics Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
out_path/out_path_lenset, soPacketBuilder.create_login_packet()always sent login packets as FLOOD. Repeaters received the login but couldn't route a RESPONSE back.mesh.network.node_discoveredevents) propagates to Contact objects for direct routing._seed_contact_book()also sets paths from stored peer data on startup, so login works immediately without waiting for a fresh advert.Test plan
ver) returns firmware version after login🤖 Generated with Claude Code