Skip to content

feat(map): Important Links overlay (rebase of #1771 onto master) - #1928

Merged
efiten merged 2 commits into
Kpa-clawbot:masterfrom
efiten:fix/top-routes-overlay-rebased
Sep 2, 2026
Merged

feat(map): Important Links overlay (rebase of #1771 onto master)#1928
efiten merged 2 commits into
Kpa-clawbot:masterfrom
efiten:fix/top-routes-overlay-rebased

Conversation

@efiten

@efiten efiten commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Continues #1771 by @ArcanConsulting. Both commits are theirs, authorship unchanged; I only rebased them onto current master. Opening it here rather than force-pushing to someone else's branch.

Why the rebase was needed

#1771 went CONFLICTING through no fault of its author: #1760 landed first and both PRs append a line to test-all.sh at the same spot. That was the entire conflict.

What I changed

One line, and it is the conflict resolution: test-all.sh now runs both test files rather than either.

node test-repeater-metric-scatter.js   # from #1760
node test-top-routes-overlay.js        # from this PR

Nothing else was touched. public/map.js and test-issue-1329-map-controls-accordion-e2e.js are byte-for-byte as the author wrote them.

Verification on the rebased tree

result
test-top-routes-overlay.js (this PR's own) 20 passed, 0 failed
test-repeater-metric-scatter.js (#1760's, must still pass) 31 passed, 0 failed
test-frontend-helpers.js 627 passed, 0 failed

The one review point that still stands

From my review on #1771, unchanged by the rebase and not something I fixed on the author's behalf: test-top-routes-overlay.js extracts the ranking core by indexOf-slicing public/map.js between the literals const TOP_ROUTES_AXES and function clearTopRoutes, then new Functions the result. There is a guard assertion for the rename case, which is thoughtful, but it still breaks on any reordering of map.js and it tests a string rather than the module.

Two PRs in this same queue do it properly and are worth copying: #1821 exports applyObserverFilter through _packetsTestAPI, and #1912 puts hashPrefixInfo on window.

Happy to take that as a follow-up rather than block the overlay on it.

@ArcanConsulting — this is your work and the credit is yours. Say the word and I will close this and hand the rebase back, or push it to your branch instead if you would rather #1771 stayed the vehicle.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Wzwr3eXseyNM7Xj598djjE

…wbot#672 / D)

Add a public, toggleable map overlay that draws the most IMPORTANT affinity
links between nodes, weighted by the Kpa-clawbot#672 repeater-usefulness axes — so
terrain-level chokepoints (the sole link across a valley) stand out
geographically. Distinct from the API-key-gated Affinity Debug overlay,
which it is modeled on but leaves untouched.

Frontend-only, no server change. It joins the already-loaded `nodes` array
(coords + usefulness/bridge/redundancy/traffic scores from /api/nodes) with
the public /api/analytics/neighbor-graph edges:

  importance(edge, axis) = edge.affinity × mean(endpoint axis scores)
  (axis = "affinity" → the raw edge affinity)

Ranks edges descending, draws the top-N (slider, default 50) as polylines
whose width/opacity scale with importance; endpoints without GPS or zero
importance are dropped. Controls (in the map controls panel): a toggle, a
"Rank by" select (Usefulness composite / Bridge / Redundancy / Traffic /
Affinity), and a Top-N slider; axis + N persist to localStorage. The B
weighting "lights up" once the Kpa-clawbot#672 scores are deployed; before that the
Affinity axis still shows links.

test-top-routes-overlay.js executes the pure ranking core
(computeTopRouteEdges) against fixtures — importance math, axis-dependent
reordering, top-N, GPS/zero-score skips — plus grep pins for the DOM
wiring. Wired into test-all.sh.
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.

2 participants