Skip to content

Live map: follow the 1-byte hop setting, operator default for it, and a working maxHopDist #912

Done

Description

@dborup

Problem

With 1-byte path hashes (the firmware default), several repeaters share each hop code, so the hop resolver has to guess which node a 1-byte hop is. When it guesses wrong, the Live map draws a link that never existed. Recently a Danish repeater looked as if it was talking to Oslo. Its key starts with 18, and so do the keys of three other repeaters and rooms, one of them in Norway. The stored packets are correct; only the drawing is a guess.

What exists today does not let an operator stop this on the Live map:

  • The Show / Mark / Hide setting for 1-byte hops (customizer, public/hop-filter.js, 1-byte hops: Show / Mark / Hide modes, with Mark as default #674/feat(hops): Show / Mark / Hide for 1-byte path hops, Mark by default (#674) #677) applies to the route view, the Live feed list and the node path panel. It does not apply to the Live map animation: resolveHopPositions() and animatePath() in public/live.js never consult it.
  • The setting is per browser only. It lives in localStorage (meshcore-1byte-hops-mode, default mark), and an operator cannot choose the default for their visitors.
  • The Live "Multibyte only" toggle hides every packet with a 1-byte path. It works, but it is also per browser only.
  • maxHopDist in config does nothing. roles.js copies it to window.MAX_HOP_DIST, but hop-resolver.js uses its own local const MAX_HOP_DIST = 1.8 for the "impossibly far" sanity check, so the configured value is never read.

Scale: in a sample of 3,000 recent packets on a production instance, 1,518 have a path with hops. Of those, 233 (15 %) use 1-byte hops and 1,285 use 2- or 3-byte hops. Hiding the uncertain hops costs the Live map little.

Plan

Nothing stored changes: no packets, observations or resolved paths are deleted or rewritten. All of this is render-time.

M1: the Live map follows the 1-byte hop setting

Changes:

  • Before the hops are resolved for the animation, the Live map applies the current mode, using the same rules as the rest of the app (MC_get1ByteHopsMode, MC_isVisibleHop / MC_filterPathHops from hop-filter.js):
    • Show: unchanged.
    • Hide: 1-byte hops are left out of the animated path. When hops were dropped, the remaining segments are drawn dashed and lighter, like route-render.js already does (feat(#1633): customizer toggle to hide 1-byte path hops everywhere Kpa-clawbot/CoreScope#1689 r1). Otherwise a shortened path reads as a direct link.
    • Mark: 1-byte hops stay. Segments that start or end at a 1-byte hop are drawn dashed and lighter, so a guessed link looks different from a certain one.
  • New packets follow a mode change at once (mc-hide-1byte-hops-changed). Animations already in flight just finish.
  • "Multibyte only" stays as it is.

Performance: the filter is O(hops) per packet on a path that is already O(hops), with no new lookups, so there is no measurable change in the WebSocket hot path. A benchmark test will prove it: the filter plus resolveHopPositions on 10k synthetic packets with and without the filter.

Tests:

  • Unit tests, using a vm context like test-frontend-helpers.js, for each mode:
    • which hops reach the animation;
    • which segments are marked dashed and lighter;
    • that Hide with no 1-byte hops in the path changes nothing.
  • A Playwright test:
    • set the mode to Hide and inject a WS packet whose path has a 1-byte hop;
    • assert that no Live polyline vertex sits on that hop's node;
    • in Mark mode, assert that the segment carries the dashed class.

Browser validation:

  • On staging, the Live page in all three modes, at desktop width and on a phone (375 px wide), from a cold start.
  • A screenshot of a guessed link in Show, the same link in Mark, and the same link gone in Hide.

M2: the operator chooses the default mode

Changes:

  • A new config key, customizer.oneByteHopsDefault, taking "show", "mark" or "hide".
    • It is a named field on CustomizerConfig, with no map[string]interface{}.
    • It is validated: an unknown value logs a warning and falls back to mark.
    • If the key is absent, the behaviour is as today (mark).
  • The value is sent in the existing customizer block of /api/config/client.
  • hop-filter.js resolves the mode in this order: the visitor's stored choice, then the operator default, then mark.
  • Storage change: today a choice equal to the default is stored as "no key". With a server-side default that breaks: a visitor who picks mark on a server whose default is hide would fall back to hide. So an explicit choice is always stored.
    • The existing migration from the old boolean key stays.
    • A visitor who never chose anything has no key and follows the operator default, including later changes to it.
  • The customizer shows which mode is the server default.

Tests:

  • Go:
    • config parsing and validation: valid values, an unknown value, an absent key;
    • the shape of /api/config/client.
  • JS:
    • the resolution order;
    • that an explicit mark survives a hide default;
    • the legacy migration.

Browser validation:

  • With the default set to hide on staging, a fresh browser profile shows Hide on Live.
  • After choosing Show in the customizer, Show persists across reloads.

M3: maxHopDist takes effect

Changes:

  • hop-resolver.js reads the effective limit, the configured window.MAX_HOP_DIST, falling back to 1.8, instead of its private constant. The unit stays degrees, as documented in roles.js, so existing configs keep their meaning.
  • config.example.json documents the key.

Tests:

  • A hop-resolver unit test:
    • with a lowered limit, a hop about 150 km from both neighbours is marked unreliable and not drawn;
    • with the default, it is kept.
  • A regression test that the default stays 1.8 when the key is absent.

Browser validation:

  • On staging, set a low maxHopDist and confirm on Live and in the route view that a long guessed hop disappears.

Config and customizer implications

  • New: customizer.oneByteHopsDefault (M2). It is already reflected in the customizer, which shows the server default.
  • Now effective: maxHopDist (M3).
    • A later milestone could expose it in the customizer.
    • Renaming it to a kilometre-based key is a separate decision.
  • No new npm dependencies and no build step.

Open questions for the owner

  1. What Hide means on the Live map: all 1-byte hops, consistent with the route view and feed today, or only ambiguous ones (a code shared by more than one known repeater or room)?
    • Proposal: all 1-byte hops, consistent with the rest of the app.
    • Ambiguity-aware hiding would be a separate follow-up, because it changes the meaning of the setting everywhere.
  2. The default for our instance after M2: hide or mark?
  3. The unit of maxHopDist: keep degrees, or add a km-based key and deprecate the old one?

Activity

  1. dborup commented on Nov 18, 2026

    @dborup
    OwnerAuthor

    Parked (owner decision, 2026-11-18)

    The owner wants to keep all live traffic visible on the Live map, so Hide on Live and M2 (an operator default) are not wanted for now. A smaller variant, "Mark only on Live", was measured before any code was written. It would change almost nothing, so this issue is parked. No code was written.

    Measurement

    I sampled the production Live WebSocket for 25 s:

    Count
    Packets with a path 295
    Packets whose path has only 1-byte hops 103 (35 %)
    1-byte hops in those packets 559
    1-byte hops that arrived with a non-null server resolved_path entry 559 (100 %)
    • So resolveHopPositions() in public/live.js takes every hop from the server (HopResolver.serverHopEntry). The client heuristic, and with it the ambiguous flag, is never used on Live.
    • The ingestor (cmd/ingestor/resolved_path.go, path_resolver.go) only fills a position when exactly one candidate remains: a unique prefix, or exactly one candidate adjacent to the previous hop in the neighbour graph.
    • The route view's Mark mode treats such canonical answers as certain (HopDisplay.isUnsureInferredHop).

    Consequence for the variants

    • Mark only the hops the map is unsure of: on Live it would mark nothing, because every hop is already a server answer.
    • Mark every 1-byte hop: about a third of the Live lines would be drawn dashed. That is the traffic the owner wants to keep, so this variant is not wanted either.
    • A meaningful Mark on Live needs a backend change. The ingestor would record how each hop was resolved, either "unique prefix" or "neighbour graph", and send that with resolved_path, so the Live map can mark the weaker neighbour-graph answers. That is a larger piece of work and is not planned.

    Context

    There was a report that a Danish repeater was talking to Oslo. It was not supported by our data: the Oslo nodes had not been heard for two days, and the repeater's paths ran to Funen and Jutland. So there is no concrete misdrawing to fix right now.

    Still valid from the plan

    M3, a working maxHopDist (roles.js sets window.MAX_HOP_DIST, but hop-resolver.js reads its own constant), is a small standalone fix that can be done on its own if wanted.

  2. dborup commented on Nov 20, 2026

    @dborup
    OwnerAuthor

    Owner decision 2026-11-20: M3 only (a working maxHopDist) goes ahead as a standalone fix. M1 and M2 stay parked.

  3. added 2 commits that reference this issue on Nov 20, 2026
  4. dborup commented on Nov 20, 2026

    @dborup
    OwnerAuthor

    M3 is merged: #946 (a633ad8). The configured maxHopDist now takes effect in the browser's hop guessing, and the server validates it (>0 to 10 degrees, else one warning and the default 1.8). M1 and M2 (Live Hide/Mark, operator default) stay parked, so this issue stays open.

  5. dborup commented on Nov 28, 2026

    @dborup
    OwnerAuthor

    Owner decision (2026-11-27): M1 and M2 are restarted. Until M2 (#1001, the operator default) is merged, the Live map defaults to Show for the 1-byte hop setting: a visitor who has not chosen a mode sees Live as before. An explicit choice in the customizer (Show / Mark / Hide) applies at once. Once M2 lands, the operator default decides the starting mode.

    Relates to #1004 (M1) and #1001 (M2).

  6. added a commit that references this issue on Nov 28, 2026
  7. dborup commented on Nov 29, 2026

    @dborup
    OwnerAuthor

    Fixed by #1004 (M1: the Live map follows the 1-byte hop setting), #1001 (M2: an operator default for the 1-byte hop mode; an unconfigured instance behaves as before) and #946 (M3: a working maxHopDist). All milestones are merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions