Skip to content

feat(nodes): the public Station block shows every approved station value (#1017) - #1096

Merged
dborup merged 3 commits into
masterfrom
feat/1017-public-station-block
Dec 2, 2026
Merged

dborup merged 3 commits into
masterfrom
feat/1017-public-station-block

Conversation

@dborup

@dborup dborup commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Relates to #1017

What

Owners can enter the #1017 M3 station values (TX power, cable loss, direction, beamwidth, battery, solar panel). /station already serves them for an approved claim, but the public Station block on the node page only showed hardware, antenna type, gain, power sources, installation and the public contact. This PR shows the rest:

Station
  Hardware      Heltec v3 · ESP32-S3 · SX1262
  Antenna       Yagi
  Gain          9.0 dBi
  Direction     135° (SE) · 40° beam
  Radio         27.5 dBm at the antenna port · cable loss 1.5 dB · ≈ 35.0 dBm EIRP
  Power         Solar + Battery · 33.3 Wh battery · 20.0 W solar panel
  Installation  Mast
  Owner contact OZ1ABC
  Given by the node owner, confirmed <date>.

Plan (small, one milestone)

  1. Tests first: vm unit tests for the formatting, a Playwright suite, and one Go test that pins the read-side gate. Red on master.
  2. Code: detailValues(d, full) in public/antenna-claims.js gets the Direction and Radio rows and the battery/panel sizes in the Power row. Only the public Station block passes full. The admin row keeps listing the M3 values once, through keptValues.
  3. No API change. I checked the shape first (AGENTS.md rule 4): NodeStationResponse.details is antennaclaim.StationDetails, which already carries every M3 field. It has no contactAdmin, and it is served only for approved, in-force, non-stale claims on a visible node. No Go code changes, no new endpoint and no new map[string]interface{}. cmd/server stays read-only.

Display rules (from the revised M0 plan §9.2 and the owner decisions)

  • Values: one decimal on the 0.1 grid, like the existing gain (9.0 dBi). -0.0 is never shown. Units are dBi, dBm, dB, Wh and W.
  • Direction: <deg>° (<8-point compass>), plus · <beam>° beam when given. A beamwidth without a direction says nothing, so it gets no row. Due north (0°) is a value.
  • EIRP: shown only with a TX power. EIRP = TX − cable loss + gain. A missing gain counts as 0 dBi and the text says so (M0 §9.2). There is no EIRP flag (owner decision 6).
  • Missing or malformed values (null, NaN, strings, out of range) give no row and no empty text.
  • Provenance: the existing "Given by the node owner, confirmed …" note is unchanged.
  • Approval state: the frontend only shows what /station returns. Pending, proven, rejected, revoked, expired and superseded claims are never served (new Go test). Stale claims and hidden or unknown nodes show no block.
  • Owner-only: contactAdmin is never shown, even if an answer leaked it (unit + E2E).
  • Antenna height: stays in the existing "This site's height" line above the block. I did not add it again to the block.
  • Side pane: unchanged. The M0 plan puts the Station block on the node page only (§5.2/§9.2), and the side pane has no owner section today.

Choices I made (no one to ask)

Tests

What Test
Formatting (units, compass, omit missing, rounding, EIRP, owner-only, admin row unchanged) test-issue-1017-station-block.js, 10 cases (vm, real file), added to test-all.sh
Approved claim with every field shows each value; pending/hidden/stale shows nothing; leaked owner-only fields nowhere; missing values no row; 375×560 light/dark from a cold start with real taps; desktop dark test-issue-1017-station-block-e2e.js, 10 cases, shard 2 in scripts/e2e-shards.json
/station serves the full field set only for an approved claim; 6 other statuses serve nothing; never the admin contact TestStationBlock1017_OnlyApprovedServesEveryField

Mutants: 17 unit mutants, 3 E2E mutants and 1 Go mutant. All killed; the list is in the report comment.

Perf

The work is O(1) per node page: a few string joins over one /station answer that is already fetched. It adds no request and no DOM rebuild. The rows are built with createElement + textContent, as before.

Customizer

None. There are no new colours or settings; the block uses the existing --text-muted / text variables.

🤖 Generated with Claude Code

dborup and others added 3 commits December 2, 2026 18:03
…, red on master (#1017)

- test-issue-1017-station-block.js (vm, in test-all.sh): units and
  wording, the compass point from degrees, missing values omitted,
  rounding without "-0.0", the EIRP sum, owner-only fields never shown,
  the admin row unchanged.
- test-issue-1017-station-block-e2e.js (shard 2): an approved claim with
  every field shows each value; pending, hidden, stale show nothing;
  leaked owner-only fields nowhere; 375x560 light/dark from a cold start
  with real taps and desktop dark, no sideways scroll.
- TestStationBlock1017_OnlyApprovedServesEveryField: /station serves the
  full field set only for an approved claim, never the admin contact.

Relates to #1017

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lue (#1017)

The node page's Station block now shows the #1017 M3 values next to the
existing ones: a Direction row ("135° (SE) · 40° beam"), a Radio row
(TX power at the antenna port, cable loss and the EIRP they give, with a
missing gain counted as 0 dBi and said so) and the battery Wh and solar
panel W in the Power row. Missing or malformed values give no row. The
values come from the existing GET /api/nodes/{pk}/station (approved,
in-force, non-stale details only); no new endpoint, no Go change.

detailValues takes a `full` flag so the admin row keeps listing the M3
values once through keptValues.

Relates to #1017

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Relates to #1017

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

dborup commented Dec 2, 2026

Copy link
Copy Markdown
Owner Author

Rapport — CS-MacBook PR#1096 #1017 — head 08b714b

Status: Implemented and verified locally (unit, Go, E2E, mutants). The draft is open. CI has not run: GitHub Actions is in a major outage ("Incident with Webhooks and Actions"), and no run has been created repo-wide since 16:37Z. An empty commit (08b714b1) to re-run CI also got no run.

Evidence labels:

  • [T] a test run locally on this head;
  • [A] checked against the API or code shape;
  • [K] read in the code or the plan, not executed.

Requirements

1. Every approved public station value in the Station block, with units

The block shows Hardware, Antenna, Gain, Direction ("135° (SE) · 40° beam"), Radio ("27.5 dBm at the antenna port · cable loss 1.5 dB · ≈ 35.0 dBm EIRP"), Power with the battery Wh and solar panel W, Installation and Owner contact.

Evidence Test Mutants (killed)
[T] test-issue-1017-station-block.js "every approved public value…" detailValues(d) without full in stationView; Radio before Direction; battery size dropped; solar size dropped
[T] E2E "approved claim with every field…" (red on master: 6/10 fail, see 2) the same full mutant, by the master run

2. Formatting: compass, rounding, EIRP, omit missing

Evidence Test Mutants (killed)
[T] unit test "compassPoint" (0/22/23/…/338/359, −1, 360, 12.5, NaN, string) Math.floor instead of Math.round; upper bound 360; non-integer accepted
[T] unit tests "rounding" and "radio" -0.0 guard removed; cable-loss sign flipped; gain dropped from the EIRP; "0 dBi antenna assumed" note dropped; EIRP shown without TX power
[T] unit tests "direction", "power" and "missing or broken values"; E2E "missing values" beam not type-checked; battery not type-checked

3. Approval state: pending, unapproved, hidden and stale never public

Evidence Test Mutants (killed)
[T] Go TestStationBlock1017_OnlyApprovedServesEveryField: an approved claim serves all 12 fields; pending, proven, rejected, revoked, expired and superseded serve nothing WHERE status = 'approved' AND removed from the /station snapshot query (cmd/server/antenna_claims.go:397)
[T] E2E "no Station block": details:null (pending), 404 (hidden or unknown), stale, and a stale answer that still carries details the stale guard removed in stationView (unit + E2E)

Note: the Go test and the 4 "no block" E2E cases are green on master too. That behaviour already existed, so the red evidence for this point is the mutants.

4. Owner-only fields stay owner-only

Evidence Test Mutants (killed)
[T] unit test "owner-only fields never show"; E2E "owner-only fields that leaked…" (contactAdmin and claim-state fields not in the page HTML, not pre-filled; markup stays text, no window.__xss); Go: the admin contact is never in /station contactAdmin shown as the contact (unit + E2E)

5. The admin row is unchanged (no duplicated M3 values)

Evidence Test Mutants (killed)
[T] unit test "the admin row is unchanged" detailValues(c.details, true) in adminParts

6. Layout: 375×560 with real taps and desktop, light and dark

Evidence Test Mutants (killed)
[T] E2E: phone 375×560 light and dark from a cold start on Home (More → Nodes → row, tapWhenSettled); desktop 1280×800 dark. Every dt/dd lies inside the viewport, with no sideways scroll. I checked the screenshots by eye in both themes. .ac-station-list grid max-content max-content (in antenna-claims.css): both phone cases fail

7. No API or Go change, no new endpoint, read-only server, no map[string]interface{}

  • [A] NodeStationResponse.details = antennaclaim.StationDetails, which already carries every M3 field and no contactAdmin.
  • The diff touches only public/antenna-claims.js and tests: 0 production Go lines, 0 new map[string]interface{}.

8. Theming and XSS

  • [T] scripts/check-xss-sinks.sh --diff origin/master is clean (exit 0, after scanning).
  • [K] No new CSS and no colours. Every value goes in through textContent (el()).

9. Fork guards

[A] The guards are unchanged: 9 in deploy.yml and 1 in release-fast-path.yml. The diff does not touch .github/.

Mutants: 21, all killed: 17 unit, 3 E2E and 1 Go. The 3 E2E mutants are the stale guard, contactAdmin and the grid layout. The full mutant counted in the 17 is also killed by the E2E run against master.

Local runs on this head [T]

Suite Result
test-issue-1017-station-block.js 10/10
test-issue-1017-station-block-e2e.js 10/10 (about 8 s) against a local Go server with e2e-fixture.db, prepared as in CI: freshen, migrate and the 4 seeds
test-issue-1017-m2-e2e.js 12/12
test-issue-898-m2-e2e.js 22/22
test-antenna-claims-e2e.js 11/11
sh test-all.sh 409/409 files
node test-frontend-helpers.js 746 passed
cd cmd/server && go test ./... ok
node scripts/run-e2e-shard.js --validate 319 suites across three non-empty shards; the new suite is in shard 2, the lightest

CI per job

Not run. GitHub Actions is in a major outage, so no run was created for the PR event or for the re-run commit. The jobs need checking once Actions recovers; the known flaky test is #271.

Choices and remaining items

  • I kept the existing row labels: Antenna and Gain stay separate, and Direction and Radio are new rows. The plan's sketch (§9.2) merges some of these into one Antenna line. Keeping the rows changes no existing output.
  • I used an 8-point compass.
  • The antenna height stays in the existing "This site's height" line.
  • The side pane is unchanged, because the plan puts the block on the node page only.
  • PR feat(coverage): use the owner's station values in predicted reach and the terrain profile (#1017 M4) #1093 (M4) touches only the form pre-fill in antenna-claims.js, not stationView/detailValues, so I expect no conflict [K].
  • History: one red test commit, one feature commit, and one empty commit to re-run CI.

🤖 Generated with Claude Code

@dborup

dborup commented Dec 2, 2026

Copy link
Copy Markdown
Owner Author

Review — CS-Minimax PR#1096 — head 08b714b

Dom: APPROVE with nits

This is an independent, read-only review. I tested the merged tree git merge-tree --write-tree origin/master 08b714b1 (4224e0a3), with origin/master = b7db1738, which is also the merge base. The merged tree is byte-identical to the head. The head was unchanged before and after the review (git ls-remote).

Evidence labels:

  • [T] tested by me on this head or the merged tree;
  • [A] checked against the real API or the code shape;
  • [K] read in the code or the plan, not executed.

Findings

# Severity Where Finding
1 nit public/antenna-claims.js radioText / Power row Plan §9.2 says "the values wrap at '·'". At 375 px and 360 px the lines break inside a value instead: ≈ 35.0 dBm / EIRP, 33.3 Wh / battery, ≈ 0.0 / dBm EIRP (0 dBi antenna assumed). It is readable and nothing overflows. A small fix that keeps textContent: join each part's inner spaces with U+00A0, so breaks only fall at ·. [T] (screenshots at 375×560 and 360×640)
2 nit test-issue-1017-station-block-e2e.js, desktop case The test reads the dt colour and --text-muted, but only asserts that the variable exists. The comment "Colours come from the theme: dt muted" claims more than the assertion checks. Either compare the two values, or drop the comment. [K]
3 nit (follow-up) keptValues vs radioText / directionText / Power The same six M3 values are now formatted twice, with different wording: the admin row says "TX 27.5 dBm…" and "battery 33.3 Wh", the public block says "27.5 dBm…" and "33.3 Wh battery". keptValues still uses a bare toFixed(1) rather than the new fmtOne, so it has no -0.0 guard. Open #1095 builds its change log from detailValues(d) + keptValues(d), so the duplication spreads. Not blocking, because the PR deliberately keeps the admin row unchanged. [K]
4 info tests Of the unit tests, 6 of 10 are red on master and 4 are regression guards that are green on master (missing values, stale, owner-only, admin row). Of the E2E tests, 6 of 10 are red on master and the 4 "no block" cases are green. TestStationBlock1017_OnlyApprovedServesEveryField is green on master: it pins existing read-side behaviour, and a mutant kills it (see below). Every new display criterion has a red-before/green-after test. [T]

Answers to the review points

  • Every approved public field, with units and wording:

    • Hardware, Antenna, Gain (9.0 dBi), Direction (135° (SE) · 40° beam; due north 0° (N)), Radio (27.5 dBm at the antenna port · cable loss 1.5 dB · ≈ 35.0 dBm EIRP), Power (Solar + Battery · 33.3 Wh battery · 20.0 W solar panel), Installation and Owner contact. [T]
    • The EIRP appears only with a TX power. A missing gain is counted as 0 dBi and the text says "(0 dBi antenna assumed)", as in M0 §9.2. [T]
    • The compass is 8-point (Math.round(deg/45) % 8), and the boundaries at 22/23, 337/338 and 359 are tested. [T]
    • The fields match what owners can enter in open feat(account): station data through owner links, with a change log (#1018 M2d) #1095: TX power −9…37 dBm, cable loss 0…20 dB, direction 0…359°, beam 10…180°, battery Wh, panel W. [K]
  • Missing values are omitted: null, NaN, ±Infinity, strings and out-of-range values give no row and no empty text, and an answer with nothing to show gives no block. [T]

  • Pending, unapproved, hidden and stale are never shown: I checked this on a real stack: a local server with claims and details enabled, and claim rows seeded into a copy of the migrated CI fixture. [T][A]

    Claim /station Node page
    approved every field the block
    pending {"details":null} no block
    rejected {"details":null} no block
    approved, proof location moved {"details":null,"stale":true} no block
    unknown node 404 —
  • Owner-only fields and contactAdmin: the seeded admin contacts were in none of these:

    • /station, /api/nodes/{pk}, /api/nodes?limit=2000;
    • the HTML of any node page, at either phone size, in either theme.

    NodeStationResponse.details is antennaclaim.StationDetails, which has no admin field. [T][A]

  • XSS: I wrote markup straight into the DB (contact_public = '<b>OZ1ABC</b>', hardware_model = '<i>MyBoard</i>'), bypassing Go validation. It renders as literal text and creates no <b>/<i> element. Every new value goes through el() → textContent. scripts/check-xss-sinks.sh --diff origin/master exits 0. [T]

  • API shape (rule 4): I used curl on the real server rather than relying on mocks. The JSON keys the block reads (txPowerDbm, cableLossDb, azimuthDeg, beamwidthDeg, batteryWh, solarW, hardware, hardwareModel, approvedAt, stale) are exactly what the server sends. A stored -0.0 TX power arrives as 0 and shows as 0.0 dBm. [A][T]

  • 375×560 and 360×640 with touch, from a cold start, light and dark: my own walkthrough on the real stack, 16 runs:

    • Each run starts at / and uses real taps: More → Nodes → type in the search box → tap the row. The block was checked for an approved node with every field, an approved node with some fields and hardware other, a pending node and a stale node.
    • Every step was possible, and nothing had to be closed.
    • The block lies above the bottom nav once scrolled into view (block bottom 437 vs nav top 502 at 560 px high).
    • There is no sideways scroll and there are no page errors.
    • On desktop (1280×800), light and dark: one line per row, dt in the muted colour, no sideways scroll. In both themes the contrast looked right by eye.

    [T]

  • No behaviour change beyond the purpose:

    [T] for the merge and the admin row, [K] for feat(coverage): use the owner's station values in predicted reach and the terrain profile (#1017 M4) #1093/feat(account): station data through owner links, with a change log (#1018 M2d) #1095's runtime.

  • Formal rules:

    [T]

Tests (merged tree 4224e0a3, local) [T]

Suite Result
node test-issue-1017-station-block.js 10/10. On master: 4/10, the 6 new-behaviour cases are red
node test-frontend-helpers.js 746 passed, 0 failed
test-antenna-claims.js, test-hardware.js 55 passed, 17/17
cd cmd/server && go test ./... ok (161.8 s)
TestStationBlock1017_* on master ok, because it pins existing behaviour
sh test-all.sh 407/409. Both failures are environmental, because my git archive export has no .git: test-issue-628-vendor-gitattributes.js and test-issue-715-og-denmark.js fail with "fatal: not a git repository". They fail identically on a git archive of master.
node scripts/run-e2e-shard.js --validate 319 suites across three non-empty shards
test-issue-1017-station-block-e2e.js 10/10. Against the master frontend: 4 passed, 6 failed (red before)
test-issue-1017-m2-e2e.js 12/12
test-issue-898-m2-e2e.js 22/22
test-antenna-claims-e2e.js 11/11
Real-stack walkthrough (my own script) 16/16

The E2E suites ran against a local Go server with e2e-fixture.db, prepared as in CI: freshen, the seed SQL from deploy.yml, corescope-migrate, then the seeds 2073, 199, 245 and 122. Go here is 1.26 locally; CI uses 1.27.1.

Mutants (my own) [T]

# Mutant Result
M1 COMPASS[Math.round(deg/45) % 8] → no % 8 (338–359° lose the row) killed (unit 9/10)
M2 gain subtracted in the EIRP killed (unit 7/10)
M3 if (full) around Direction/Radio → if (true) (the admin row duplicates the values) killed (unit 9/10)
M4 beam check isNum → != null killed (unit 9/10)
M5 EIRP shown with a cable loss but no TX power killed (unit 9/10)
M6 stale guard removed in stationView killed (unit 9/10)
M7 Math.round(x) → Math.floor(x + 0.49) survived, but it is equivalent: the two differ only for a fraction in [0.5, 0.51), and that never happens for whole degrees
E1 cable-loss part dropped from radioText, served to the browser killed (E2E 7/10: the full, 375 light and 375 dark cases)
G1 /station snapshot WHERE status = 'approved' → IN ('approved','proven') killed (TestStationBlock1017_OnlyApprovedServesEveryField/proven)

That is 8 non-equivalent mutants, all killed. The files were restored and byte-compared afterwards.

CI per job

Not run. gh pr checks 1096 reports no checks for 08b714b1, and gh run list --commit 08b714b1 is empty. The author's re-run commit came during the Actions outage. Actions is creating runs again for other PRs, so this head needs a new trigger, for example a push or a close and reopen. Merge only after every job is green, allowing for the known flakes #256 and #267.

What I did not verify

🤖 Generated with Claude Code

@dborup dborup closed this Dec 2, 2026
@dborup dborup reopened this Dec 2, 2026
@dborup
dborup marked this pull request as ready for review December 2, 2026 21:26
@dborup
dborup merged commit 635e674 into master Dec 2, 2026
33 of 36 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