Skip to content

feat(live): scope palette and legend window in the customizer (#882 M2) - #999

Merged
dborup merged 3 commits into
masterfrom
feat/882-m2-scope-palette-customizer
Nov 28, 2026
Merged

dborup merged 3 commits into
masterfrom
feat/882-m2-scope-palette-customizer

Conversation

@dborup

@dborup dborup commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Relates to #882

What

M2 of #882 (AGENTS.md rule 8): the Live "Color by scope" palette and the SCOPES legend window are now in the customizer. M1 (#919) shipped both as hardcoded defaults.

  • Palette keys. scope1–scope12, scopeNone, scopeUnknown and scopeOther are in THEME_CSS_MAP (→ --scope-*) and in THEME_COLOR_KEYS, so they take part in preset detection. Every theme preset has a light and a dark value for each key. Theme → Live scope colours (15 rows) edits the palette for the current mode, like the other Live colour groups.
  • Colourblind presets. Each preset in cb-presets.js has a scopePalette with a light and a dark list. It sets --mc-scope-{light|dark}-*, and style.css reads it before the default: --scope-N: var(--mc-scope-<mode>-N, <M1 default>). Default (Wong) has no scopePalette, so the stylesheet's M1 palette applies. Deut/prot, trit and achromat have tuned palettes. The achromat ramp is 14 even luminance steps: slots 1–12, then unknown and other. Each step is at least 1.13:1 from the next, and "no scope" sits below 3:1 on the tile, at least 1.79:1 from every slot.
  • Legend window. Display → Live scope legend has two settings: minutes a scope stays listed (1–60, default 15) and how many scopes are listed (1–12, default 12). They are stored per browser in the liveScope section of cs-theme-overrides. The rule lives in LiveScopeColor.SETTINGS; the customizer stores by it and Live reads it back. The legend title follows the setting ("SCOPES (last N min)"). The cap of 64 stays fixed because it bounds memory; the M0 plan only exposes window and rows.

Plan and choices (no separate plan was posted; recorded here)

  1. Theme presets carry one palette, the stylesheet's. The smallest change that meets "a value for every preset" without changing behaviour: picking Ocean, Forest and so on leaves the scope colours exactly as before. Per-preset hues would be a design change nobody asked for.
  2. Cascade: user pick > colourblind preset > stylesheet. A theme-preset pick writes every theme key as an override. Stamped inline, that would hide a colourblind palette. _applyScopeCSS therefore sets --scope-N inline only when the value differs from the stylesheet default for the mode; otherwise it removes it. This also makes a cleared pick take effect without a reload. The trade-off: picking exactly the default colour while a colourblind preset is active shows the preset's colour.
  3. Where the controls live. The colours go in the Theme tab next to "Live moments cards" and "Live kiosk tiles". The window goes in the Display tab after "Live kiosk". Both match the existing layout.
  4. createElement/textContent. The new Display section is built with createElement and mounted before _bindEvents. The colour rows reuse the existing _renderColorRow, which has static labels only, so all colour rows behave the same.
  5. Lines already drawn keep their colour (as in M1 for a mode switch). A pick recolours the legend swatches at once (they are var(--scope-*)) and every new line.
  6. Theme preset detection after a scope pick. The scope keys are in THEME_COLOR_KEYS, as Live: colour packet lines by scope #882 asks, so a theme preset defines them. As a result, one scope colour pick means no theme preset is active any more: after Ocean and then a scope pick, detectActivePreset() returns null, and no preset button is highlighted. The other Live colour groups (moments, kiosk, follow) stay outside preset detection, because no preset defines them. This was a deliberate choice (review finding 6). It is not changed here.
  7. Boot-order fix found by the E2E. On reload, the registry was created before the customizer's theme-changed reached Live, so a saved window was ignored. renderScopeLegend now re-reads the two keys on every render (at most once a second, O(1)).

No change at the defaults

  • Every --scope-* keeps its M1 value as the fallback. With no preset and no pick, the computed palette is identical (unit test pins all 15 × 2 values; the E2E checks the computed values on a fresh page and after picking Ocean).
  • The window defaults are 15 min and 12 rows, as in M1.

Perf

  • Per packet: unchanged (one Map.get/set).
  • configure() runs at most once a second, in the legend render, with two key lookups.
  • _applyScopeCSS runs once per pipeline run: 15 keys.

Tests

  • test-882-m2-scope-customizer.js (29, in test-all.sh):
    • keys and presets, the defaults pinned to style.css, preset detection;
    • applyCSS light/dark; default-equal removal in light and dark mode, compared case-insensitively;
    • colourblind palettes: present in both modes, ≥ 3:1 on the map tile, 12 distinct slots; Default carries none; achromat neutrals ≥ 1.13:1 from every slot and from each other;
    • clearPreset, Reset All and the style.css hooks;
    • SETTINGS keys, defaults and bounds; the registry following configure();
    • setLiveScopeSetting: a default typed back clears the override; storage, import validation, export round trip, the Display badge;
    • the createElement section (a fake DOM whose innerHTML throws);
    • docs.
  • test-882-m2-scope-customizer-e2e.js (9, shard 1):
    • defaults unchanged, including after picking Ocean;
    • a light pick and a dark pick recolour the legend swatch and the next line;
    • a colourblind preset recolours the unpicked slots, and a pick still wins;
    • window and rows retitle and cap the legend, and out-of-range input is put back;
    • reload; export/import round trip;
    • 375×560 touch phone, cold start, light and dark: both sections reached by real taps, then Live with "Color by scope" by a real tap draws the new colour.
  • test-live-scope-color.js: the style.css check now reads the default behind the colourblind hook.
  • Red on master: unit 1/29, E2E 1/9. The passes are guards: the unit "Default carries no scope palette" (master has none at all) and the E2E "defaults unchanged" step. Mutant M5 shows the E2E guard can fail, and a mutant that gives Default a palette fails the unit guard.
  • 28 mutants, all killed (list in the report comment). The review's surviving O1, O3 and O5 are now killed too (unit), along with the achromat palette before the fix and a Reset All that skips the scope hooks.

Customizer implications (rule 8)

Done here. Not exposed: the cap of 64 (a memory bound) and per-scope counts in the legend (optional in M0, not built).

🤖 Generated with Claude Code

Theme keys scope1-12, scopeNone, scopeUnknown and scopeOther (--scope-*)
in THEME_CSS_MAP and THEME_COLOR_KEYS, with light and dark values in
every theme preset (the stylesheet palette, so a preset pick changes
nothing). Each colourblind preset carries a light and a dark scope
palette (--mc-scope-<mode>-*), read by style.css before the M1 default;
a user pick is set inline only when it differs from the default, so a
preset pick never hides the colourblind palette.

Display > Live scope legend: minutes listed (1-60, default 15) and rows
(1-12, default 12), per browser in the liveScope section, by the rule
LiveScopeColor.SETTINGS; built with createElement. Live re-reads them on
each legend render and retitles "SCOPES (last N min)". The cap of 64
stays fixed.

Relates to #882

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

dborup commented Nov 27, 2026

Copy link
Copy Markdown
Owner Author

Report — #882 M2, head 8f82aa1d

Status: CI is green on 8f82aa1d: all 15 jobs that ran passed on the first attempt, so no rerun was needed (the known #271 flake did not fire). Release Artifacts, Deploy Staging and Publish Badges were skipped, as usual for a PR. The local test-issue-670 failure (see below) passes in CI.

Evidence tags: [T] test output · [CI] GitHub Actions · [A] analysis.

CI per job (run 45988235682)

Job Result Time
Go Build & Test ✅ pass <1 min
Go Server Tests (1/3) ✅ pass 11 min
Go Server Tests (2/3) ✅ pass 13 min
Go Server Tests (3/3) ✅ pass 16 min
Go Ingestor Tests ✅ pass 4 min
Go Libraries & CLI ✅ pass 6 min
Verify Go Test Assignments ✅ pass 1 min
JavaScript Unit Tests & Lint ✅ pass 3 min
Script & Container Unit Checks ✅ pass 1 min
Validate Docker Image ✅ pass 1 min
Playwright E2E Tests (1/3) ✅ pass 31 min
Playwright E2E Tests (2/3) ✅ pass 39 min
Playwright E2E Tests (3/3) ✅ pass 39 min
Verify E2E Shards & Coverage ✅ pass <1 min
Build & Publish Docker Image ✅ pass <1 min
Release Artifacts, Deploy Staging, Publish Badges skipped (PR) —

[CI]

Local runs

These ran on the working tree that was committed unchanged as 8f82aa1d (runs 11:50–12:09, commit 12:10, tree clean since), against a local server with the CI-prepared fixture.

  • sh test-all.sh: 380 passed, 0 failed [T]
  • Live and customizer E2E, 51 suites: 50 pass [T]. The one failure is test-issue-670-live-feed-capped-e2e.js, one case at 820×400 ("no panel control centre inside the feed 12,207,372,296"). It fails the same way on a plain origin/master export (71372e9), so it is pre-existing and local, not from this PR [T]; the same case passes in CI [CI]. This PR does not change the Live controls panel [A].
  • New suites: test-882-m2-scope-customizer.js 25/25 and test-882-m2-scope-customizer-e2e.js 9/9 [T].

Mutants (28/28 killed) [T]

# Mutant Killed by
M1 scope keys left out of THEME_COLOR_KEYS unit
M2 scope12 not mapped in THEME_CSS_MAP unit
M3 the mono preset gets no scope palette unit
M4 Default preset light slot 1 drifts from style.css unit
M5 applyCSS: a default-equal value is stamped inline unit
M6 applyCSS: scope keys skipped unit
M7 colourblind scope palette not applied unit
M8 trit light slot 4 too light for the map tile (1.58:1) unit (contrast)
M9 clearPreset keeps the scope variables unit
M10 style.css dark block reads the light hook unit
M11 legendRows bound raised to 24 unit
M12 fractions accepted unit
M13 registry: window ignores the settings unit
M14 registry: rows ignore the settings unit
M15 liveScope not a known section unit
M16 values stored unvalidated unit
M17 bad values pass validateShape unit
M18 Display badge does not count liveScope unit
M19 Reset All keeps --mc-scope-* unit
M20 section title via innerHTML unit
M21 window input max not from the rule unit
M22 no scope colour group in the Theme tab unit
M23 legend never re-reads the window E2E
M24 legend title not updated E2E
M25 palette cache kept on theme-changed E2E
M26 registry ignores SITE_CONFIG E2E
M27 Display section not mounted E2E
M28 change handler never stores E2E

Three were redone before they counted: M8 and M10 first matched twice and were re-anchored, and M16's first kill was a syntax error, so it was rewritten as a real mutant and killed by the persistence test.

Phone and themes

375×560 touch phone from a cold start, light and dark, real taps: the Theme and Display sections and Live with "Color by scope" (covered by the E2E's phone cases). Desktop legend screenshots in light and dark were taken locally.

🤖 Generated with Claude Code

@dborup

dborup commented Nov 28, 2026

Copy link
Copy Markdown
Owner Author

Review — CS-VM1 PR#999 — head 8f82aa1

Dom: REQUEST CHANGES

The feature is in good shape. It does what #882 M2 asks, the defaults are unchanged, the phone flow works by real taps, and the PR's own mutants are all killed. It cannot be merged as it stands, though:

Both are cheap to fix in the same rebase.

Evidence: [T] = I ran it here (linux/amd64); [K] = read in the code at the head or in the merged tree; [A] = my analysis or inference, not run.

Findings

# Severity Finding Evidence
1 Blocker The head no longer merges with origin/master cff83990. git merge-tree --write-tree origin/master 8f82aa1d reports 18 conflict hunks: 11 in public/customize-v2.js and 7 in public/cb-presets.js. All are "both sides added next to each other" with #880 M3 (follow colours and settings). The resolution is mechanical, but some hunks are semantic and a plain union is wrong (see below). [T]
2 Medium (test gap) _applyScopeCSS compares a value with the dark stylesheet defaults in dark mode, which keeps a theme-preset pick off <html> so a colourblind palette can win. Nothing tests that half. My mutant O1 (SCOPE_PRESET_COLORS[dark ? 'themeDark' : 'theme'] → SCOPE_PRESET_COLORS['theme']) survives the unit suite (25/25) and the E2E (9/9). Its effect, measured in a browser: dark mode, pick Ocean, then pick Deuteranopia → --scope-1 is stamped inline as #3d8bfd and the deut palette (#648FFF) never shows. The real code gives #648FFF with nothing inline. The unit test "a value equal to the stylesheet default … leaves --scope-N to style.css" runs only in light mode, and the E2E colourblind step is light-only. The PR body's "applyCSS light/dark and default-equal removal" is therefore only half covered. [T] mutant + probe, [K] test
3 Low–Medium (design) Achromat palette: the three non-slot colours nearly match a named slot in luminance, which is the only cue that palette carries. Measured as WCAG luminance ratios against the closest slot: light: unknown #57534e vs slot 6 #525252 = 1.02, other #111827 vs slot 2 #1a1a1a = 1.02; dark: none #6b7280 vs slot 11 #757575 = 1.05, unknown vs slot 6 = 1.05, other #f8fafc vs slot 1 #ffffff = 1.05. The owner's data puts "no scope" at about 83 % of traffic, so in dark achromat mode a named scope on slot 11 draws like the bulk of the map. The M0 plan wanted neutrals that are not confused with scopes; the new contrast test checks only slots against the tile. Suggestion: keep the ramp out of the neutrals' luminance bands (or give achromat its own none/unknown/other), and add a "neutral vs slot" check for that preset. The legend names still make it readable, so this does not block on its own. [T] computed from cb-presets.js
4 Low (test gap) Two surviving mutants, both on behaviour the code comments promise. O3: typing the default back (15 / 12) stores an override instead of clearing it (if (v === R.DEFAULTS[key]) clearOverride → if (false)), which would leave a stale override dot and Display badge; no test. O5: dropping .toLowerCase() in _applyScopeCSS, so an imported upper-case default (for example #0072B2) would be stamped inline and hide a colourblind palette; no test. [T] mutants
5 Nit (DRY) The M1 palette now lives in three places: style.css, SCOPE_PRESET_COLORS in customize-v2.js and the Default scopePalette in cb-presets.js. Tests pin them together. Reset All also spells out the 15 suffixes again (customize-v2.js, the ['1', …, 'other'] literal), although MeshCorePresets.SCOPE_SUFFIXES is exported. [K]
6 Note (design, no change asked) The scope keys are in THEME_COLOR_KEYS, as #882 and the owner's status comment ask. One consequence the PR states only indirectly: one scope colour pick makes no theme preset active. Probe: after Ocean, then a scope pick, detectActivePreset() returns null, and on reopening no preset button is highlighted. The other Live colour groups (moments, kiosk, follow) deliberately stay outside preset detection. Worth a line in the docs, or an owner decision, but not a defect. [T] probe, [K]

Resolving #1 (what I did to test the merged tree, for the author's rebase):

  • VALID_SECTIONS and OBJECT_SECTIONS need both 'follow' and 'liveScope'. Taking both conflict sides would declare the variables twice, and follow would be lost.
  • The Display badge needs both _countOverrides('follow') and _countOverrides('liveScope').
  • Each colourblind preset needs a comma after followAccents: {…}.
  • applyPreset must close the follow forEach before the scope block starts.
  • The import validation must close the follow block's braces before the liveScope block.
  • The Theme tab needs both the followRows loop (with its closing brace) and the scopeRows loop.

With that resolution, the merged tree passes every check in this review (below). The author should still rebase, rerun everything and let CI confirm it [A].

Master moved during this review. It went from cff83990 to 782e6bda (#1003, #1008, #1010, #1011, #1013). A fresh git merge-tree against 782e6bda gives the same 11 + 7 conflict hunks in the same two files [T]. The new master also changes public/style.css, which merges cleanly [T]. All test results below are from the merge with cff83990; I have not tested a merge with 782e6bda.

Answers to the checklist

  • Theme keys. [T] [K]
    • scope1–scope12, scopeNone, scopeUnknown and scopeOther are in THEME_CSS_MAP (→ --scope-*) and in THEME_COLOR_KEYS.
    • Every theme preset gets a light and a dark value for all 15 keys. They are added at load time: one palette, the stylesheet's.
    • All five colourblind presets (default/Wong, deut, prot, trit, achromat) carry a light and a dark scopePalette. Deut and prot are identical (stated in the PR).
    • No change at the defaults. On a fresh page the computed --scope-* equal M1 in both modes, and picking Ocean leaves them alone and stamps nothing inline. This is the E2E step plus my probe.
    • The export/import round trip works (E2E step).
  • Legend window.
    • Bounds: 1–60 min and 1–12 rows, whole numbers only. Out-of-range or fractional input is put back. [T]
    • Stored per browser in cs-theme-overrides.liveScope; my phone run stored {"windowMinutes":7,"legendRows":2}. [T]
    • Defaults 15 / 12, equal to M1 (SETTINGS_DEFAULTS, unit test). [T]
    • The cap of 64 is unchanged. [K]
  • Live.
    • A colour pick recolours the legend swatch at once (it is var(--scope-N)) and the next line, without a reload. Already drawn lines keep their colour, as in M1. [T] E2E + phone run
    • No leaks: the theme-changed listeners on window were 3 on Live, 1 after leaving, and 3 again after returning. The page fired theme-changed after leaving Live without errors, measured via CDP getEventListeners in all four phone runs. [T]
    • test-issue-428-live-listener-leak-e2e 6/6 and test-883-live-teardown-e2e 10/10. [T]
    • There is no test for this listener (see mutants). [K]
  • XSS and theming.
    • The Display section is built with createElement/textContent. The legend title uses textContent, and the colour rows reuse _renderColorRow with static labels. [K]
    • scripts/check-xss-sinks.sh --diff origin/master exits 0 with no findings. [T]
    • No hex is added outside :root and the dark theme blocks in style.css; the only hit in added lines is a comment. Hex in cb-presets.js and customize-v2.js is preset data, as already done there. [T] [K]
  • Perf.
    • Per packet: unchanged (one Map.get/set). [K]
    • configure() runs per legend render (at most once a second), with two key lookups. [K]
    • _applyScopeCSS runs once per pipeline run, over 15 keys. [K]
    • No new per-item API calls. [K]
  • cmd/server read-only, map[string]interface{}:
    • The PR changes no Go file. [T]
    • It adds 0 new map[string]interface{}. [T]
    • TestServerDBHasNoWriteMethods, TestServerDBConnIsReadOnly and TestServerSourceHasNoCachedRWCalls pass. [T]
  • Fork guards, closing keywords and author.
    • The fork guards stand at 9 in deploy.yml and 1 in release-fast-path.yml; no workflow is changed. [T]
    • The body says "Relates to Live: colour packet lines by scope #882", with no closing keyword. [K]
    • The commit author is dborup <kontakt@meshview.dk>. [T]
  • Acceptance criteria, red before and green after:
    • The palette keys and preset values and the legend window are covered by test-882-m2-scope-customizer.js: 0/25 on master, 25/25 on head and on merged. [T]
    • The E2E is 1/9 on master (only the "defaults unchanged" guard passes, as the PR says), 9/9 on merged. [T]
  • No behaviour change beyond the purpose.
    • The changes in live.js are the configure() re-read, the title and the renamed listener. [K]
    • test-live-scope-color.js changes only its CSS parser for the var(--mc-scope-…, #default) hook. [K]
    • Exception: preset detection after a scope pick (finding 6). [K]

Phone check (my own flow, merged tree, cold start at /, real taps, no deep link) [T]

The flow ran at 375×560 and 360×640, touch with isMobile, in light and dark via colorScheme, and every tap was on the visible element after an elementFromPoint hit check:

  1. More → Customize.
  2. Theme → tap "Live scope colours (15 options)". 15 rows; the picker is 48×48 px; scope1, scopeNone and scopeOther all fit on screen.
  3. Pick a colour. The native picker cannot be driven, so the value was filled and change dispatched, as in the PR's E2E.
  4. Display → tap and type 7 and 2 in "Live scope legend". The inputs are at least 40 px tall, nothing scrolls sideways, and the values are stored.
  5. Close by tap → Live through the bottom nav → the controls toggle → tap "Color by scope".
  6. The line uses the picked colour, and the legend in the settings panel reads "SCOPES (last 7 min)" with 2 rows plus "+1 more".

Results:

  • No step was impossible, and nothing had to be closed first. There were no page errors in any of the 4 runs.
  • Outside this PR: on a first visit the existing gesture hints ("Tip: swipe …") overlay the customizer header and its lower part on a phone. They did not block the taps, and they are the same on master [A].

Tests [T]

Environment note: this VM (4 vCPU) renders about 3.5 fps at 1400×900 in headless Chromium. One Live line takes 8.5–10.6 s to complete there, against about 1.5–2 s at 375×560 (my probe on a plain master server). The desktop steps of both test-882-m2-scope-customizer-e2e.js and M1's test-live-scope-color-e2e.js wait 8 s for a line, so both fail here on master too (M1 suite on master: 3/8). For the PR's E2E I therefore ran a scratch copy with only timeout: 8000 → 40000 changed. CI ran the original green on the head.

Run Tree Result
sh test-all.sh merged 373/382 files. The 9 that fail are perf-budget or timing asserts: test-live-heard-filter, test-live-scope-color (perf case only, 19/20), test-live-follow, test-issue-724-masts-hint, test-issue-728-ortho-base, test-issue-941-predicted-reach, test-issue-730-buildings-ui, test-dagi-filter, test-issue-598-hop-path-inference. The same files fail on master here (all 9; on merged, test-dagi-filter passed on a rerun), so this is environmental.
node test-frontend-helpers.js merged 738 passed, 0 failed
test-882-m2-scope-customizer.js master / head / merged 0/25 / 25/25 / 25/25
test-882-m2-scope-customizer-e2e.js (40 s line wait) master / merged 1/9 / 9/9
same, unmodified head / merged 4/9 / 4/9 (desktop line waits time out, see the note; the 2 phone steps pass)
scripts/run-e2e-shard.js --validate merged / head OK, 292 / 290 suites in three shards
scripts/check-xss-sinks.sh --diff origin/master head exit 0, clean
Live and customizer E2E (merged, run alone) merged Pass: 881-m3-moments-customizer 8/8, 914-heat-palette 14/14, 968-kiosk-customizer 8/8, customize-theme 8/8, customize-display 8/8, customize-export 6/6, customize-branding, logo-theme, 741-customizer 6/6, 734-customizer-overlays 6/6, 681-m6-customizer-terrain 30/30, 883-live-teardown 10/10, 839-live-teardown 4/4, 428-live-listener-leak 6/6, 480-no-scope 25/25, 1204-live-panel-structure. Fail here on master as well: 880-m3-follow-customizer (merged 5/8, master 4/8) and issue-880-live-follow (merged 8/13 and 7/13, master 9/13 twice). Their failures are clicks on #chooseExp or the auto-hidden top nav, and 1.5–15 s timing windows; the PR does not touch Follow [A]. In a first run under parallel load, 968, 734 and 839 failed; alone they all pass.
Go cmd/server (targeted) merged TestGraphScore629_GoldenBitIdentical PASS on amd64; the three read-only invariant tests PASS; go vet clean
Go cmd/ingestor (go test -count=1 -timeout 45m ./...) merged ok (1017 s). A first run with Go's default 10 min timeout was cut off inside TestNeighborEdgesBuilderDeltaScan, with 0 failures before that; this VM is slower than CI (4m54s).

The E2E server followed CI: freshen, the inline seed SQL, corescope-migrate, then the 2073, 199, 245 and 122 seeds. I used 245 and 122 as well because the current workflow runs them. The Go binaries were built from the merged tree, and the servers were stopped by port after checking each process's command line.

Mutants [T]

All mutants were applied to a copy of the merged tree.

# Mutant Result
PR M5 applyCSS stamps a default-equal value inline killed (unit)
PR M9 clearPreset keeps --mc-scope-* killed (unit)
PR M12 fractions accepted killed (unit)
PR M14 registry rows ignore the setting killed (unit)
PR M18 Display badge does not count liveScope killed (unit)
PR M19 Reset All keeps --mc-scope-* killed (unit)
PR M23 legend never re-reads the window (configure() removed) killed (E2E, 3 steps)
PR M25 palette cache kept on theme-changed killed (E2E, 3 steps)
O1 _applyScopeCSS compares with the light defaults in dark mode survived unit 25/25 and E2E 9/9 → finding 2
O3 the default value stored as an override instead of cleared survived → finding 4
O5 case-sensitive default comparison survived → finding 4
O6 registry expiry uses the fixed 15 min instead of the setting killed (unit, 2 tests)
O8 colourblind preset writes its light palette into the dark hooks killed (unit, 2 tests)

Not verified

  • The full Go cmd/server suite. The PR changes no Go and the merged tree's Go is byte-identical to master; I ran only the targeted tests above.
  • Of the author's 28 mutants I reran 8; the other 20 I did not run.
  • Of the 61 Live/customizer E2E suites, I ran 19 (listed above), not all.
  • The unmodified desktop E2E steps with their 8 s timeout, on hardware like CI's: here they fail on master too.
  • A real native colour picker on a phone (the value is filled, as in the PR's E2E).
  • An iOS/Safari engine (Chromium only).
  • My conflict resolution is a reviewer's resolution for testing, not the author's. After the rebase, CI on the new head is what counts.
  • Real traffic, and whether achromatopsia users actually confuse the colours in finding 3 (computed luminance only).

dborup and others added 2 commits November 28, 2026 11:18
Resolves the conflicts with #880 M3 (follow colours and settings) in
public/customize-v2.js and public/cb-presets.js by keeping both sides:
VALID_SECTIONS/OBJECT_SECTIONS list 'follow' and 'liveScope', the Display
badge counts both, each colourblind preset carries followAccents and
scopePalette, applyPreset/clearPreset set and clear both, and the import
validation and the Theme tab rows keep both blocks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ette copy less (#882 M2)

Review of #999:
- test the dark half of _applyScopeCSS (a preset pick in dark mode stays
  off <html>) and its case-insensitive default comparison (mutants O1, O5);
- setLiveScopeSetting(): the legend window's store rule, out of the
  change handler, like setFollowSetting; a default typed back clears the
  override (mutant O3), now unit-tested;
- achromat scope palette: 14 even luminance steps (slots, unknown,
  other), each >= 1.13:1 from the next; "no scope" below 3:1 on the tile
  and >= 1.79:1 from every slot (was 1.02-1.05 against the nearest slot);
- the Default colourblind preset no longer repeats the style.css palette,
  and Reset All derives the 15 hook names from SCOPE_COLOR_KEYS.

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

dborup commented Nov 28, 2026

Copy link
Copy Markdown
Owner Author

Review feedback addressed (commit 5d926634, on top of merge commit a63c68ab)

  1. Finding 1 (merge with master): origin/master (fe32ee49) is merged in with a merge commit; there was no rebase. All 18 hunks are resolved as the review describes:

    • VALID_SECTIONS and OBJECT_SECTIONS list both 'follow' and 'liveScope'.
    • The Display badge counts follow and liveScope.
    • Each colourblind preset has followAccents: {…}, followed by scopePalette.
    • applyPreset closes the follow forEach before the scope block, and clearPreset clears both.
    • The import validation closes the follow block before liveScope.
    • The Theme tab keeps both followRows and scopeRows.
    • Follow and scope unit suites on the merged tree: test-880-m3-follow-customizer 22/22, test-live-follow 39/39, test-882-m2-scope-customizer 29/29, test-live-scope-color 20/20.
  2. Finding 2 (O1): new unit test applyCSS, dark mode: a preset pick is compared with the dark stylesheet defaults and stays off <html>. In dark mode, Ocean leaves every --scope-* off <html>, and the light default picked in dark mode is stamped as a real pick. O1 is killed.

  3. Finding 3 (achromat): new palette, built as a ramp of 14 even luminance steps from black (light tiles) or white (dark tiles) to just above 3:1 on the tile: slots 1–12, then unknown, then other. "No scope" sits below 3:1, as in the stylesheet's light palette, so the bulk of the traffic recedes. Luminance ratio to the nearest slot, before → after:

    Mode none unknown other
    light 1.44 → 1.80 1.02 → 1.15 1.02 → 1.32
    dark 1.05 → 1.79 1.05 → 1.15 1.05 → 1.32
    • The neutrals among themselves are now ≥ 1.14 (none/unknown 1.56–1.57, none/other 1.36–1.37, unknown/other 1.14).
    • Slots against the next slot: ≥ 1.13 (was 1.10 light, 1.14 dark). Slots against the tile: ≥ 4.0:1 (was 3.2).
    • The trade-off: 12 slots and 2 neutrals have to share the band between black (or white) and 3:1, so a gap much larger than ~1.13 is not possible. In dark mode, "no scope" now draws at 2.2:1 on the tile (was 3.6), the same as the light palette's.
    • New unit test: in achromat, none, unknown and other stay ≥ 1.13:1 from every slot and from each other. The old palette fails it in both modes.
    • docs/CUSTOMIZATION.md mentions this.
  4. Finding 4 (O3, O5):

    • The legend window's store rule moved out of the change handler into setLiveScopeSetting(key, v), mirroring setFollowSetting. A unit test checks that a default typed back (15 / 12) leaves no override and no badge count, and that a bad value is refused. O3 is killed.
    • New unit test: an imported upper-case default (#0072B2 …) is not stamped inline. O5 is killed.
  5. Finding 5 (DRY):

    • The Default colourblind preset no longer carries a scopePalette. Its hooks are removed, and style.css decides; the result is identical, and a unit test pins it.
    • Reset All derives the 15 hook names from SCOPE_COLOR_KEYS/THEME_CSS_MAP instead of the suffix literal.
    • Two copies remain on purpose. style.css is the fallback in the stylesheet, and the project has no build step to share it from. SCOPE_PRESET_COLORS is needed to tell a default-equal value from a pick, and reading computed styles there would pick up the colourblind preset. The unit tests pin the two together.
  6. Finding 6: no change. The consequence (a scope pick means no theme preset is active) is now stated in the PR body under "Plan and choices", item 6.

Mutants (unit suite, each on a scratch copy): O1, O3, O5, Reset All skipping the scope hooks, the old achromat light palette, the old achromat dark palette, Default with a palette, and setLiveScopeSetting without validation. All 8 are killed.

Checks on 5d926634, macOS arm64:

  • sh test-all.sh: 383/383 files pass.

  • scripts/run-e2e-shard.js --validate: OK, 295 suites in three shards.

  • scripts/check-xss-sinks.sh --diff origin/master: exit 0.

  • New map[string]interface{}: 0.

  • E2E against a local server built from this tree (the fixture prepared as in CI: freshen, the inline seed SQL, migrate, and the 2073/199/245/122 seeds). All pass:

    Suite Result
    882-m2-scope-customizer 9/9
    live-scope-color 8/8
    issue-480-no-scope 25/25
    880-m3-follow-customizer 8/8
    issue-880-live-follow 13/13
    customize-theme 8/8
    customize-display 8/8
    customize-export 6/6
    customize-branding 10/10
    741-customizer 6/6
    734-customizer-overlays 6/6
    881-m3-moments-customizer 8/8
    968-kiosk-customizer 8/8
    logo-theme pass

    issue-480 failed 5 steps on its first run because I had not yet applied the inline GRP_DATA seed. With the seed it passes 25/25.

@dborup

dborup commented Nov 28, 2026

Copy link
Copy Markdown
Owner Author

Review — CS-VM3 PR#999 — head 5d92663

Dom: APPROVE

This is a re-review after the fix round: merge commit a63c68ab (origin/master fe32ee49 merged in) and fix commit 5d926634. Every required finding of the first review is fixed, and each of its nits is fixed or explained.

  • The merge resolution matches the first review's notes line for line. Nothing outside the two conflicted files differs from Git's own automatic merge.
  • The head also merges cleanly with current origin/master a49526df.
  • The new tests are red without the fix and green with it. O1, O3 and O5 are now killed, and so are 11 mutants of my own.
  • My own cold-start phone walk (scope palette, legend window, follow colours and a colourblind preset, all by real taps) passes at 375×560 and 360×640 in light and dark.
  • Nothing is left to change. The notes below need no action.

Evidence: [T] = I ran it here (linux/amd64, 4 vCPU); [K] = read in the code at the head or in the merged tree; [A] = my analysis or inference, not run.

Findings

# Severity Finding Evidence
1 — The first review's Blocker (conflicts with master) is fixed. The merge resolution is correct, see "Merge resolution" below. git merge-tree --write-tree origin/master 5d926634 against current a49526df (#1004, #912 M1) is clean (tree 060ccbfa). The overlap with #1004 is one hint string in customize-v2.js and its live.js changes, which land unchanged. [T]
2 — Finding 2 (O1) is fixed. The new unit test "applyCSS, dark mode: …" kills O1. [T]
3 — Finding 3 (achromat) is fixed. My own computation matches the author's table, see "Achromat" below. [T]
4 — Finding 4 (O3, O5) is fixed. setLiveScopeSetting() is now unit-tested, and the upper-case import test kills O5. [T]
5 — Finding 5 (DRY) is fixed as far as reasonable. Default has no scopePalette any more, and Reset All derives the hook names from SCOPE_COLOR_KEYS/THEME_CSS_MAP (my mutant N1 checks it). The two copies that remain (style.css and SCOPE_PRESET_COLORS) are explained, and the unit tests pin them together. [T] [K]
6 — Finding 6 (preset detection) is explained as item 6 of the PR body. No change was asked. [K]
7 Note In dark achromat, "no scope" now draws at 2.23:1 on the tile (#525252 on #1a1a1a; it was 3.6:1). That is deliberate, so the bulk of the traffic recedes, and it equals the stylesheet's own light "no scope" (#a1a1aa, 2.23:1). The slot gaps (≥ 1.133) and the unknown-to-nearest-slot gap (1.15) are close to the 1.13 floor. 12 slots plus 2 neutrals in one luminance band leave little room, as the author says. No change asked. [T] computed
8 Note The dark half of the cascade is tested in the unit suite only; the E2E colourblind step is still light-only. The unit test kills O1, which is what finding 2 asked for, so this is fine. [K] [T]
9 Note (environment, not this PR) On this VM the 8 s line wait in test-882-m2-scope-customizer-e2e.js and in M1's test-live-scope-color-e2e.js is too short for desktop steps. Both fail the same way against master, and pass 9/9 and 8/8 once the wait is 40 s. CI ran the original green on this head. [T]

Merge resolution (a63c68ab) [T] [K]

  • What changed.
    • git diff <auto-merge tree> a63c68ab touches only public/customize-v2.js and public/cb-presets.js, the two conflicted files.
    • For the other 9 files of the PR, the PR's patch against master is the same before and after the fix round (I compared the +/- lines of cd5ae0b6..8f82aa1d with origin/master..merged).
  • Checked in git show --cc a63c68ab:
    • VALID_SECTIONS and OBJECT_SECTIONS list both 'follow' and 'liveScope'.
    • The Display badge counts _countOverrides('follow') + _countOverrides('liveScope').
    • Every colourblind preset is valid JS, with followAccents: {…}, followed by scopePalette. node --check passes.
    • applyPreset closes the follow FOLLOW_KINDS.forEach before the scope block.
    • clearPreset clears both the follow and the scope hooks.
    • The import validation closes the follow block before the liveScope block.
    • The Theme tab keeps both the followRows and the scopeRows loops and both <details>.
    • Display mounts the scope section after _renderFollowSettings() and _renderKioskSettings().
    • THEME_COLOR_KEYS still leaves out FOLLOW_COLOR_KEYS and keeps the scope keys.
  • The follow side of the merge is guarded by the follow suite. My mutants N5 (follow dropped from VALID_SECTIONS), N6 (the badge drops follow) and N7 (clearPreset keeps --mc-follow-*) are each killed by test-880-m3-follow-customizer.js.

The fix commit alone (5d926634) [K]

It changes 4 files: cb-presets.js, customize-v2.js, docs/CUSTOMIZATION.md and test-882-m2-scope-customizer.js.

  • cb-presets.js: Default loses scopePalette, and achromat gets the new ramp.
  • customize-v2.js:
    • the new setLiveScopeSetting() (validate, then clear on the default or store), now used by the change handler;
    • Reset All derives its hook names;
    • the export of the new function.
  • docs/CUSTOMIZATION.md: one sentence.
  • The test file: 4 new tests, and 2 reworked for Default.

Nothing else changes in behaviour. The change handler still puts back a bad value, as before (my walk and the E2E check this).

Achromat (computed from the merged cb-presets.js) [T]

Mode Slots vs tile (min) Adjacent slots (min) none (vs tile / nearest slot) unknown other none/unknown, none/other, unknown/other
light 4.01 1.134 2.22 / 1.81 3.49 / 1.15 3.05 / 1.32 1.57, 1.37, 1.15
dark 4.00 1.133 2.23 / 1.80 3.46 / 1.15 3.03 / 1.32 1.56, 1.36, 1.14

This matches the author's numbers.

Answers to the checklist

  • Every required finding is fixed, and each nit is fixed or explained. Yes, see findings 1–6. [T] [K]
  • The merge resolution is correct. Yes, see above. [T] [K]
  • The follow-colour (Live: “Follow a packet” – replay how one packet spreads through the mesh #880/feat(live): Follow a packet settings and colours in the customizer (#880 M3) #1000) and scope-palette suites on the merged tree [T]:
    • unit: test-880-m3-follow-customizer 22/22, test-live-follow 39/39, test-882-m2-scope-customizer 29/29, test-live-scope-color 19/20;
    • the one failing case in test-live-scope-color is the perf assert, which fails on master too: 273–518 ms against a 50 ms budget on this VM;
    • test-live-follow's perf case flaked once under load and passed on 5 reruns.
  • The new tests are red without the fix and green with it. [T]
    • The fix commit's test file run against a63c68ab gives 26/29. The 3 red tests are: Default carries no palette; achromat neutrals; setLiveScopeSetting.
    • The O1 and O5 tests pass at a63c68ab, because they guard code that was already correct. They do kill the O1/O5 mutants (below).
    • On the merged tree all 29 are green.
    • Against master the unit suite is 1/29, and the E2E is 1/9 (only the "defaults unchanged" guard passes), as the PR says.
  • Nothing else changed unseen. Yes. I diffed the fix commit alone, the merge against both parents, the merge against Git's own auto-merge, the whole PR against master, and the merge with current master. [T]
  • No behaviour change beyond the purpose. [T] [K]
    • The PR's live.js and live-scope-color.js changes are identical to what the first review saw.
    • The neighbouring suites on the merged tree give the same results as master, run one after another: moments 8/8, kiosk 8/8, 480-no-scope 25/25, M1 scope 8/8 (both at 40 s), the follow E2Es (same failures as master, below), and 912 8/8.
  • cmd/server stays read-only, and there are no new map[string]interface{}.
    • No Go file changes; the merged tree's Go is byte-identical to master. [T]
    • The diff adds 0 map[string]interface{}. [T]
    • TestServerDBHasNoWriteMethods, TestServerDBConnIsReadOnly and TestServerSourceHasNoCachedRWCalls pass. [T]
  • No hardcoded colours. The added hex is in style.css --scope-* definitions (unchanged since the first review) and in preset data in cb-presets.js/customize-v2.js, as already done there. live.js and live-scope-color.js add no hex. [T] [K]
  • XSS. scripts/check-xss-sinks.sh --diff origin/master exits 0, both on the head and on the merged tree (run in a scratch clone). [T]
  • Fork guards, closing keywords and author. [T]
    • The fork guards (github.repository == 'Kpa-clawbot/CoreScope') stand at 9 in deploy.yml and 1 in release-fast-path.yml, on the head and on the merged tree. No workflow is changed.
    • There is no closing keyword in the body or the commits ("Relates to Live: colour packet lines by scope #882").
    • All 3 commits are authored and committed by dborup <kontakt@meshview.dk>.
  • CI. Run 46135740607 is on head 5d926634 (checked with the public API): conclusion success. All jobs passed; Release, Deploy Staging and Publish Badges were skipped, as usual for a PR. [T]

Phone and browser (my own walk, merged tree, local server) [T]

The walk starts cold: a fresh context at /, no deep link and no storage priming. The theme comes from colorScheme only. Touch is on with isMobile. Before every tap, an elementFromPoint check confirms the target is the visible element and inside the viewport. Then touchscreen.tap at its centre.

The steps:

  1. More → Customize.
  2. Theme → tap "Live scope colours (15 options)". 15 rows for the mode's section (theme or themeDark), and the picker is 48×48. Pick scope 1, and --scope-1 follows.
  3. Theme → tap "Live follow a packet (4 options)". 4 rows; pick the observer colour, and --follow-observer follows.
  4. Colors → tap the Deuteranopia radio.
    • The unpicked --scope-2 changes to the deut palette of the mode (light #c25000, dark #fe6100), and nothing is stamped inline.
    • The picked --scope-1 still wins.
    • The unpicked --follow-relay changes to deut's #fe6100, and the picked observer still wins.
  5. Display → tap and type 7 and 2 in "Live scope legend". The inputs are 48 px tall.
    • A typed 40 is put back to 2.
    • The storage holds {"windowMinutes":7,"legendRows":2}, and the Display badge reads 2.
  6. Close → Live through the bottom nav → tap "Color by scope". Three packets are injected with real fixture nodes (no /api/nodes stub).
    • The slot-1 line is #cc0077 (the pick), and the slot-2 line is the deut colour.
    • The legend reads "SCOPES (last 7 min)" with 2 rows plus "+1 more".

Results:

  • 375×560 and 360×640, light and dark: 4/4 runs pass, no step impossible, nothing had to be closed first, 0 page errors, and no sideways scroll on any screen.
  • Outside this PR (as in the first review): on a first visit the "Tip: swipe in from the left edge…" bubble overlays the customizer header. It did not block any tap, and it is the same on master [A].
  • The PR's own E2E phone steps (375×560, light and dark) pass too.

Tests [T]

Run Tree Result
sh test-all.sh merged (060ccbfa) 374/384. 2 of the 10 failures need a git checkout (test-issue-628-vendor-gitattributes, test-issue-715-og-denmark) and pass 4/4 and 10/10 in a git clone of the merged tree. The other 8 are perf or timing asserts and fail the same way on master: live-heard-filter, live-scope-color (perf), 724, 728, 941, 730, dagi-filter (master passed once), and 598, which loads only hop-resolver.js (master failed 5 on a rerun, merged 4).
node test-frontend-helpers.js merged 738 passed, 0 failed
Go cmd/ingestor go test -count=1 ./... merged ok (1395 s)
Go cmd/server go test -count=1 ./... merged FAIL on 4 perf budgets only: TestAdvertIntervalAnalytics_AggregatePerf (32 ms against 25), TestProfileCard_Cost, and TestCoverage941_PerfBudget and TestCoverage941M2_PerfBudget (terrain 504 under a load average of about 10). The first two fail the same way on master run alone. The Go is byte-identical to master. TestGraphScore629_GoldenBitIdentical PASSES (amd64), and so do the 3 read-only invariant tests.
test-882-m2-scope-customizer.js master / a63c68ab / head / merged 1/29 / 26/29 / 29/29 / 29/29
test-882-m2-scope-customizer-e2e.js merged unmodified: 7/9 (the dark desktop step hits the 8 s line wait, and the colourblind step then reads a page left in dark mode). With only the line wait raised to 40 s: 9/9. Against master with 40 s: 1/9.
test-live-scope-color-e2e.js (M1) master / merged 8 s: 4/8 and 5/8; at 40 s: 8/8 / 8/8
test-880-m3-follow-customizer-e2e.js master / merged 4/8 / 5/8. The same steps fail on master (settle timing, and the phone steps' "Element is not attached to the DOM").
test-issue-880-live-follow-e2e.js master / merged 8/13 / 8/13, with the same 5 steps failing on both
881-m3-moments-customizer, 968-kiosk-customizer, issue-480-no-scope master / merged (run one after another) 8/8, 8/8, 25/25 on both
customize-theme, customize-display, customize-export merged 8/8, 8/8, 6/6
issue-428-live-listener-leak, 883-live-teardown, issue-912-live-1byte-hops merged 6/6, 10/10, 8/8

How the E2E was run:

  • The E2E server followed CI: freshen, the inline seed SQL from deploy.yml, corescope-migrate, then the 2073, 199, 245 and 122 seeds. The current workflow also runs 245 and 122.
  • The binaries were built from each tree.
  • Master ran on a second port with its own fixture.
  • The servers were stopped by port, after checking each process's command line.
  • A first pass ran beside the Go suites at a load average of about 10, and several suites timed out on page loads. Every suite that failed then was rerun alone, master and merged one after another; the table gives those reruns.

Mutants (all on a copy of the merged tree, unit suites 882-m2, 880-m3-follow, live-follow, live-scope-color) [T]

# Mutant Result
O1 _applyScopeCSS compares with the light defaults in dark mode killed by "applyCSS, dark mode: …"
O3 the default value stored instead of cleared in setLiveScopeSetting killed by "setLiveScopeSetting: …"
O5 .toLowerCase() dropped in the default comparison killed by "the default comparison ignores case"
N1 Reset All clears only the light --mc-scope-* hooks killed ("Reset All strips the colourblind scope variables too")
N2 setLiveScopeSetting without validation killed
N3 _applyScopeCSS never removes an inline value killed
N4 cb-presets applyPreset writes the light list into the dark hooks killed
N5 merge: 'follow' dropped from VALID_SECTIONS killed (follow suite, 7 tests)
N6 merge: the Display badge drops follow killed (follow suite)
N7 merge: clearPreset keeps --mc-follow-* killed (follow suite)
N8 import validation skips liveScope killed
N9 achromat dark "no scope" set to slot 12's grey killed (achromat neutrals test)
N10 merge: the Display badge drops liveScope killed
N11 merge: clearPreset keeps the scope hooks killed

All 14 are syntactically valid (node --check), and each anchor matched exactly once.

Not verified

  • An iOS/Safari engine; only Chromium was run. A real native colour picker: the value is filled and change dispatched, as in the PR's E2E.
  • The unmodified desktop E2E steps with their 8 s line wait, on hardware like CI's. Here they fail on master too, and CI ran them green on this head.
  • The Go cmd/server perf budgets on an unloaded machine. Two of them fail on master here too; the 941 terrain budgets I did not rerun on master. The Go code is byte-identical to master.
  • E2E-level mutants. All my mutants were unit-level.
  • Of the author's 28 + 8 mutants I reran O1, O3 and O5 (plus my own 11).
  • Live/customizer E2E suites beyond the 15 listed.
  • Whether achromatopsia users actually tell the 1.13–1.15 luminance steps apart on a real map. I computed luminance only.

@dborup
dborup marked this pull request as ready for review November 28, 2026 15:45
@dborup
dborup merged commit 190726e into master Nov 28, 2026
18 checks passed
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.

1 participant