Skip to content

fix: Set contact routing path so repeater admin login works#77

Merged
cwill747 merged 4 commits into
mainfrom
repeater-issues
May 18, 2026
Merged

fix: Set contact routing path so repeater admin login works#77
cwill747 merged 4 commits into
mainfrom
repeater-issues

Conversation

@cwill747
Copy link
Copy Markdown
Owner

Summary

  • ContactBook Contact objects never had out_path/out_path_len set, so PacketBuilder.create_login_packet() always sent login packets as FLOOD. Repeaters received the login but couldn't route a RESPONSE back.
  • Now path data from adverts (both "packet" events and mesh.network.node_discovered events) 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

  • Verified on Pi: login to Lafayette repeater succeeds immediately on connect (was timing out before)
  • Verified CLI command (ver) returns firmware version after login
  • Verified logout works
  • 94 unit tests pass

🤖 Generated with Claude Code

…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>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +581 to +583
if not path_hops:
inbound_path = b""
path_len_encoded = 0
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment thread src/meshcore_console/meshcore/client.py Outdated
Comment on lines +557 to +558
advert_lat_raw = data.get("advert_lat") or data.get("lat")
advert_lon_raw = data.get("advert_lon") or data.get("lon")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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>
@cwill747
Copy link
Copy Markdown
Owner Author

@codex fix the linting issues

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@cwill747
Copy link
Copy Markdown
Owner Author

@codex fix the linting issues

@chatgpt-codex-connector
Copy link
Copy Markdown

Summary

  • Addressed the lint/format follow-up by applying Ruff formatting to the advert coordinate fallback expressions in MeshcoreClient._process_advert_event; this is a style-only change (no logic change).
  • Committed the change on the current branch as f7cdfcd with message: style: format advert coordinate fallback for ruff.
  • Created a follow-up PR via make_pr titled “style: fix Ruff formatting in advert coordinate fallback”.

Testing

  • ⚠️ nix develop path:. --command bash -lc 'uv run ruff check .' (environment limitation: nix not installed in this runner)
  • uv run ruff check .
  • uv run ruff format --check .

View task →

cwill747 and others added 2 commits May 18, 2026 15:28
- 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>
@cwill747 cwill747 merged commit 6060966 into main May 18, 2026
9 checks passed
@cwill747 cwill747 deleted the repeater-issues branch May 18, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant