Skip to content

Path tracing. This adds support to ping and trace route repeaters and room server.#108

Merged
zjs81 merged 9 commits into
zjs81:mainfrom
wel97459:dev-pathtrace
Jan 29, 2026
Merged

Path tracing. This adds support to ping and trace route repeaters and room server.#108
zjs81 merged 9 commits into
zjs81:mainfrom
wel97459:dev-pathtrace

Conversation

@wel97459

Copy link
Copy Markdown
Collaborator

The functionality right now is all placed on contacts in the contacts list.

  1. Repeaters and room servers, with direct or flood routes will preform a ping trace.
  2. Repeaters and room servers, with a route set will preform a trace route.
  3. For companions with a route set, a path trace is preform to the closets repeater to the companion.
  4. Companion do not take part in path tracing, I'm assuming because of triangulation reasons.

I want to expend the functionality with a map.

and added a trace route builder traceRouteBytes
refactored repeater hub along with contacts screen to use shortPubKeyHex.
Added localization strings for path tracing, english only.
Disabled autofocus of password.
@wel97459 wel97459 changed the title Path tracing. This adds support to ping repeaters and room server. Path tracing. This adds support to ping and trace route repeaters and room server. Jan 25, 2026
@zjs81

zjs81 commented Jan 29, 2026

Copy link
Copy Markdown
Owner

bugbot run

@zjs81

zjs81 commented Jan 29, 2026

Copy link
Copy Markdown
Owner

@cursor review

Zach added 2 commits January 28, 2026 21:43
- Translate path trace strings to all 14 supported locales
- Regenerate localization Dart files
- Fix translate.py to also detect empty string values as missing
@zjs81 zjs81 merged commit 7004067 into zjs81:main Jan 29, 2026
6 checks passed
@rsp2k

rsp2k commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

Hey, nice feature! Path tracing will be super useful. A few things I noticed while reviewing:

Quick wins

Typo (line 31): _failed2Loaded_failedToLoad

Trailing space (line 34): Uint8List(0) ;Uint8List(0);

Misleading variable name (line 81): timeoutSeconds is actually milliseconds (based on the frame format in meshcore_connector.dart). The logic is correct, just the name is confusing:

final timeoutMs = frameBuffer.readUInt32LE();

Simplification

Lines 123-126 - comparing single bytes via listEquals is overkill:

// Current
if (listEquals(
  repeater.publicKey.sublist(0, 1),
  Uint8List.fromList([neighbourData]),
))

// Simpler
if (repeater.publicKey[0] == neighbourData)

Performance (optional)

Lines 119-130 - the nested loop is O(contacts × pathLength). For large meshes this could be optimized with a lookup map:

// Build lookup once
final contactsByFirstByte = <int, Contact>{};
for (final c in connector.contacts.where((c) => c.type != advTypeChat)) {
  contactsByFirstByte[c.publicKey[0]] = c;
}

// Match path
for (final neighbourData in pathData) {
  final contact = contactsByFirstByte[neighbourData];
  if (contact != null) pathContacts[neighbourData] = contact;
}

Question

Lines 196-198 - is the empty onTap handler intentional (future feature) or should it be removed?

onTap: () {
  // Handle item tap
},

Overall looks good! The trace UI with SNR indicators is a nice touch.

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.

3 participants