Repository navigation
Allow a TRACE route to revisit a node in both hop resolvers (#2520) - #2521
Merged
Merged
Conversation
…ode (Kpa-clawbot#2520) resolvePathWithContext excluded every node already on the path, so the second A of a TRACE route A -> B -> A was stored as null in observations.resolved_path. The firmware allows the revisit on purpose: Packet::calculatePacketHash mixes path_len into a TRACE hash ("TRACE packets can revisit same node on return path"), while every other packet's hash ignores the path, so wasSeen keeps a node from forwarding it twice. packetpath.PathMayRevisit(payloadType) is the shared rule (TRACE only). With it, resolvePathWithContext excludes only the previous hop (a radio does not hear its own transmission) and still anchors on it through the neighbour graph. Non-TRACE packets keep the one-visit exclusion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pa-clawbot#2520) inferPath kept every node to one position, so on a TRACE route A -> B -> A the earlier A was left unassigned and flagged unreliable even when A is the only node with its prefix and 14 km from B. inferPath takes opts.allowRevisit: it skips the one-position bans and the cross-hop confidence bans, and the step cost forbids the same node only at the next hop. Geography and neighbour links still choose among nodes sharing a prefix; a revisit costs nothing extra. inferObservationPath takes the packet's payload_type and sets it for a TRACE (9); the packet detail pane and the map deep link pass it. Without the flag the behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zfouts
marked this pull request as ready for review
December 1, 2026 22:15
…tionPath Replace the bare 9 with TRACE_PAYLOAD_TYPE. PayloadLabels is not loaded by every unit test that loads this file, so the constant is local, with a comment pointing at PayloadLabels.enums.TRACE.enumId. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
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.
A TRACE route can come back through a node (A -> B -> A). Both hop resolvers assumed a node appears once on a path, so the earlier visit was left unresolved and flagged as geographically inconsistent, even when A is the only node with its prefix. This lets a TRACE revisit a node in both resolvers. Every other packet type keeps one visit per node.
Why a TRACE may revisit
The firmware allows it on purpose:
Packet::calculatePacketHashmixespath_leninto a TRACE hash ("TRACE packets can revisit same node on return path"), while every other packet's hash ignores the path, sowasSeenkeeps a node from forwarding it twice.Changes
cmd/ingestor/path_resolver.go,cmd/ingestor/db.go):resolvePathWithContexttakesallowRevisit. When set, only the previous hop is excluded (a radio does not hear its own transmission, so a node is never its own next hop), and anchoring on the previous hop through the neighbour graph is unchanged. The second A of a TRACE was stored asnullinobservations.resolved_path; now it is resolved.internal/packetpath/route.go):PathMayRevisit(payloadType)is true for TRACE only.public/hop-resolver.js):inferPathtakesopts.allowRevisit. It skips the one-position bans and the cross-hop confidence bans, and the step cost forbids the same node only at the next hop. Geography and neighbour links still choose among nodes sharing a prefix, and a revisit costs nothing extra.public/packet-helpers.js,public/packets.js,public/map.js):inferObservationPathtakes the packet'spayload_typeand sets the flag for a TRACE. The packet detail pane and the map deep link pass it. It uses a localTRACE_PAYLOAD_TYPEconstant, becausePayloadLabelsis not loaded by every unit test that loadspacket-helpers.js.Without the flag the behaviour is unchanged.
Tests
cmd/ingestor/trace_revisit_test.go,internal/packetpath/route_test.go, and an updatedcmd/ingestor/resolved_path_test.go.tests/unit/test-hop-path-inference.js(Test 10b) andtests/unit/test-hop-path-detail.js(revisit throughinferObservationPath, plus the detail pane and map deep link passing the payload type).sh test-all.shpasses and ESLint onpublic/*.jsreports 0 errors.Browser validation
Checked in Chromium (Playwright, 1280px) against a copy of the E2E fixture with one synthetic TRACE
b3 -> 7d -> b3, on the merge base and on this branch. Before, the firstb3is an unlisted hop with the inconsistency warning and the map route says "1 unresolved". After, bothb3hops are EW-HomeBase and the route reads 3 hops, 10 km. Light and dark screenshots of the packet detail and the map route panel are in this comment. Not checked on a real mesh capture.Closes #2520
🤖 Generated with Claude Code