Skip to content

feat(live): the Live map follows the 1-byte hop setting (#912 M1) - #1004

Merged
dborup merged 5 commits into
masterfrom
feat/912-m1-live-1byte-hops
Nov 28, 2026
Merged

dborup merged 5 commits into
masterfrom
feat/912-m1-live-1byte-hops

Conversation

@dborup

@dborup dborup commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Relates to #912

Status: M1 is implemented in one commit on feat/912-m1-live-1byte-hops (base cd5ae0b6). Every M1 point has a test that is red on master and green here, and all 15 mutants were killed. Remaining local failures are timing budgets that fail the same way on origin/master on a GPU-less machine. Master was merged in afterwards (only scripts/e2e-shards.json conflicted; both new suites kept).

Evidence tags: [T] = an automated test in this PR, [A] = a run or measurement done locally for this report (not checked in), [K] = read from the code or diff.

Note for the reviewer: M1 and M2 were parked on 2026-11-18/20; the owner restarted both on 2026-11-27 (M2 is #1001). Fix round (d9d7eb47): following the owner decision on #912 (2026-11-27), a visitor who has not chosen a mode sees Live as Show until M2. A stored Show / Mark / Hide applies as before. Other pages keep hop-filter.js's default (mark). Once M2 lands, its operator default replaces the Live fallback.

Plan (as built)

The issue's M1 plan, render-time only. Nothing stored changes.

  • resolveHopPositions(hops, payload, resolvedPath, mode) takes the mode. renderPacketTree reads it once per packet group from the visitor's stored choice (MC_getStored1ByteHopsMode(), hop-filter.js). If there is no stored choice, it uses LIVE_1BYTE_HOPS_FALLBACK = 'show' (fix round). An explicit choice is now always stored, Mark included, so "chose Mark" and "never chose" can be told apart. M2 uses the same storage rule. A change made through MC_set1ByteHopsMode, which fires mc-hide-1byte-hops-changed, therefore reaches the next packet at once. Animations already running finish as they are.
  • applyOneByteHopsMode() runs before resolution and decides hop visibility with MC_isVisibleHop(hop, { hide1ByteHops: true }):
    • Show: the input is returned unchanged.
    • Hide: 1-byte hops are left out.
    • Mark: 1-byte hop positions are flagged. A segment is uncertain when either end is flagged.
  • Rendering: drawAnimatedLine(..., uncertain) draws the canvas segment dashed (4 6), at weight 1.5 and opacity 0.5 instead of 0.8, in the segment's own colour. Hash colour still applies, unlike grey ghost lines. The fading Leaflet trail gets dashArray: '4 6' and the class live-path-uncertain.
  • The follow (Live: “Follow a packet” – replay how one packet spreads through the mesh #880) still reads every hop position through resolveHopEntries(), which is unchanged.
  • "Multibyte only" is unchanged; its code is untouched.
  • Theming: no new colours. The change sets only opacity, dash and weight, and adds no CSS.
  • Config and customizer: nothing changes. UNCERTAIN_SEGMENT_OPACITY is a constant; a later milestone could expose it in the customizer (AGENTS.md rule 8). M2 is left to its own branch.

Requirements → test → mutant

Unit tests: test-issue-912-live-1byte-hops.js (vm, real live.js, hop-filter.js and hop-resolver.js, registered in test-all.sh). E2E: test-issue-912-live-1byte-hops-e2e.js (assigned to shard 1). The E2E records every L.polyline Live creates after a WS packet goes through the real _liveWSHandler().

Requirement Test (red on master → green) Mutant, killed by
Filter applied before resolve, from the stored mode (no stored mode → Show) [T] unit "no stored mode: the Live map uses Show", "a stored … applies on Live"; [T] E2E "no stored mode (cold start)" F1 fallback dropped (Live reads hop-filter.js's mark): unit 3 red, E2E 1 red [A]; F2 Mark stored as no key: unit 1 red, E2E 1 red [A]
Hide on the decoded.path.hops fallback (pure 1-byte path) [T] E2E "Hide: a pure 1-byte path with decoded.path.hops set draws no hop" (fix round, review finding 1) X3 fallback call without hopMode: E2E 1 red [A]
The call site passes the mode read for the packet, not a constant [T] E2E Hide and Mark steps M15 hopMode = 'show' at the call site: killed by E2E (3 red) [A]
Hide: 1-byte hops dropped [T] unit "Hide: the 1-byte hop is left out"; [T] E2E "Hide: no Live polyline vertex sits on the 1-byte hop" M1 drop nothing: unit (4 red) [A]
Hide: resolved_path stays paired [T] unit "server answer wins … shared multi-byte prefix", "stays paired", "wrong length is not realigned" M2 rp not filtered: unit [A]; M11 unpaired rp reused: unit [A]
Hide: remaining segments dashed and lighter [T] unit "every remaining segment is marked"; [T] E2E A→C has live-path-uncertain, 4 6, opacity < 0.8 M3 no flag after drop: unit [A]; M6 no class, M7 not lighter, M8 not dashed: E2E (3 / 2 / 3 red) [A]
Mark: segments at a 1-byte hop dashed and lighter [T] unit "only its own position is marked", "segments that start or end at a 1-byte hop"; [T] E2E A→B and B→C marked, C→D not M4 no flag: unit [A]; M5 both ends needed: unit [A]; M14 call site ignores flag: E2E (3 red) [A]
New packets follow a mode change at once [T] unit "a mode change reaches the next packet at once"; [T] E2E switches Show → Hide → Mark through the customizer select without a reload M9 mode read once: unit and E2E [A]
No hop-filter.js / unknown mode → Show [T] unit "without hop-filter.js …"; regression guards (green on master too): "no mode argument", "unknown mode" M10 fallback mark: unit [A]
Input never mutated [T] regression guard (green on master too) M13 in-place truncation: unit (8 red) [A]
"Multibyte only" unchanged [K] no diff in groupIsMultibyte or the toggle; [A] test-live-multibyte-only-e2e.js 10/10 n/a (no behaviour change)
Perf: filter + resolveHopPositions on 10k paths, budget [T] "filter alone within 250 ms and 15 % of the resolve", "10k within 6 s", "Hide / Mark ≤ 50 % + 20 ms over Show" M12 per-path node scan: unit (filter 13.3 s against a 250 ms budget) [A]

Red on master [A]: with the final unit file against origin/master's live.js, 10 functional tests are red and the perf section throws (_liveApplyOneByteHopsMode is missing), exit 1. The E2E against a master server: Show passes; Hide, Mark and the phone Hide step fail ("a vertex sits on the hidden hop B", "A→B must be marked").

All 15 mutants were killed [A]. M6, M7, M8, M14 and M15 are rendering or call-site mutants, killed by the E2E only. M12's first form (a node scan per hop) was too slow to finish and was replaced by a per-path scan; that one fails the 250 ms filter budget.

Performance (AGENTS.md rule 0)

  • Complexity [K]: O(hops) per path. It is one pass with no lookups, and it allocates one small result object per call in every mode (Show included); the arrays are copied only when a hop is dropped or marked. It runs once per unique observation path, inside the work already done to resolve that path.
  • Node vm, 2,000 nodes, 10k paths of 1–8 hops with mixed 1/2/3-byte hashes and 80 % carrying resolved_path. Best of 5, interleaved [A]:
Show Hide Mark Filter alone (Hide / Mark)
origin/master (mode ignored) 1146 ms 1446 ms 1319 ms n/a
this branch 1160 ms 835 ms 1371 ms 47 ms / 50 ms

Runs locally vary between 0.8 and 2.3 s for the same code, so the checked-in budget assertions are relative: the filter alone costs at most 15 % of the resolve, and Hide or Mark at most 50 % + 20 ms over Show. The absolute caps are generous for CI runners.

  • Real Chromium on the Live page (fixture: 182 nodes, 10k synthetic paths) [A]: the filter alone takes 6.4 ms (Hide) / 11.1 ms (Mark) per 10k paths, about 1 µs per packet. Resolve: master Show 299 ms; branch Show 434 ms, Hide 218 ms, Mark 400 ms. These numbers are noisy locally.

Browser validation [A]

Local Go server with e2e-fixture.db prepared as CI does (freshen, the CI seed SQL, migrate, the four seed files).

  • Real taps: a 375×560 touch phone from a cold start, More → Customize → Display → select → close → Live in the bottom nav. Also 1440×900 by mouse. Each mode in light and dark (prefers-color-scheme).
  • Route: A → B (1-byte) → C (2-byte) → D (3-byte). Facts come from the recorded polylines.
Show Mark Hide
375 light / dark A→B, B→C, C→D solid @0.8 A→B, B→C dashed @0.5; C→D solid @0.8 A→C, C→D dashed @0.5 (no B)
1440 light / dark same same same
  • All 12 runs: scrollWidth equal to the viewport and 0 page errors.
  • Screenshots were taken but are weak evidence: Live paints about 4 fps here and a trail fades within about 0.5 s, so some frames show little of the route. The recorded segment facts above are the evidence.
  • Not done: a deployed instance.

Local test runs [A]

Suite Result
node test-issue-912-live-1byte-hops.js 20/20, five consecutive runs
node test-frontend-helpers.js 738 passed, 0 failed
sh test-all.sh 373/380 files pass; 7 fail on timing budgets (#598 hop inference, #724, #728, #730, #941, #660 heard filter, #882 scope colour). The 6 rerun against an origin/master tree fail the same way; #728 passes on rerun.
cmd/ingestor go test -timeout 20m ./... ok
cmd/server go test -timeout 20m ./... 4 perf budgets over (AdvertIntervalAnalytics_AggregatePerf, ProfileCard_Cost, Coverage941*_PerfBudget), then the 20 m timeout. No Go diff against origin/master [K]; a local slow-machine effect.
node scripts/run-e2e-shard.js --validate 290 suites across three non-empty shards
scripts/check-xss-sinks.sh --diff origin/master clean (exit 0)
New E2E 6/6 on the branch; 3 steps red on master

Live E2E suites against the branch [A]:

CI per job

Expected impact per job [K]:

  • Unit job: one new file. Expect green, as it is stable here.
  • E2E shard 1: one new suite, about 10 s (CI run 46044676327 and locally after the fix round; meanSeconds 10.5).
  • Go jobs: untouched.
  • XSS gate: no sinks.
  • Fork guards: unchanged (9 in deploy.yml, 1 in release-fast-path.yml).

Invariants [K]

  • cmd/server is untouched; no Go change at all.
  • No new map[string]interface{}.
  • No hardcoded colours: the #912 matches in the diff are issue references.
  • Explicit git add only; one commit for M1 plus one for the fix round (d9d7eb47); no rebase, amend or force-push.

Residuals

  • Default visual change: resolved in the fix round, following the owner decision on Live map: follow the 1-byte hop setting, operator default for it, and a working maxHopDist #912 (2026-11-27). With no stored choice, Live uses Show, so Live looks as before for anyone who has not chosen. Other pages keep the mark default. Side effects:
    • A visitor who picked Mark before this PR has "no key" stored (the old rule), so on Live they now see Show. They can pick Mark again.
    • The customizer select still shows "Mark uncertain hops (default)" for a visitor with no choice, because that is the default on the other pages. A hint line says Live shows every hop unmarked until a mode is picked. Picking the already-selected Mark fires no change, so to get Mark on Live such a visitor has to pick another mode first. M2's server-default label replaces this.
  • Follow (Live: “Follow a packet” – replay how one packet spreads through the mesh #880) ignores Hide (review finding 3): a followed packet still draws its 1-byte hops on the Live map, because loadFollow passes the unfiltered resolveHopEntries. This is pinned by the unit test "the follow (Live: “Follow a packet” – replay how one packet spreads through the mesh #880) still sees every hop position in Hide". Follow-up candidate.
  • Mark with ghost hops off (review finding 4): with live-ghost-hops=false, an unplaceable 1-byte hop is dropped by raw.filter(h => h.known) before drawing, so the bridging segment is drawn solid in Mark (Hide would draw it dashed). Ghost hops are on by default; with them on, Mark flags the ghost position.
  • TRACE packets in Hide: the existing hopsCompleted split slices hop positions by index. With hops dropped, the solid/dashed split point can shift. That split was already approximate, since it ignores the sender anchor and unknown hops. Segments keep their uncertain flag.
  • Matrix mode: drawMatrixLine ignores the marking, as it already ignores ghost styling.
  • Not yet in the customizer: UNCERTAIN_SEGMENT_OPACITY (0.5) and the 4 6 dash are constants.
  • E2E runtime: the new E2E waits up to 60 s per route because Live paints at a few fps on GPU-less runners.

🤖 Generated with Claude Code

dborup and others added 2 commits November 27, 2026 12:45
The Show / Mark / Hide setting for 1-byte path hops (hop-filter.js,
#674) now applies to the Live map animation too. resolveHopPositions()
takes the mode, read once per packet group from MC_get1ByteHopsMode(),
so a change reaches the next packet at once:

- Show: unchanged.
- Hide: 1-byte hops are left out (MC_isVisibleHop), with resolved_path
  filtered in step so each server answer stays with its own hop; when
  hops were dropped every remaining segment is dashed and lighter, as
  route-render.js does (Kpa-clawbot#1689 r1).
- Mark: 1-byte hops stay; segments that start or end at one are dashed
  and lighter (class live-path-uncertain on the trail).

The follow (#880) still reads every hop position through
resolveHopEntries(). "Multibyte only" is unchanged.

Tests: test-issue-912-live-1byte-hops.js (vm, per mode, plus a 10k-path
perf budget) and test-issue-912-live-1byte-hops-e2e.js (recorded Live
polylines at 1440x900 and on a 375x560 touch phone).

Relates to #912

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps both new suites in scripts/e2e-shards.json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dborup

dborup commented Nov 27, 2026

Copy link
Copy Markdown
Owner Author

Review — CS-Minimax PR#1004 — head 889a3d6

Dom: REQUEST CHANGES (small: one missing regression test, plus a merge-order condition for the default; the code itself is correct)

Independent, read-only review. Evidence: [T] = a test (the PR's or mine) run by me, [A] = a run or measurement I did locally for this review, [K] = read from the code or diff.

Findings

# Severity Finding Evidence
1 Must fix (test gap) The hopMode argument at the fallback call site (resolveHopPositions(fallbackHops, payload, null, hopMode)) has no test. Mutant X3 drops it, and the unit suite (20/20) and the E2E (6/6) both stay green. This is the line that makes Hide work for a path made only of 1-byte hops (35 % of Live packets in the 2026-11-18 sample): the path_json route filters down to the sender alone, allPaths is empty, and the fallback re-resolves decoded.path.hops. With X3, Hide draws the hidden hop again. The E2E never hits this, because its packets carry no decoded.path. [A] browser probe on the Live page in Hide, a WS ADVERT with path_json=["<1-byte>"] and decoded.path.hops set: head draws 0 polylines and no vertex on the hop; X3 draws 3 polylines with a vertex on it. [T] unit and E2E both green with X3.
2 Owner decision before merge The default mark changes Live for every instance at once (about a third of Live lines dashed and lighter). On 2026-11-18 the owner rejected exactly this variant ("Mark every 1-byte hop … not wanted either"). The 2026-11-27 restart is stated only in the PR body; #912 has no comment recording it. See "Default visual change" below. [K] hop-filter.js DEFAULT_MODE = 'mark'; issue #912 comments of 2026-11-18 and 2026-11-20.
3 Nit Follow (#880) ignores Hide: a followed packet still draws its 1-byte hops on the Live map. The unit test pins this as intended ("the follow still sees every hop position in Hide"), but the PR's residuals list doesn't mention it, and the issue says Hide leaves 1-byte hops out of the Live map. Please list it as a residual or follow-up. [K] loadFollow passes the unfiltered resolveHopEntries. [T] unit "the follow (#880) still sees every hop position in Hide".
4 Nit Mark with ghost hops off (live-ghost-hops=false): an unplaceable 1-byte hop is dropped by raw.filter(h => h.known) before drawing, so the bridging A→C segment is drawn solid. Hide would draw it dashed. This is an edge case; ghost hops are on by default. With ghost hops on, Mark flags the ghost position (I checked this). [K] resolveHopPositions. [A] vm probe with ghost hops on: SENDER-A, REPEATER-B*g, REPEATER-C, REPEATER-D in Mark.
5 Nit scripts/e2e-shards.json gives the new suite meanSeconds: 90. It ran in about 10 s in CI shard 1 (18:19:12 → 18:19:22) and in 9 s here. The inflated value skews shard balancing. [A] CI log of run 46044676327; local timing.
6 Nit The perf test comment says "About 0.8–1.1 s here". CI measured Show at 117.8 ms and I measured 83 ms. The absolute caps (6 s, 250 ms) therefore have about 50× headroom and catch nothing realistic. The relative budgets are the meaningful ones (see Perf). [A] CI JS unit log; local run.
7 Nit "No allocation in Show" is not quite true: applyOneByteHopsMode allocates the out object on every call, Show included. This is negligible (one small object per unique path) and has no measurable effect. [K]
8 Pre-existing, not this PR On a phone, the customizer's close button is 32×29 px, under the 44 px target. The 1-byte select sits below the fold of the Display tab (at y=876 on a 560 px viewport) and needs a scroll. [A] phone walkthrough.

Requested for (1): one test that fails without hopMode on the fallback call. For example, a unit test that drives _liveWSHandler(), or an E2E step in Hide with a pure 1-byte path whose decoded.path.hops is set, asserting that no polyline vertex sits on the hop.

Answers to the review points

Correctness [K][T]

  • applyOneByteHopsMode() runs before resolveHopEntries().
  • Hide keeps resolved_path positionally paired: both arrays are sliced up to the first dropped hop and then pushed in step. A wrong-length resolved_path becomes null after a drop, so it can't start to match the shorter path. When nothing is dropped, the input is returned as is, and downstream already ignores a mismatched length.
  • Mark flags the hop's own position before the sender anchor is unshifted, so the indices line up (resolveHopEntries returns exactly one entry per hop). A segment is uncertain when either end is flagged.
  • Show and unknown modes return the input arrays unchanged.
  • The input is never mutated: the slices are copies. I checked this with the PR's test and mutant X1.

Mode read once per packet group [K][T]

Rendering [K][A]

  • Canvas: isDashed drives setLineDash([4, 6]) and the 1.5 width.
  • The Leaflet trail gets dashArray: '4 6', opacity 0.5 and the class live-path-uncertain, in the segment's own colour. Hash colour now also applies to uncertain segments, because the gate moved from !isDashed to !isGhostLine; ghost lines keep the grey.
  • There are no new colours and no CSS. The class is a hook only.
  • Ghost lines are unchanged (the override opacity still wins).
  • Matrix mode ignores the marking, but Hide still filters there, because the filter runs before resolution. That is acceptable.
  • TRACE in Hide: hopsCompleted indexes the original hops, so the solid/dashed split can shift by the number of dropped hops. The split was already approximate (sender anchor, unknown hops), and TRACE combined with Hide is rare. Acceptable as a listed residual.
  • The Live: “Follow a packet” – replay how one packet spreads through the mesh #880 follow is unchanged; see finding 3.

Default visual change

Tests [T][A]

  • Unit: 20/20 on head. Against origin/master's live.js, 10 functional tests are red and the perf section throws (filter is not a function).
  • E2E: 6/6 on head. Against a master frontend (same server, same fixture), 3 are red: Hide, Mark and the phone Hide step.
  • 6/6 three more times unthrottled, and 6/6 twice under 6× CPU throttling (CDP Emulation.setCPUThrottlingRate) at about 11.5 s per run.
  • The 60 s loop sits inside page.evaluate, so no Playwright timeout cuts it short, and the 30 s readyLive waits had plenty of room. I see no flakiness risk on a slow runner.

Perf [K][A]

  • O(hops) per unique path, with no lookups.
  • Local: Show 83 ms / Hide 56 / Mark 88 for filter + resolve on 10k paths; the filter alone takes 3.6 / 3.9 ms.
  • CI: 117.8 / 78.1 / 125.4 ms; the filter alone takes 5.5 / 5.9 ms.
  • The relative budgets have real margin and are stable:
    • the filter alone uses about 5 % of the resolve, against a budget of 15 % (about 3× margin);
    • Mark costs ≤ 1.5 × Show + 20 ms (about 1.5× margin), and Hide is faster than Show.
  • They are meaningful: the author's M12 (a per-path node scan) blows the filter budget.

Merge commit 889a3d69 [A]

Invariants [K][A]

  • No Go change, so cmd/server stays read-only.
  • No new map[string]interface{}.
  • No hardcoded colours: the only #… additions are issue references.
  • scripts/check-xss-sinks.sh --diff 71372e99 exits 0.
  • Fork guards: 9 in deploy.yml and 1 in release-fast-path.yml; no workflow diff.
  • No closing keywords in the PR body or the commits.
  • Both commits have the expected dborup author identity.
  • Scope: no behaviour change beyond Live map: follow the 1-byte hop setting, operator default for it, and a working maxHopDist #912 M1. "Multibyte only" is untouched, and its E2E is green on head and master.

Phone walkthrough (real taps, cold start) [A]

  • Viewports: 375×560 and 360×640, isMobile and hasTouch, each in light and dark.
  • Steps:
    1. Cold /, with the default mode mark.
    2. Tap More → Customize → the Display tab.
    3. The select is below the fold. Scroll it into view, tap it and choose Hide.
    4. Tap close.
    5. Tap Live in the bottom nav. The map is visible (375×504 or 360×584, nothing on top of it).
    6. Send a WS route A → B (1-byte) → C (2-byte). Result: A→C dashed@0.5, no vertex on B.
    7. Still on Live: More → Customize → Display → Mark → close. Still on #/live, with the map visible.
    8. The next packet gives A→B dashed@0.5, B→C dashed@0.5.
    9. Tap the visible map.
  • Result: in all 4 runs, scrollWidth matched the viewport and there were 0 page errors.
  • No step was impossible. The customizer covers the map while it is open, as a modal does; closing it is the normal flow, not a workaround.

Test runs [A]

Suite Result
node test-issue-912-live-1byte-hops.js 20/20 on head; red on master
node test-issue-912-live-1byte-hops-e2e.js 6/6 (×4, plus ×2 at 6× CPU throttling); 3/6 red on master
sh test-all.sh (merged tree = head tree) 379/381. The 2 failures (#628 vendor gitattributes, #715 OG Denmark) need a .git and fail the same way on a git archive of master; both pass in a git clone of head.
node test-frontend-helpers.js 738 passed, 0 failed
cmd/ingestor go test ./... ok (123 s), exit 0
cmd/server go test ./... Not run locally: no Go diff. CI Go Server Tests 1/3, 2/3 and 3/3 are green.
Live E2E suites, head vs master frontend (same fixture) 12 suites, all green on both head and master: #880 follow 13, #674 modes 7, multibyte-only 10, #428 Live leak 6, Kpa-clawbot#1490 GPU 14, pulse ring 4, scope colour 8, #972 7, #883 teardown 10, #839 teardown 4, Kpa-clawbot#1522 TRACE URL 3, heard filter 14. The PR body reports timing failures in some of these on the author's machine; I could not reproduce them here.
--validate, XSS gate green

CI per job (run 46044676327, attempt 1): every job passed. That covers Go Build & Test, Go Server Tests 1–3, Go Ingestor, Go Libraries & CLI, JS Unit & Lint, Script & Container checks, Verify Go Test Assignments, Verify E2E Shards & Coverage, Playwright E2E 1–3, and the Docker build and validate jobs. Deploy, Release and Badges were skipped, as they should be on a fork PR. I saw no sign of the known flakes #256 or #267, and no reruns.

Server prep: a local Go server on e2e-fixture.db, prepared as CI does: freshen-fixture.sh, the CI seed SQL (Kpa-clawbot#1486 and Kpa-clawbot#1791 rows), corescope-migrate, then the 2073, 199, 245 and 122 seeds.

Mutants (mine) [A]

Mutant Killed by
X1 Hide: resolved_path truncated to the kept length instead of filtered in step (the pairing) unit, 3 red
X2 mode cached across packets at the call site (the mode read) E2E, 2 red (unit green)
X3 fallback call without hopMode survives unit and E2E → finding 1
X4 Mark flags applied after the sender anchor is unshifted (off by one) unit, 2 red
X5 segment uncertain only when its start is flagged unit, 1 red
X6 canvas/trail not dashed for uncertain segments E2E, 3 red (unit green)

Not verified

  • No deployed instance, staging or prod (not allowed for this review).
  • The 1440 px desktop flow I only saw through the PR's E2E, not by hand.
  • Real iOS Safari: I used Chromium touch emulation only.
  • The visual weight of a third of the lines dashed on a busy real feed: I only saw synthetic routes on the fixture.
  • cmd/server Go tests locally: I relied on CI.
  • feat(config): operator default for the 1-byte hop mode (#912 M2) #1001 (M2): reviewed separately; I only read its stated default behaviour from the issue plan.

…ck Hide test

Owner decision on #912 (2026-11-27): until M2 (#1001) lands, a visitor
who never chose a 1-byte hop mode sees the Live map as Show. A stored
Show / Mark / Hide applies as before. Other pages keep hop-filter.js's
DEFAULT_MODE (mark).

- hop-filter.js: an explicit choice is always stored, Mark included,
  so "chose Mark" and "never chose" differ (the rule M2 also adopts).
  New MC_getStored1ByteHopsMode() returns the stored choice or null.
- live.js: oneByteHopsMode() uses the stored choice, else
  LIVE_1BYTE_HOPS_FALLBACK ('show'); M2 replaces this fallback.
- customize-v2.js: the hint says Live shows every hop unmarked until a
  mode is picked.
- Review finding 1: E2E step in Hide with a pure 1-byte path and
  decoded.path.hops set; it fails when the fallback resolveHopPositions
  call drops hopMode (mutant X3).
- Unit: no stored mode -> Show on Live, stored show/mark/hide, Kpa-clawbot#1633
  migration and junk mode. E2E: cold start draws unmarked, explicit
  Mark is stored.
- #674 tests: an explicit Mark is now stored instead of "no key".
- e2e-shards.json: meanSeconds 90 -> 10.5 (CI ~10 s, local 10.5 s).
- Perf test comment: the real timings (60-125 ms per mode).

Relates to #912

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adminopenclaw8-sketch

Copy link
Copy Markdown
Collaborator

Review feedback addressed (commit d9d7eb47)

  1. Owner decision (Live map: follow the 1-byte hop setting, operator default for it, and a working maxHopDist #912, 2026-11-27): with no stored mode, Live now uses Show; a stored Show / Mark / Hide applies as before. hop-filter.js now always stores an explicit choice (Mark included), via the new MC_getStored1ByteHopsMode(), and live.js falls back to LIVE_1BYTE_HOPS_FALLBACK = 'show'. DEFAULT_MODE stays mark for other pages. Tests cover no stored mode, stored show/mark/hide, the feat: customizer toggle to hide 1-byte path hops everywhere — they may do more harm than good Kpa-clawbot/CoreScope#1633 migration and junk. Mutants killed: F1 (fallback dropped) and F2 (Mark stored as no key).
  2. Finding 1: new E2E step, Hide with a pure 1-byte path whose decoded.path.hops is set. It asserts no vertex other than the sender's. It is red with X3 (3 polylines drawn A→B) and green on the fix (8/8).
  3. Finding 3 (Follow ignores Hide) and finding 4 (Mark with ghost hops off) are listed as residuals.
  4. Finding 5: meanSeconds changed from 90 to 10.5.
  5. Finding 6: the perf comment now gives the real timings (60–125 ms per mode).
  6. Finding 7: the PR body's allocation claim is corrected.
  7. The PR body's note, the requirements table and the residuals are updated ("Default visual change" resolved, with two side effects listed).

Local runs: unit 26/26, new E2E 8/8 (×3, about 10.5 s), test-all.sh 381/381, #674 / #673 / multibyte-only / #880 E2E green, --validate and the XSS gate exit 0.

🤖 Generated with Claude Code

@dborup

dborup commented Nov 28, 2026

Copy link
Copy Markdown
Owner Author

Review — CS-Minimax PR#1004 — head d9d7eb4

Dom: REQUEST CHANGES (merge only: the PR conflicts with current master and has no CI on this head; the code and tests of the fix round are good)

This is an independent, read-only re-review after the fix round (d9d7eb47). It covers the first review on this PR and the "Review feedback addressed" comment.

Evidence tags:

  • [T] a test, the PR's or mine, that I ran;
  • [A] a run or measurement I did locally for this review;
  • [K] read from the code or the diff.

Findings

# Severity Finding Evidence
1 Must fix (merge) The PR is CONFLICTING with current origin/master (782e6bda) in scripts/e2e-shards.json. Master added the #740 M3b suites at the end of the list after the earlier merge. As a result, no CI exists for head d9d7eb47: zero check runs. The last CI is run 46044676327 on the pre-fix head 889a3d69 (15 success, 3 skipped). The fix round's code, its new E2E steps and the changed #674 tests have never run in CI. The conflict is trivial: keep both sides. I resolved it that way in scratch, and run-e2e-shard.js --validate gives 295 suites. [A] git merge-tree --write-tree origin/master d9d7eb47 gives CONFLICT (content) in scripts/e2e-shards.json. gh pr view: mergeable: CONFLICTING, mergeStateStatus: DIRTY. commits/d9d7eb47/check-runs: total_count 0.
2 Nit (test gap) In Mark, a flag shifted one position toward the sender survives every test. My mutant Y5, out.oneByte[Math.max(0, i - 1)] = true, passes unit 26/26 and E2E 8/8. Every Mark fixture puts the 1-byte hop first, where that shift changes nothing. The shift the other way (Y5b, i + 1) is killed. Suggest one Mark case with the 1-byte hop in the middle, for example ['C2C2', '18', 'D3D3D3']. [A] mutant runs below
3 Nit (UX, disclosed) A visitor who has never chosen sees the select read "Mark uncertain hops (default)" while Live draws Show. To get Mark on Live they must pick another mode first, because picking the option that is already selected fires no change in a real browser. The new hint line explains this. The PR body lists it, and M2's label replaces it. Not blocking. The E2E cannot see this case: Playwright's selectOption fires change even when the value doesn't change. In my walkthrough, "picking" the already-shown Mark therefore stored mark, which a real tap would not do. [K] customize-v2.js select render (mode === value ? ' selected') and the change listener; [A] walkthrough step 6

Nothing else is open. The rest of the earlier findings are resolved (see below).

Earlier findings

Earlier # Required? Status
1 Fallback call site hopMode untested (X3) Must fix Fixed. A new E2E step, "Hide: a pure 1-byte path with decoded.path.hops set draws no hop (fallback path)", has a Show control in the same suite. My mutant Y4 (the fallback call passes 'show') is killed by that step alone (E2E 7/8); the unit suite stays green. On 889a3d69 the step is green, as expected, because that commit already passed hopMode. It is a regression guard for the call site, and the mutant proves it bites. [T][A]
2 Default visual change, owner decision Owner decision Resolved. The owner's decision of 2026-11-27 is now recorded on #912: "Live defaults to Show until M2; an explicit choice applies at once". The code implements exactly that (see below). [K]
3 Follow ignores Hide Nit Explained: listed as a residual and follow-up candidate in the PR body. [K]
4 Mark with ghost hops off draws a solid bridge Nit Explained: listed as a residual. [K]
5 meanSeconds: 90 Nit Fixed: 10.5, and the measurement note was updated. [K]
6 Perf comment says 0.8–1.1 s Nit Fixed: the comment now says "60–125 ms per mode … the 6 s cap only catches a gross regression". I measured Show 82.8, Hide 55.8 and Mark 86.0 ms. [K][A]
7 "No allocation in Show" Nit Fixed: the PR body now says one small result object per call in every mode. [K]
8 Customizer close button 32×29 px, select below the fold on a phone Pre-existing Unchanged, and that is fine for this PR. The close button is still 32×29. The select is at y≈890 on a 560 px viewport, and the new hint at y≈777. [A]

The fix commit alone (889a3d69..d9d7eb47) [K]

The fix commit changes eight files:

Is the storage change a hidden behaviour change? No; it is the minimum needed for the owner's rule.

  • Every reader of the key goes through hop-filter.js. I found no direct readers in public/ apart from Reset All's key list, which removes the key. After a reset, Live is back on Show, which is consistent.
  • Other pages read the same mode either way.
  • The side effect is the one the PR body states: a visitor who picked Mark before this PR has no key, so Live shows Show for them until they pick again. That is acceptable under "a visitor who has not chosen sees Live as before".

The whole PR against master [K]:

Answers to the review points

  • Every required finding fixed? Yes: finding 1 (test) and finding 2 (owner decision). Each nit is fixed or listed as a residual.
  • New tests red without the fix, green with it? [T][A]
    • Unit (fixed file): against the pre-fix live.js and hop-filter.js from 889a3d69, 3 tests are red: "no stored mode: Show", "no stored mode: drawn unmarked" and "junk counts as no choice". On the merged tree it is 26/26.
    • E2E (fixed file): against a server serving the pre-fix frontend, 2 steps are red: "no stored mode (cold start)" (A→B carries live-path-uncertain) and "Mark … an explicit Mark must be stored" (null). On the merged tree it is 8/8.
    • Fallback step: see earlier finding 1 above. It is green pre-fix by design; mutant Y4 shows it bites.
  • Own mutants: six on the fixed code (table below). Four are killed. Y5 survives (finding 2), and Y5b is killed.
  • Anything else changed that the first review did not see? Only the storage rule above. It is intended, tested on both 1-byte hops: Show / Mark / Hide modes, with Mark as default #674 suites, and consistent with Reset All.
  • Owner decision met? [T][A]

Mutants (mine, on the merged tree) [A]

Mutant What it breaks Killed by
Y1 getStored1ByteHopsMode reads the raw key (no junk drop, no Kpa-clawbot#1633 migration) the stored-mode read unit, 2 red ("Kpa-clawbot#1633 key migrates", "junk counts as no choice"). E2E green.
Y2 Live treats a stored mark as no choice owner rule: explicit Mark applies unit 2 red, E2E 1 red (Mark step)
Y3 Hide flags only the first remaining position all segments uncertain after a drop unit, 1 red
Y4 fallback call passes 'show' instead of hopMode earlier finding 1 E2E, 1 red (fallback step). Unit green.
Y5 Mark flag shifted to i - 1 Mark index survives unit 26/26 and E2E 8/8. See finding 2.
Y5b Mark flag shifted to i + 1 Mark index unit, 2 red

The files were restored after each mutant and checked with cmp against a snapshot.

Phone walkthrough (real taps, cold start) [A]

I ran 375×560 and 360×640, both with isMobile and hasTouch, each in light and dark: 4 runs. Each run used a local Go server serving the merged tree.

  1. Cold / with no stored mode, then tap Live in the bottom nav. The map is 375×504 (or 360×584) and nothing covers it.
  2. A WS route A → B (1-byte) → C (2-byte). Result: A→B solid@0.8, B→C solid@0.8. With no choice, Live is Show.
  3. Still on Live, tap More → Customize → Display. The select shows "Mark uncertain hops (default)", and the new hint is present. Both are below the fold and are reached by scrolling inside the panel.
  4. Pick Hide and tap close. You are still on #/live. The next packet draws A→C dashed@0.5 with no vertex on B.
  5. Same path again, pick Mark and close. The next packet draws A→B dashed@0.5, B→C dashed@0.5.
  6. Tap the visible map centre: it hits the Leaflet layer, not an overlay.

In all 4 runs scrollWidth equalled the viewport and there were 0 page errors. No step was impossible. The customizer covers the map while it is open, as a modal does, and closing it is the normal flow. The only friction is finding 3.

Tests [A]

Everything below ran on the merged tree: origin/master 782e6bda plus the PR, with the shard conflict resolved by keeping both entries.

Suite Result
node test-issue-912-live-1byte-hops.js 26/26 (perf: filter alone 3.6 / 3.9 ms on 10k paths)
node test-issue-674-1byte-hop-modes.js 16/16
node test-frontend-helpers.js 738 passed, 0 failed
sh test-all.sh 381/383. The 2 failures (#628 vendor gitattributes, #715 OG Denmark) need a .git; both pass in a git clone of the head.
cmd/ingestor go test ./... ok (128.8 s), exit 0
cmd/server go test ./... ok (148.3 s), exit 0
node test-issue-912-live-1byte-hops-e2e.js 8/8
Affected Live E2Es, all green #674 modes 7, multibyte-only 10, #880 follow 13, #880 M3 follow customizer 8, #428 Live leak 6, #673 3, heard filter 14, scope colour 8, Kpa-clawbot#1490 GPU 14, #972 7, pulse ring 4, #839 teardown 4, #883 teardown 10
node scripts/run-e2e-shard.js --validate 295 suites across three non-empty shards
scripts/check-xss-sinks.sh --diff 782e6bda exit 0

Server prep: a local Go server on e2e-fixture.db, prepared as CI does:

  • tools/freshen-fixture.sh;
  • the CI seed SQL from deploy.yml;
  • corescope-migrate;
  • the seeds 2073, 199, 245 and 122.

The server was stopped by port.

CI per job: none for d9d7eb47 (finding 1). Run 46044676327 on 889a3d69 was green per job, with skipped Deploy, Release and Badges as expected on a fork PR. That run does not cover the fix round. I can therefore make no statement about the known flakes #256 or #267 on this head.

Invariants [K][A]

  • No Go diff, so cmd/server stays read-only.
  • No new map[string]interface{}.
  • No hardcoded colours: there is no #hex or rgb( in the added lines.
  • The XSS gate is clean.
  • Fork guards: 9 in deploy.yml and 1 in release-fast-path.yml; no workflow diff.
  • No closing keywords in the title, the body or the commits.
  • All 3 commits are authored and committed with the expected dborup identity.
  • Scope: Live only, plus the storage rule that the owner decision needs. "Multibyte only" is untouched, and its E2E is green.

What would make this APPROVE

Merge origin/master into the branch, keeping both sides of scripts/e2e-shards.json, and get a green CI run on the new head. Finding 2 (one Mark fixture with a mid-path 1-byte hop) is welcome in the same push but not required.

Not verified

  • No deployed instance, staging or prod (not allowed for this review).
  • Real iOS Safari: I used Chromium touch emulation only, and the native select picker is not exercised. Finding 3's "no change on the same option" is standard HTML behaviour [K], not something I observed on a device.
  • The 1440 px desktop flow I saw only through the PR's E2E.
  • CI on this head: none exists (finding 1).
  • feat(config): operator default for the 1-byte hop mode (#912 M2) #1001 (M2) was not re-reviewed. I only checked that this PR's storage rule matches what its body says M2 uses.

dborup and others added 2 commits November 28, 2026 11:16
Keeps both sides' new suites in scripts/e2e-shards.json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The master merge kept both copies of test-issue-740-m3a-dagi-filter-e2e.js;
--validate now passes (295 suites).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dborup

dborup commented Nov 28, 2026

Copy link
Copy Markdown
Owner Author

Merge with master done (the only blocker in the re-review of d9d7eb47):

  1. f49fc16a merges origin/master. The only conflict was scripts/e2e-shards.json, where both sides' new suites are kept.
  2. 57e4d636 drops a duplicated test-issue-740-m3a-dagi-filter-e2e.js entry that the keep-both merge produced. node scripts/run-e2e-shard.js --validate now passes (295 suites).

node test-issue-912-live-1byte-hops.js passes 26/26 on the merged tree. No code outside the manifest changed, so the re-review's code and test findings stand as approved. Merging once CI on 57e4d636 is green.

@dborup
dborup merged commit a49526d into master Nov 28, 2026
18 checks passed
dborup added a commit that referenced this pull request Nov 28, 2026
Brings in #1004 (#912 M1). Conflicts resolved:

- public/hop-filter.js: M1's MC_getStored1ByteHopsMode() and this
  PR's MC_get1ByteHopsChoice() had the same contract (the visitor's
  own choice, or null). Keep one: M1's name, with this PR's body,
  which drops junk and migrates the Kpa-clawbot#1633 key itself instead of going
  through get1ByteHopsMode(). customize-v2.js and the #912 M2 unit
  test now call MC_getStored1ByteHopsMode().
- test-issue-674-1byte-hop-modes{,-e2e}.js: both sides made the same
  change (an explicit Mark is stored); master's wording kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dborup added a commit that referenced this pull request Nov 28, 2026
…#912 M2)

PR #1001 review (CS-VM1) R1: after #1004, Live's oneByteHopsMode()
returned the stored choice or a hard "show", so a fresh visitor on an
instance with oneByteHopsDefault "hide" still saw every 1-byte hop on
Live. The owner decision on #912 (2026-11-27) was "once M2 lands, the
operator default decides the starting mode".

- hop-filter.js: get1ByteHopsMode(fallback) resolves the stored choice,
  then the operator default, then the caller's fallback (when it is a
  mode), then mark. Every other caller passes nothing and keeps mark.
- live.js: oneByteHopsMode() is MC_get1ByteHopsMode('show'). Show is
  left only for a page with no default from /api/config/client, or no
  hop-filter.js. LIVE_1BYTE_HOPS_FALLBACK and the "until M2" comment
  are gone.
- The customizer hint no longer says the Live map shows every hop
  unmarked until you pick a mode; the docs and config.example.json
  name the Live map among the places Mark and Hide apply.

Tests:
- test-issue-912-live-1byte-hops.js: "no stored mode" and "junk stored
  mode" now assert the operator default, Show only without one. New:
  a "hide" default with a fresh profile is Hide on Live (red with the
  old fallback), "show"/"mark" defaults, a pick beats the default, a
  late default and Use server default, an invalid default.
- test-issue-912-live-1byte-hops-e2e.js: the cold-start step asserts
  the served default; new steps with /api/config/client answering
  "hide" (Hide on Live, nothing stored) and with no default (Show).
- test-issue-912-m2-1byte-operator-default.js: review N1 (the reset
  button for a pick equal to the default), N2 (clear without an
  operator default fires mark) and the fallback order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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