Skip to content

fix: collision-aware !path hop resolution - #29

Merged
sg merged 1 commit into
mainfrom
feat/path-collision-fix
Jun 25, 2026
Merged

fix: collision-aware !path hop resolution#29
sg merged 1 commit into
mainfrom
feat/path-collision-fix

Conversation

@sg

@sg sg commented Jun 25, 2026

Copy link
Copy Markdown
Owner

What changed

Rewrote !path path-hop resolution (commands/path.py) so a far repeater that merely shares a path-hash prefix can no longer supply a bogus distance.

  • Repeater/room only: hops resolve against type IN (repeater, room) contacts (clients never repeat), shrinking the collision pool.
  • Trust unique matches: a hash matching a single contact is used even if distant (it's unambiguous).
  • Collision handling: when a hash matches >1 repeater, the hop is placed only if ≥2 candidates have a location and one is the clear nearest to a trusted anchor (the bot's own location, the sender, or an already-unambiguous neighbouring hop). A lone located candidate among a collision is left unlocated rather than guessed.

Why

During a tropospheric-ducting event, far repeaters (Louisiana/Dallas/Texarkana) were auto-added as contacts. One collided on its 2-byte path hash with a local repeater; the local (correct) hop had no geo, so the old "exactly one located contact" guard was silently defeated and !path reported the Louisiana location/distance. The fix detects the collision instead of trusting the only geo'd candidate.

Notes

  • Considered (and rejected for now) max-distance and no-geo contact filters: the bot can't stop the radio's auto-add (only evict/skip post-hoc), and rejecting no-geo repeaters would have deleted the correct local hop, leaving the impostor to win. This resolver fix needs no contact-table changes and adds no magic distance threshold.
  • Setting the bot's own location on the radio (self_info.adv_lat/lon) improves disambiguation.
  • Tests: tests/test_path_resolve.py — impostor-collision → unlocated, two-geo collision → nearest-to-bot, unique far hop trusted, client excluded, geoless unique → unlocated, sender-as-anchor fallback.

Breaking changes

None. Pure accuracy fix; output format unchanged.

@sg
sg merged commit d884f12 into main Jun 25, 2026
1 check passed
@sg
sg deleted the feat/path-collision-fix branch June 25, 2026 21:07
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