Skip to content

feat(coverage): use the owner's station values in predicted reach and the terrain profile (#1017 M4) - #1093

Draft
adminopenclaw8-sketch wants to merge 6 commits into
masterfrom
feat/1017-m4-station-values-in-models
Draft

adminopenclaw8-sketch wants to merge 6 commits into
masterfrom
feat/1017-m4-station-values-in-models

Conversation

@adminopenclaw8-sketch

@adminopenclaw8-sketch adminopenclaw8-sketch commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Relates to #1017

What

#1017 M4 — the owner's approved station values (M3) are now used by the models, exactly the M4 row of the revised M0 §10:

  • Predicted reach — station block. GET /api/terrain/coverage for a node centre with approved, in-force, non-stale station details carries station: CoverageStationRadio{txPowerDbm, antennaGainDbi, lossDb, azimuthDeg, beamwidthDeg, beamwidthAssumed} — only stated values. It is added at serve time from the claim snapshot, never cached with the result (a cache hit still reflects a new approval).
  • Starting values, precedence slider > owner > operator. The panel starts from the owner's values, field by field, marked (owner). A slider or a link value still wins.
  • Viewer setting "Use the owner's values for this node" (default on), a checkbox in the panel, remembered per browser (mc-reach-owner, like the opacity). Off returns the operator's values and omni colouring, with no request.
  • Directional pattern A(φ) = −min(12·(φ/θ3dB)², Am), Am = 20 dB; a yagi/panel without a beamwidth uses 60°/90°, shown as assumed (never stored).
    • Raster: a Uint16Array of 0.5° bearing bins (720) per pixel, built once per raster and only for a directional station, plus a (bin, byte) histogram; each recolour builds a 720 × 256 colour table and paints with one lookup per pixel.
    • Reach list: every node carries bearingDeg; the browser adds the pattern to the margin, and the server applies it to the counts too (owner decision 8 as corrected on 2026-11-29), with the owner's values over the operator's in budgetDb.
  • Terrain profile. TerrainProfileResponse.link: TerrainLink{lossDb, model, sensitivityDbm, environmentLossDb, marginABDb, marginBADb} and TerrainEndpoint.radio: EndpointRadio{txPowerDbm, gainDbi, cableLossDb, azimuthDeg, beamwidthDeg, beamwidthAssumed, patternDb, source} (owner else operator). The loss is dhm.Link.PathLoss — the function every node in reach uses — over the profile's own samples, under the reach's model (map.coverage.model, default delta). The panel shows one line: Path loss … · margin A→B …, B→A … (sensitivity …, … environment loss) plus the owner's radio and aim. The share card does not render the new fields (byte-identical, tested).
  • M3 review nits the owner assigned to M4 (2026-12-01):
    • nit 1: onTenths bounds are exact, like the SQL CHECKs (no 1e-9 slack), so 37.0000000005 dBm is a 400 rather than a 202 that the ingestor's INSERT then refuses;
    • nit 3: the claim form keeps the approved M3 values even when the owner starts typing before /station answers.

Plan (milestones inside this PR)

  1. Go: pattern, bearing, owner radio, station block, directional counts, profile link + endpoint radio (shape pin updated on purpose).
  2. Browser: pattern, bins, 720 × 256 table, precedence, the switch, the profile line.
  3. M3 nits 1 and 3.
  4. E2E test-issue-1017-m4-station-e2e.js (desktop + 375×560 touch), registered in scripts/e2e-shards.json; nit 3 step added to test-issue-1017-m2-e2e.js.

Customizer / config (rule 8)

  • Am (20 dB) and the default beamwidths (yagi 60°, panel 90°) are operator constants in station_radio.go and coverage.js PATTERN, pinned to each other by TestStationPattern1017M4_MatchesTheClient. Customizer later.
  • The viewer switch is a panel checkbox stored per browser; a customizer entry can come later.

Perf

  • Recolour, directional vs omni (budget ≤ 1.5×) — reworked in the review round (F1). The 720 × 256 colour table used to class every cell on each recolour, a fixed ~24 ms. Now each row is keyed by its cuts: a binary search over byteClass's own margin expression, so the classes are identical. Each distinct row is filled once and copied, and the last table is kept. The legend's shares come from per-bin running sums (binCounts) instead of a 184 K-cell pass. A cell-for-cell test pins the table and the shares to buildLut/byteClass (9 raster metas × 3 colour sets × 5 budgets × 4 patterns, > 1 M cells).

    Steady-state recolour (a slider move; warmed up, best of 9 or 15, fresh budgets), Apple M-series:

    Raster Node omni directional before directional after table before → after
    1008² 25.6.1 1.55 ms 28.20 ms (×17.7) 1.55 ms (×1.00) 24.6 → 0.48 ms
    1008² 22.23.5 (CI) 8.77 ms 30.83 ms (×3.52) 5.90 ms (×0.67) 22.4 → 0.47 ms
    7.1 M px 25.6.1 9.97 ms 34.81 ms (×3.49) 8.01 ms (×0.81) 24.4 → 0.49 ms
    7.1 M px 22.23.5 (CI) 60.46 ms 64.44 ms (×1.07) 39.61 ms (×0.65) 22.6 → 0.50 ms

    test-issue-1017-m4-station-models.js now asserts ≤ 1.5× at both 1008² and 7.1 M px. Bins + running counts are built once per raster (asserted not rebuilt on a slider move): 15.0 MB and ~1.2 s at 7.1 M px, 2.8 MB and ~0.17 s at 1008². They exist only for a directional station and are dropped with the raster.
    Independent check on the merged head (CS-Macmini, same machine class, 02f57b53 code): Node 25.9.0 ×0.97 at 1008² and ×0.79 at 7.1 M px; Node 22.22.1 ×0.58 and ×0.56; Chromium 145 in a real page ×0.77 at 1008² and ×0.66 at 7.1 M px (before the fix: ×2.85 and ×0.94). A second table test (9941951d) walks successive calls through beamwidth-only, noData-only (255/256/300/0/unset), NaN/Infinity and 230 dB budgets on all 720 rows. It kills four mutants that the sampled test missed: the kept-table key without the beamwidth, the key without noData, the clamped byte at noData 256, and rowCuts without its finite check.

  • Server: station block O(1) per request (existing 30 s snapshot); counts O(nodes) with one bearing each; profile link O(samples) on samples already held, 0 upstream calls (tested on a cache hit, and a linearity check 400 → 3200 samples).

Follow-up (not in this PR)

Invariants

  • cmd/server stays read-only: SELECT-free change, snapshot reads only.
  • No new map[string]interface{}; all new response types are named structs.
  • No hard-coded colours (CSS variables only); XSS gate clean; fork guards untouched.

🤖 Generated with Claude Code

dborup and others added 3 commits December 2, 2026 16:15
… the terrain profile (#1017 M4)

- coverage: a `station` block (owner TX power, gain, cable loss, aim)
  added at serve time from the claim snapshot, never cached; the server
  counts the nodes in reach with the owner's budget and the yagi/panel
  pattern (owner decision 8); every node carries bearingDeg
- profile: Link (the reach's PathLoss over the profile's samples, margins
  A→B and B→A at the operator's sensitivity and environment loss) and
  each endpoint's Radio (owner, else operator); shape pin and the two
  profile goldens updated on purpose (only radio/link added); the share
  card does not render them
- panel: owner values as starting values (slider > owner > operator),
  marked "(owner)", a per-viewer "Use the owner's values" switch, the
  pattern through 0.5° bearing bins built once per raster and a 720×256
  colour table; the profile shows a link line
- Am 20 dB and default beamwidths (yagi 60°, panel 90°) are operator
  constants, pinned client = server; customizer later (rule 8)

Relates to #1017

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…CHECKs are (#1017 M4, M3 nit 1)

onTenths allowed 1e-9 outside each bound, so 37.0000000005 dBm passed
Validate, answered 202 and then failed the ingestor's INSERT. Every bound
is an exact float64; the 0.1 grid keeps its float tolerance.

Relates to #1017

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s before /station answers (#1017 M4, M3 nit 3)

The M3 values have no inputs, so they are now taken from /station
whatever the timing; addKept still applies their rules on submit. The
visible fields are pre-filled only while the owner has not typed.

Relates to #1017

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

Copy link
Copy Markdown
Collaborator Author

Rapport — CS-Macmini PR#1093 #1017 — head e2ae840

Status: Draft, all 15 CI jobs green on the first attempt (3 skipped by design); every requirement has a red-before/green-after test; 35/35 mutants killed; nothing open that blocks review.

Evidence: [T] test or command I ran, [A] read in the code or the plan, [K] CI log or PR state.

What was built (the M4 row of §10)

Three commits: 4f6370fa M4 proper, 06460c5b M3 review nit 1, e2ae8403 M3 review nit 3. The owner's comment of 2026-12-01 assigned the two nits to M4, so they are included, each in its own commit. [A]

Requirements, tests and mutants

# Requirement Test (red on master → green) Mutants (all killed)
1 Pattern: boresight 0, ±θ/2 = −3 dB, Am floor TestStationPattern1017M4_Shape; JS pattern: boresight 0, ±θ/2 = −3 dB, the Am floor, wrapping G1 coefficient 12→10, G2 no floor, G3 no wrap, J1, J2 [T]
2 Am and the default beamwidths are operator constants, client = server TestStationPattern1017M4_MatchesTheClient (reads PATTERN in coverage.js) G16 yagi 60→50 (Go), J13 Am 20→18 (JS) [T]
3 Coverage station block, at serve time and not cached; only approved, in-force, non-stale details, only with detailsEnabled TestCoverage1017M4_StationBlock (cache hit carries a new approval; point centre, old row, details off and stale have no block) G7 no block, G8 stale used, G9 switch ignored [T]
4 Precedence: slider > owner > operator TestOwnerRadio1017M4_Of (server); JS precedence: slider > owner > operator, field by field; panel test (30.5 dBm (owner), slider 14 wins, switch off returns 22) G4 owner gain dropped, J5 switch ignored, J6 moved slider still marked as owner [T]
5 Viewer setting "use owner values" (default on) JS panel tests: default on, off remembered (mc-reach-owner), no block = no switch; E2E: off survives a reload J11 not remembered [T]
6 Directional pattern in the raster: 720 bearing bins, 720 × 256 colour table JS bearing bins …, colour table: each 256-entry row is buildLut at budget + pattern(bin), directional paint is one lookup per pixel …, omni path unchanged; E2E: east is good, west 20 dB down is uncoloured, and both match when the switch is off J3 bins measured from east, J8 rows copied from the wrong row, J9 paint ignores the bin, J10 shares in the wrong class, J14 raster never directional (E2E) [T]
7 Pattern in the reach list: browser and server counts (owner decision 8) JS nodes in reach: a directional station adds its pattern …; TestCoverage1017M4_DirectionalCounts (flat ground, east/west at equal loss → 1 good + 1 none; an omni owner → 2 good; bearingDeg ≈ 90/270) J7, G5 counts ignore the pattern, G6 counts at the operator's budget, G18 no bearing [T]
8 Bin table built once per raster, not on a slider change JS panel: the bearing bins are built once per raster (4 power moves, an env move, a recolour → 1 build; a new raster → 2; omni → 0) J4 rebuilt on every recolour [T]
9 Profile Link.LossDb equals the coverage model on the same samples TestProfile1017M4_LossIsTheReachModel (dhm.Link.PathLoss, both models, on a path where they differ; a gap → no link); the endpoint test checks the served loss against PathLoss on the profile's samples G10 Bullington hard-coded, G17 no link [T]
10 TerrainEndpoint.Radio (owner, else operator) and margins A→B / B→A TestProfile1017M4_MarginsAreTheReachBudget, TestProfile1017M4_EndpointRadioAndLink (aiming away costs both directions 20 dB; a stale claim falls back to the operator); JS link-line tests; E2E profile line G11 receiver gain dropped, G12 bearings swapped, G13 source always operator, G14 bearing axes swapped, G15 radio not attached, J12 margins swapped [T]
11 TerrainEndpoint pin updated on purpose internal/profilecard/testdata/response_shape.txt regenerated with -update (red first: TestResponseShape listed the new fields); TestTerrainProfileResponseMatchesProfileCard green — (the pin itself is the test) [T]
12 Card output byte-identical TestCard1017M4_LinkAndRadioDoNotChangeTheCard (4 fixtures × light/dark PNG bytes + alt text); existing card goldens unchanged G19 alt text reads Link [T]
13 Perf: recolour at 7.1 M px, directional ≤ 1.5× omni JS perf test: omni 49.1 ms, directional 49.3 ms (×1.00) at 2667² px; bins + histogram once per raster 927 ms, 14.2 MB, only for a directional station J4 (rebuild) [T]
14 Perf: profile loss O(samples), 0 upstream calls TestProfile1017M4_LinkNeedsNoUpstreamCall (a cache hit makes 0 calls, same link); TestProfile1017M4_LinkIsLinear (400 → 3200 samples, < 24×); BenchmarkProfileLink1017M4 G17 [T]
15 M3 nit 1: Go bounds exactly the SQL CHECKs TestDetails1017M4_BoundsAreExact (37 + 5e-10 dBm, −9 − 5e-10, cable 20 + 5e-10 / −5e-10, gain ±5e-10 refused; exact ends accepted) N1 the 1e-9 slack restored [T]
16 M3 nit 3: kept M3 values survive typing before /station answers test-issue-1017-m2-e2e.js step 8: /station delayed 1.5 s, gain typed → POST {"details":{"gainDbi":6.5,"txPowerDbm":27.5,"cableLossDb":0}} (master: {"details":{"gainDbi":6.5}}, the review's reproduction) N3 kept read after the dirty check [T]

Red before. On origin/master code: the JS suite is 0/14; the new Go tests in cmd/server and internal/profilecard do not compile (undefined stationPatternDb, TerrainLink, …); TestDetails1017M4_BoundsAreExact fails; the nit 3 E2E step fails with the body above. [T]

Invariants

Check Result
cmd/server read-only The new server code reads the existing claim snapshot only. The one UPDATE in the diff is in a test fixture. readonly_invariant_test.go is green. [T][A]
No new map[string]interface{} outside tests 0 added. New response types: CoverageStationRadio, TerrainLink, EndpointRadio, and CoverageReachNode.BearingDeg. [T]
No hard-coded colours Only CSS variables (--accent, existing reach variables). [T]
XSS gate scripts/check-xss-sinks.sh --diff origin/master is clean (exit 0) on the committed diff. Text goes in via textContent only. [T]
Fork guards .github is unchanged: 9 in deploy.yml, 1 in release-fast-path.yml. [T]
Goldens The two server profile goldens (terrain_profile_730_off.golden, terrain_fill_off_773/*) were regenerated on purpose. A field-wise comparison shows the only change is the added radio/link. Paths with a gap have no link. sameEnd789 now compares the new pointer by value. [T]

Local runs

  • cd cmd/server && go test ./...: ok (137.6 s). No perf budget failed, so none fails on master either. [T]
  • cmd/ingestor, internal/channelregistry, internal/profilecard and internal/dhm: ok. [T]
  • node test-frontend-helpers.js: 746 passed. sh test-all.sh: 409/409 files. [T]
  • node scripts/run-go-server-shard.js --validate and node scripts/run-e2e-shard.js --validate: ok. The new E2E is in scripts/e2e-shards.json, shard 2. [T]
  • E2E against a local Go server with the migrated and freshened e2e-fixture.db:
    • new suite 10/10;
    • affected suites: 941 M1 11/11, 941 M2 17/17, 962 12/12, 1630 7/7, 681 profile tool 48/48, 746 15/15, 790 26/26, 781 8/8, 789 M3 17/17, 1017 M2 13/13 (with step 8). [T]
  • Browser check at desktop 1280×860 and 375×560 touch (screenshots taken):
    • Predicted reach shows the yagi lobe, 30.5 dBm (owner) and 8 dBi (owner), and the aim line.
    • The switch is a ≥ 44 px target on top.
    • The profile shows Path loss … · margin A→B …, B→A ….
    • There is no horizontal scroll. [T]

CI (run 46912560646, attempt 1) [K]

Job Result
JavaScript Unit Tests & Lint pass
Verify Go Test Assignments pass
Go Server Tests 1/3, 2/3, 3/3 pass, pass, pass
Go Ingestor Tests pass
Go Libraries & CLI pass
Script & Container Unit Checks pass
Validate Docker Image pass
Playwright E2E 1/3, 2/3, 3/3 pass, pass, pass
Verify E2E Shards & Coverage pass
Go Build & Test pass
Build & Publish Docker Image pass
Release Artifacts, Deploy Staging, Publish Badges skipped (by design on a PR)

No re-run was needed. The known flaky test #271 did not appear.

Choices made without asking

  • Viewer setting: a checkbox in the panel, stored per browser like the opacity. It is not a customizer entry and not a deep-link parameter, because it is a viewer preference. A customizer entry can come later (rule 8). [A]
  • Profile margins: computed on the server, at the operator's sensitivity and environment loss, the same budget the reach panel uses. A point end, and a node without owner values, use the operator's txPowerDbm/antennaGainDbi/lossDb. Source is owner as soon as the owner stated any radio value; each field still falls back on its own. [A]
  • The profile's model: map.coverage.model (default delta), even while the reach itself is off. [A]
  • Server counts: budgetDb is the operator's budget with the owner's values over it. Without a station block, nothing changes. As before, the counts leave out the environment loss; the browser recounts with it. [A]

Leftovers (not blocking)

  1. Owner values above a slider's range (TX power up to 37 dBm against the slider's 30) are used and shown as text, but the slider handle stops at its end. Widening BOUNDS.power would also change the rpwr link grammar, so I left it. [A]
  2. Building the bins is about 0.9 s once per raster at 7.1 M px (one atan2 per pixel). Today's largest served raster is 1008², about 0.13 s. This could be split across frames if larger rasters come. [T]
  3. The claim form still has no inputs for the M3 fields. They are carried forward only. No §10 row names that UI; it is a candidate for its own milestone. [A]
  4. Am, the default beamwidths and the viewer switch are not in the customizer yet (rule 8). [A]

@dborup

dborup commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Review — CS-Minimax PR#1093 — head e2ae840

Dom: REQUEST CHANGES

An independent, read-only review of #1017 M4 at head e2ae84034d95b0f46a97c611e4c2d9ccafcd92c6. I tested the merged tree (git merge-tree --write-tree origin/master e2ae8403 against origin/master = b7db1738) and the head tree, both from git archive in scratch. The head ref was the same before and after the review.

Evidence: [T] I ran it, [A] I read it in the code or the plan, [K] CI log or PR state.

The models, precedence, hidden/stale handling, profile link and card are right, and the test coverage is good: 8 of my 8 mutants were killed. One blocker: the M4 perf criterion (a directional recolour at most 1.5× omni) is not met on a current V8. The PR's own perf test fails locally and fails test-all.sh. It passes in CI only because Node 22 paints slowly enough to hide a fixed ~25 ms cost.

Findings

# Severity Where Finding
F1 blocking public/coverage.js directionalTable Every recolour costs a fixed ~23–25 ms, so the 1.5× budget fails on a current V8, and the PR's perf test is environment-dependent. Each recolour rebuilds up to 720 rows, each with buildLut plus 256 byteClass calls, and rows are deduplicated only on exact float equality. This cost does not depend on raster size. [T] Node 25.6.1, 7.1 M px: omni 10.0 ms, directional 34.3–35.7 ms (×3.45–3.58), over 6 runs. Breakdown: table 25.0 ms, paint 7.5 ms (omni 5.4), shares 2.4 ms. At 1008², the largest raster served today: omni 2.8 ms, directional 26.6 ms (×9.5). With CI's Node 22.23.5: 7.1 M px ×1.06–1.07, which is why CI is green, but 1008² is ×3.3 (8.8 → 29.1 ms). So a slider move on a directional station takes more than one 16 ms frame on the rasters users actually get. test-issue-1017-m4-station-models.js fails locally, and that makes sh test-all.sh fail. Suggested fix: derive the rows from one table instead of rebuilding them. On the 0.5 dB raster grid, a row is the omni LUT/class array at budget + p, which is an index shift of round(p / lossStepDb) bytes into one extended table. Quantising p to lossStepDb alone brought the table to 6.7 ms in my experiment, still ×3.0 at 1008². Also make the perf test measure at 1008² as well as 7.1 M px, so that a fast V8 cannot pass it by accident and a slow one cannot fail it.
F2 nit public/terrain-profile.js linkText The profile line labels operator values as the owner's. EndpointRadio.Source is owner as soon as the owner stated any radio field, and each field falls back separately. An owner who stated only gain 8 dBi gets "A: owner's radio, 22 dBm, 8 dBi", where 22 dBm is the operator's. [A] Either print only the stated values, or carry a per-field source.
F3 nit (UX) Predicted reach panel, phone At 375×560 nothing in the first view says the owner's values are in use. The panel is 208 px tall. "30.5 dBm (owner)" sits at y≈853 and the switch at y≈1129 in the panel's scroll. On first view the only cue is the lobe on the map. On desktop 1280×860, the "(owner)" values are in the first view. [T] A short "Owner's radio in use" in the header line ("From … · ground … · antenna …") would make it visible on phones.
F4 nit E2E test-issue-1017-m4-station-e2e.js The phone case opens through deep links with the state already set (#/map?reach=<pk>, #/map?profile=<a>,<b> with both ends) and reaches the switch with scrollIntoView. This is the #790 pattern. My own cold-start run, below, found nothing blocking, but a cold-start step (Home → node → Predicted reach / Terrain profile → tap B) would guard it in CI.
F5 nit public/terrain-profile.js:824 linkText was inserted between verdictChip's doc comment and verdictChip, so that comment now sits above linkText.
F6 pre-existing, not M4 reach panel sliders In Chromium touch emulation, a vertical touch-scroll that started on a slider changed the slider's value: rgrx=-2 at 375×560, and the owner's 1.5 dB cable loss → rloss=14 at 360×640. With M4, that silently overrides an owner value and drops "(owner)". Only removing the link parameter brings it back, because the switch does not reset sliders. [T] Not verified on a real device. The #941/#962 sliders on master behave the same way.

The author's own leftover 1 also shows in my desktop screenshot: an owner TX power of 30.5 dBm leaves the TX power slider handle at its 30 dBm end. This is acknowledged in the PR, and I do not count it as a finding.

Answers to the review points

  • Precedence slider > owner > operator. Go CoverageRadio.over [A]; JS withOwner + budgetValues [A]; the unit and panel tests pass [T]. In my phone run, a moved slider replaced the owner value and its "(owner)" mark [T]. ✔
  • Pattern. A(φ) = −min(12·(φ/θ)², 20), wrapped to ±180°; the same in Go (stationPatternDb) and JS (patternDb), pinned client = server [A][T]. 0 at boresight and −3 dB at ±θ/2 are asserted. The yagi 60° / panel 90° defaults are flagged beamwidthAssumed in the response only and never stored [A]. Matches §6. ✔
  • Colour table. 720 bins × 256; row k = buildLut(budget + pattern(bin centre)); paint is one lookup per pixel [A][T]. Correct, but see F1 for its cost.
  • Profile Link.LossDb = the coverage model on the same samples. Both go through dhm.Link.PathLoss under map.coverage.model. The coverage takes frequency and k from the terrain profiler, so the physics are the same. Both use ground + antenna heights and the profile's DTM samples (with the fill) [A]. My mutant R6 (profile hard-coded to Bullington) was killed [T]. One caveat: the profile honours viewer freq/k overrides, so the link follows them. I think that is intended. ✔
  • TerrainEndpoint.Radio, margins A→B / B→A. The receiving end's gain and pattern are included. Bearings are initial great-circle bearings per end [A]. R5 (bearing axes swapped) and J-R9 (margins swapped) were killed [T]. The shape pin was updated on purpose. For the server goldens, I compared every one of the 6 bodies in terrain_profile_730_off.golden field by field: they are identical except for the added radio/link [T]. ✔
  • Viewer setting "use owner values" (default on). On by default, stored as mc-reach-owner, and turning it off makes no request [T] (my flow plus the E2E). J-R8 (the choice not remembered) was killed [T]. ✔
  • Hidden, stale or unapproved claims never feed the model. The snapshot SQL reads only rows with status='approved' AND details_op='set' AND details_in_force=1 and a proof position. ownerRadioAt applies the stale-distance rule and detailsEnabled. A hidden centre or profile end is a 404 before attachOwnerHeights, and reach nodes still go through visible() [A]. R2 (stale ignored) was killed [T]. ✔
  • Perf.
    • Recolour budget: not met, see F1 [T].
    • The bins and histogram are built once per raster (dirFor !== raster), not on a slider move [A][T]. They take about 1.2 s at 7.1 M px and 14.2 MB [T].
    • Profile loss is O(samples). BenchmarkProfileLink1017M4: 400 → 1024 → 3200 samples = 9.9 → 24.1 → 73.5 µs/op (×7.4 for ×8 samples), with 1 alloc [T].
    • 0 upstream calls: the link is built from the elevations already decoded, and the response itself is not cached [A]. TestProfile1017M4_LinkNeedsNoUpstreamCall is green [T].
  • Card byte-identical. TestCard1017M4_LinkAndRadioDoNotChangeTheCard and the existing card goldens are green; the new fields are omitempty and not rendered [T][A]. ✔
  • Does an owner who entered values see them used?
    • Desktop: yes, "30.5 dBm (owner)" and "8 dBi (owner)" in the first view, plus the lobe [T].
    • Phone, 375×560 and 360×640: I started cold on Home and used real taps: More → Nodes → search → row → Predicted reach. The lobe is visible at once. "(owner)", the direction line and the switch (a 44 px target, not covered) are reached by scrolling the panel. The switch toggles both ways, and there is no horizontal scroll or console error [T]. See F3.
    • Profile on the phone: Terrain profile from the node page → tap a map point for B. The first tap landed on a marker cluster (my tap point); the second picked B. The link line with the owner's aim shows after scrolling the sheet, and the compact bar did not block picking B [T].
  • Invariants.
    • No new map[string]interface{} (0 added lines) [T].
    • cmd/server adds no writes outside tests; the only UPDATE/Exec lines are in station_models_1017_m4_test.go [T].
    • No hard-coded colours [T].
    • check-xss-sinks.sh --diff origin/master exits 0 [T].
    • Fork guards: 9 in deploy.yml and 1 in release-fast-path.yml, and .github is untouched [T].
    • No closing keywords in the body or commits [T].
    • All 3 commits are authored by dborup <kontakt@meshview.dk> [T].
  • No behaviour change beyond M4.
    • The coverage reach.budgetDb and counts change only when the centre has an owner station.
    • Each node gains bearingDeg.
    • The nit-3 change only moves kept ahead of the dirty check.
    • Nit 1 only tightens the bounds to match the SQL CHECKs [A].
    • All of these are in scope.

Tests and mutants

Run Result
cd cmd/server && go test -count=1 ./... (merged) ok, 162.5 s [T]. No perf budget failed.
cmd/ingestor, internal/channelregistry, internal/profilecard, internal/dhm all ok [T]
node test-frontend-helpers.js 746 passed, 0 failed [T]
node test-issue-1017-m4-station-models.js 13/14 on Node 25.6.1 (perf ×3.45–3.58); 14/14 on Node 22.23.5 (×1.06) [T]
sh test-all.sh (merged, Node 25) 406/409. The 3 failures: the M4 perf test (F1); test-issue-628-vendor-gitattributes.js, which needs a git checkout and fails because my tree is an archive; test-issue-715-og-denmark.js, which fails on the master tree as well (pre-existing) [T]
run-go-server-shard.js --validate / run-e2e-shard.js --validate ok: 4121 Go entries, 319 E2E suites [T]
E2E against a local Go server with e2e-fixture.db prepared as in CI (freshen, the Kpa-clawbot#1486/Kpa-clawbot#1791 seed SQL, corescope-migrate, seeds 2073, 199, 245 and 122) 1017 M4 10/10, 1017 M2 13/13 (with step 8), 941 11/11, 941 M2 17/17, 962 12/12, 1630 7/7, 681 profile tool 48/48, 746 15/15, 790 46/46, 781 8/8, 789 M3 17/17, antenna-claims 11/11, 898 M2 22/22 [T]
Red before On master: the JS suite is 0/14, the new cmd/server tests do not compile (undefined: stationPatternDb), and TestDetails1017M4_BoundsAreExact fails [T]

My own mutants (8/8 killed) [T]:

# Mutant Killed by
R1 server counts ignore the pattern TestCoverage1017M4_DirectionalCounts
R2 stale claim not refused TestCoverage1017M4_StationBlock, TestProfile1017M4_EndpointRadioAndLink
R3 1e-9 slack restored on the low bound only TestDetails1017M4_BoundsAreExact
R4 budgetDb at the operator's radio TestCoverage1017M4_DirectionalCounts
R5 bearing atan2 axes swapped TestStationBearing1017M4 + 2 more
R6 profile link hard-coded to Bullington TestProfile1017M4_LossIsTheReachModel, …_EndpointRadioAndLink
J-R7 bearing bins mirrored north/south bearing bins …
J-R8 "off" not remembered panel: the viewer's "off" is remembered …
J-R9 profile margins swapped in the line profile: the link line …

(R1 also had a first version that did not build; that attempt is not counted.) I also tried a phi > 181 wrap mutant. It survived, but it is near-equivalent, since it changes only offsets in (180°, 181°], so I don't count it.

CI (run 46912560646, attempt 1) [K]

Job Result
JavaScript Unit Tests & Lint pass
Verify Go Test Assignments pass
Go Server Tests 1/3, 2/3, 3/3 pass, pass, pass
Go Ingestor Tests pass
Go Libraries & CLI pass
Script & Container Unit Checks pass
Validate Docker Image pass
Playwright E2E 1/3, 2/3, 3/3 pass, pass, pass
Verify E2E Shards & Coverage pass
Go Build & Test pass
Build & Publish Docker Image pass
Release Artifacts, Deploy Staging, Publish Badges & Summary skipped (as designed on a PR)

The known flaky tests #256 and #267 did not appear. CI's JS job runs on Node 22, which is why F1 does not show there.

Not verified

  • No real device, iOS Safari or Android Chrome. All phone checks ran in Playwright's Chromium with touch emulation; that includes F6.
  • No end-to-end run with a real approved claim and real terrain on a running server. In the browser, coverage and profile answers were stubbed in the server's shapes, as in the PR's E2E. The server side is covered by the Go tests I ran.
  • I did not rerun the nit-3 E2E step against master. Its red-before rests on the author's report and my reading of the code.
  • I did not measure recolour timings in a real browser. F1 is measured in Node 25 (close to current Chrome's V8) and Node 22.

dborup and others added 3 commits December 2, 2026 21:38
… values only (#1017 M4)

Review round on #1093:

- F1: directionalTable no longer classes 720 × 256 cells per recolour.
  Each row is keyed by its rowCuts (a binary search over byteClass's
  own margin expression, so the classes are identical); each distinct
  row is filled once and copied; the last table is kept. The legend's
  shares come from per-bin running sums (binCounts) instead of a
  184 K-cell pass. Table 24.5 ms -> 0.5 ms; directional/omni at 1008²
  ×17.7 -> ×1.00 (Node 25), ×3.5 -> ×0.68 (Node 22); at 7.1 M px
  ×3.5 -> ×0.81 (Node 25), ×1.07 -> ×0.66 (Node 22). The perf test
  measures the steady-state recolour at 1008² and 7.1 M px; a
  cell-for-cell test pins the table and shares to buildLut/byteClass.
- F2: EndpointRadio carries ownerStated; the profile line names only
  the values the owner stated as the owner's.
- F3: the reach panel's header line says "Owner's radio in use".
- F4: E2E cold start on a phone with real taps (Home -> node ->
  Predicted reach / Terrain profile -> tap B).
- F5: linkText moved below verdictChip and its doc comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#1017 M4 fix round)

Adds what the independent fix round (72aedb26, not pushed) tested and
02f57b5 did not:

- A walk of successive directionalTable calls, all 720 rows and the
  shares checked against buildLut/byteClass, where each step changes one
  thing the kept table depends on: the beamwidth alone, noData alone
  (255, 256, 300, 0, unset), non-finite budgets (NaN, Infinity) and a
  230 dB budget at which the clamped byte must still be 'none'. Four
  mutants of 02f57b5 survived the sampled test and are killed by this
  one: the table key without the beamwidth, the key without noData, the
  clamped-byte guard at noData 256, and rowCuts without its finite check.
- E2E cold start: picking B sends exactly one profile request, with the
  node as A, and the header line with "Owner's radio in use" is on top.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in #1099 (the TestHiddenFilterPacketsNoExtraAllocs flake fix) and
the rest of master since the branch point.

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

Copy link
Copy Markdown
Collaborator Author

Fix round — CS-Macmini PR#1093

Review feedback addressed (commit 9941951d, on top of 02f57b53; head e9f4c274 merges origin/master)

This round came from two sessions by mistake (a double dispatch). 02f57b53 is the base fix. I reviewed it against the review and against my own independent version (not pushed), and 9941951d adds only the tests that version had and 02f57b53 lacked. e9f4c274 merges origin/master, which brings in #1099 for the TestHiddenFilterPacketsNoExtraAllocs flake. There were no conflicts and no force-push.

  1. F1 (blocking, perf), fixed in 02f57b53 and pinned by 9941951d.
    • The fix (02f57b53): each colour-table row is keyed by its cuts. The cuts come from a binary search over byteClass's own margin expression, so the classes are identical to before. Each distinct row is filled once and copied, and the last table is kept. The legend's shares come from per-bin running sums (binCounts). The perf test measures the steady-state recolour at 1008² and at 7.1 M px.

    • The new test (9941951d): a walk of successive directionalTable calls checks all 720 rows and the shares against buildLut/byteClass. The steps change only the beamwidth, only noData (255/256/300/0/unset), use NaN/Infinity budgets, and use a 230 dB budget at which the clamped byte must stay none. It kills 4 mutants of 02f57b53 that the sampled test let through:

      • the kept-table key without the beamwidth;
      • the key without noData;
      • the clamped-byte guard at noData 256;
      • rowCuts without its finite check.

      All 13 of my mutants on the new table code are now killed.

    • Independent timings on the merged code, as directional ÷ omni:

      Runtime 1008² 7.1 M px
      Node 25.9.0 ×0.97 ×0.79
      Node 22.22.1 ×0.58 ×0.56
      Chromium 145, real page ×0.77 (×2.85 before) ×0.66 (×0.94 before)

      The author's own table, on Node 25.6.1 and Node 22.23.5, is in the PR body under Perf.

  2. F2, fixed in 02f57b53. EndpointRadio.ownerStated names the fields the owner stated. The profile line lists only those as the owner's. "Only gain stated" is tested in Go (TestProfile1017M4_OnlyGainStated, including a real claim) and in JS.
  3. F3, fixed in 02f57b53. The reach panel's header line ends with "· Owner's radio in use" while the direction, or any stated value no slider has replaced, is in use. It updates on every slider move and on the switch. The E2E checks that the line is in the first view at 375×560. 9941951d also checks that the line is on top, not covered.
  4. F4, fixed in 02f57b53 and extended in 9941951d. The E2E does a cold start at 375×560 with real taps only: Home → More → Nodes → search → the node → Predicted reach, then back → Terrain profile → tap B on the map. 9941951d adds that picking B sends exactly one profile request, with the node as A.
  5. F5, fixed in 02f57b53. linkText now sits below verdictChip, and verdictChip's doc comment is directly above it again.
  6. F6, not fixed, as agreed. It is a pre-existing problem: a touch-scroll that starts on a slider changes its value. It is in the PR body under "Follow-up (not in this PR)".

Nit, left unchanged: F3 rebuilds the header line on every slider input, and that includes findNodeByKey, a linear scan of the node list. That costs far less than a recolour at about 2K nodes, but a separate note span would avoid it.

Local checks on the merged head e9f4c274:

  • cmd/server go test ./..., go vet and internal/profilecard: all ok.
  • test-all.sh: 410/410 on Node 22 and on Node 25.
  • eslint: 0 errors.
  • Go and E2E shard validation, and check-xss-sinks.sh --diff origin/master: all ok.
  • E2E against a local server with the fixture DB:
    • 1017 M4: 13/13, stable over 3 runs
    • 941: 11/11
    • 941 M2: 17/17
    • 962: 12/12
    • 681 profile tool: 48/48
    • 790: 46/46
    • 1630: 7/7
    • 681 M5: 26/26

CI (run 46975569213): all green on e9f4c274.

  • Go Server 1/3, 2/3 and 3/3, Go Ingestor, Go Libraries & CLI, and Go Build & Test all passed. The Go Server 3/3 job that failed on 02f57b53 (a package timeout in a WS history test) now passes.
  • JavaScript Unit Tests & Lint, Script & Container, Verify Go Test Assignments, Verify E2E Shards & Coverage, Validate Docker Image, and Build & Publish Docker Image all passed.
  • Playwright 1/3 and 2/3 passed. Playwright 3/3 failed once in test-issue-734-dhm-overlay-budget-e2e.js: during one pan, terrain asked for 473 tiles against 472 for contours. That is the known DHM: surface hillshade, contour lines and elevation colouring overlays #734 tile-timing flake, and this PR does not touch the overlay code. A rerun of only that job passed.
  • Release, Deploy Staging and Badges were skipped, as designed on a PR.

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