feat(map): Important Links overlay — B-weighted top routes - #1771
feat(map): Important Links overlay — B-weighted top routes#1771ArcanConsulting wants to merge 3 commits into
Conversation
Polish review — Important Links overlayVerdict: APPROVE-WITH-CONCERNS (0 BLOCKER · 0 MAJOR · 4 MINOR · 2 NIT) Solid net-new UI surface. Pure ranking core is well factored out and behaviorally tested, CSS-var theming is respected, persistence works, and the visual encoding (weight + opacity ∝ importance) reads cleanly. Net-new-UI TDD exemption applies cleanly (test lands in same PR, asserts behavior, not just structure). Notes below are polish, not blockers. MINOR
NIT
Positive notes
TDD gate (kent-beck)Branch has a single commit ( Scope: 237-line frontend-only diff ( |
ada541d to
158cc34
Compare
Re-review (round 2) — Important Links overlayVerdict: merge-ready (0 BLOCKER · 0 MAJOR · 0 MINOR remaining) All 6 polish items from the prior review (4 MINOR + 2 NIT) landed in Findings closed
Verification
Three-axis
Nothing further from this round. Ready when you are. |
Status check — round 3 (merge-from-master)Head moved Auto-merge blocked: Go CI is RED on Recommendation: wait for the master-side flake fix to land + rerun, or rerun CI now since it's a known race (the test name itself says "concurrent requests during build"). I'm not flipping the auto-merge gate on this run — — mc cron v2 |
Status check — merge-from-master only (round 4)Head moved Auto-merge blocked: Playwright now red on a different test than last cycle — This is the map-controls accordion E2E (#1329), not anything this PR touches. 3 of 26 controls aren't visible at 1280px — likely a CSS regression from one of the master-side commits inherited via the merge, NOT from this branch. Master is reporting "success" on its own CI runs, so this may be a layout race that's deterministic only when the Important-Links overlay code from this branch interacts with the accordion panel sizing. Worth a CDP repro before declaring upstream-cause. Action: community branch, leaving as-is. Operator: if you want a debug-repro spawn against staging to confirm overlay-vs-accordion interaction, say the word. — mc cron v2 |
…desktop count (Kpa-clawbot#1771 overlay)
Delta review —
|
…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.
…desktop count (Kpa-clawbot#1771 overlay)
cd71c7f to
bfa677e
Compare
Delta Review — commits since cd71c7fVerdict: merge-ready | 0 BLOCKER | 0 MAJOR | 1 MINOR AdversarialNew code in Tufte (frontend/UI)Overlay controls follow established map.js fieldset pattern ( Kent Beck (TDD gate)
MINOR
|
Automated review (parallel personas, consolidated)Verdict: needs-visual-verify carmack: Ranking math ( tufte: Overlay uses a single kent-beck: MAJOR:
MINOR:
|
Polish review — round 1 (parallel personas)Verdict: MAJOR (one race bug; rest is nits). [carmack] Race: fetch-vs-toggle can render an unchecked overlay. [carmack] Per-frame allocs on slider drag are avoidable. [tufte] Doc-vs-code drift on the importance formula. Header comment (map.js:~2155) says "edge.affinity × mean(endpoint axis scores)"; code reads [tufte] Hardcoded color fallback [kent-beck] Coverage gaps in test-top-routes-overlay.js. No case for: empty [kent-beck] Nit. Grep pins with 3-axis: mergeable=MERGEABLE · CI=SUCCESS (Go+E2E; Docker cancelled on fork, expected) · reviews=none. Address the race + doc drift and this is merge-ready. |
…ream Kpa-clawbot#1771) Public, user-facing overlay on the map (distinct from the API-key-gated Affinity Debug overlay) that draws the most important affinity links, weighted by the Kpa-clawbot#672 repeater-usefulness axes (usefulness/bridge/ redundancy/traffic-share, or raw affinity). Joins the loaded nodes' coords + scores with /api/analytics/neighbor-graph edges, ranks by a chosen axis via a rank-by select, and draws the top-N (adjustable via a slider) as importance-weighted polylines so geographic chokepoints stand out. Toggle + axis + N persist to localStorage; re-syncs on full node reload and theme change. Not a blind cherry-pick -- ported against this fork's diverged map.js (existing initAffinityDebug pattern, safeEsc/escapeHtml convention, destroy() lifecycle, window.__meshcoreMapInternals test-hook convention) rather than patching upstream's diff directly. Includes a review-round fix for an async race in loadTopRoutes(): toggle on -> request starts -> toggle off before it resolves -> clearTopRoutes() runs -> the stale response arrives and re-adds the layer. Fixed with a generation-ID guard (topRoutesGeneration) rather than AbortController, since the shared api() helper in app.js has no signal support and extending it would be a separate, broader change. loadTopRoutes bumps its own generation before awaiting; after the await, it checks `myGen !== topRoutesGeneration || !map` -- in that order, so a destroyed page never touches the DOM -- before applying a result or touching the checkbox, on both the success and failure paths. invalidateTopRoutesRequests (bumps generation + clears the debounce timer) runs on toggle-off and in destroy(), so an old failure can never uncheck the box or clear a layer a newer request already drew. 28 new tests in test-top-routes-overlay.js, executing the real map.js in a vm sandbox (test-map-scope-filter.js's pattern) rather than a regex-extracted copy: structural DOM-wiring pins, computeTopRouteEdges ranking behavior (axis/topN/skip logic, upstream's own fixtures), render-populates-layer/empty-state-hint, and 4 controlled-Promise race regressions (toggle-off-before-resolve, overlapping requests resolving out of order, an old failure after a newer success, destroy() while pending). All 28 pass; no regressions in the other 18 map.js-dependent test files (4 have pre-existing, baseline-identical failures unrelated to this change, confirmed via git stash). test-issue-1329-map-controls-accordion-e2e.js: applied the same fix upstream needed for the new hidden-by-default rank-by/slider controls -- excludes progressively-disclosed (inline display:none) controls from the desktop all-controls-visible check, same as the pre-existing Affinity Debug toggle already needed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Closing and immediately reopening this to get a CI result. Nothing is wrong with your PR and no action is needed from you. This one never actually failed: its last pipeline was CANCELLED, so there has been no verdict on it at all. Meanwhile master has moved (#1924 fixed #1923, an E2E bug that was failing PRs which never touched the affected page), and a plain re-run would reuse the merge commit from the original run rather than testing against current master. A close/reopen is the way to get a fresh one. Apologies for the notification noise. |
|
Correction to what I just wrote: I said the last pipeline was CANCELLED. The run is recorded as So this PR has never had a real test failure. The fresh run will confirm whether that still holds against current master. |
|
Review from the queue triage. Written 2026-08-30 against the tree at that time; posting now that the maintenance window in #1922 has opened. Verdict: approve the feature, request a change to how it is tested. CI was CANCELLED, not The overlay is sensibly built: a pure ranking core ( The test approach is the thing to push back on. Smaller notes: modifying the existing accordion regression test Update 2026-09-02. Correction to the line above: this PR's run was recorded as |
|
Rebased and continued as #1928. Your commits, your authorship, unchanged. This went CONFLICTING through no fault of yours: #1760 landed first in the #1922 queue run and both PRs append a line to Nothing else was touched. I opened it as a new PR rather than force-pushing to your branch. If you would rather #1771 stayed the vehicle, say so and I will push the rebase here and close #1928 instead. Also worth knowing: this PR's run was recorded as CANCELLED for a long time, which is part of why it sat. Its tests were never the problem. |
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 Function`s 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.com/claude-code) https://claude.ai/code/session_01Wzwr3eXseyNM7Xj598djjE --------- Co-authored-by: Arcan Consulting - Michael J. Arcan <github@arcan-it.de>
|
Merged via #1928, which is your two commits rebased onto master with your authorship intact. Closing this as the vehicle rather than the work. The only thing I changed was the The one review point still open is the test-extraction approach — |
Public map overlay drawing the most important affinity links, weighted by the #672 usefulness axes (rank-by selector + top-N slider). Frontend-only. Pairs with #1762.