Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions cmd/server/station_block_1017_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package main

import (
"strings"
"testing"

"github.com/meshcore-analyzer/channelregistry/antennaclaim"
)

// #1017 (public Station block): the node page shows whatever /station
// serves, so the read side is the privacy gate. A claim carrying every
// public station field reaches /station only once approved; in any other
// status it serves nothing at all, and the owner-only administrator
// contact is never in the answer.
func TestStationBlock1017_OnlyApprovedServesEveryField(t *testing.T) {
full := func(id, pk, status string) claimRow898 {
c := withStationFields1017(stationRow(id, pk))
c.status = status
c.hardware = "heltec-v3"
return c
}
fields := []string{`"hardware":"heltec-v3"`, `"antennaType":"yagi"`, `"gainDbi":5.8`, `"azimuthDeg":135`,
`"beamwidthDeg":40`, `"txPowerDbm":27.5`, `"cableLossDb":1.5`, `"power":["solar","battery"]`,
`"batteryWh":33.3`, `"solarW":20`, `"installation":"mast"`, `"contactPublic":"` + publicContact898 + `"`}

t.Run(antennaclaim.StatusApproved, func(t *testing.T) {
env := newClaim789Env(t, claimAdminKey, detailsOn(nil), nil)
pk := pk789("a")
env.addNode(t, pk, "Roof", "repeater", est789Lat, est789Lon)
env.insert898(t, full("a000000000000001", pk, antennaclaim.StatusApproved))
body := env.do("GET", "/api/nodes/"+pk+"/station", "", "").Body.String()
for _, f := range fields {
if !strings.Contains(body, f) {
t.Errorf("approved /station %s lacks %s", body, f)
}
}
if strings.Contains(body, adminContact898) {
t.Errorf("approved /station %s carries the administrator contact", body)
}
})
for _, status := range []string{antennaclaim.StatusPending, antennaclaim.StatusProven, antennaclaim.StatusRejected,
antennaclaim.StatusRevoked, antennaclaim.StatusExpired, antennaclaim.StatusSuperseded} {
t.Run(status, func(t *testing.T) {
env := newClaim789Env(t, claimAdminKey, detailsOn(nil), nil)
pk := pk789("a")
env.addNode(t, pk, "Roof", "repeater", est789Lat, est789Lon)
env.insert898(t, full("a000000000000001", pk, status))
if got := env.station(t, pk); got.Details != nil || got.ApprovedAt != nil {
t.Fatalf("a %s claim was served: %+v", status, got.Details)
}
body := env.do("GET", "/api/nodes/"+pk+"/station", "", "").Body.String()
for _, s := range []string{"heltec", "yagi", "txPowerDbm", "azimuthDeg", "batteryWh", publicContact898, adminContact898} {
if strings.Contains(body, s) {
t.Errorf("a %s claim's /station %s carries %s", status, body, s)
}
}
})
}
}
64 changes: 60 additions & 4 deletions public/antenna-claims.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,23 +234,78 @@
}

// detailValues lists a StationDetails' public values in display order:
// [label, text] pairs, unknown enum values left out.
function detailValues(d) {
// [label, text] pairs, unknown enum values left out. full (the public
// Station block, #1017) adds the M3 radio, direction and power values;
// the admin row lists those through keptValues instead.
function detailValues(d, full) {
var out = [];
if (!d) return out;
var t = labelOf(ANTENNA_TYPES, d.antennaType);
if (t) out.push(['Antenna', t]);
var g = fmtGain(d.gainDbi);
if (g) out.push(['Gain', g]);
if (full) {
var dir = directionText(d);
if (dir) out.push(['Direction', dir]);
var radio = radioText(d);
if (radio) out.push(['Radio', radio]);
}
var power = [];
if (Array.isArray(d.power)) {
var p = d.power.map(function (v) { return labelOf(POWER, v); }).filter(Boolean);
if (p.length) out.push(['Power', p.join(' + ')]);
if (p.length) power.push(p.join(' + '));
}
if (full) {
if (isNum(d.batteryWh)) power.push(fmtOne(d.batteryWh) + ' Wh battery');
if (isNum(d.solarW)) power.push(fmtOne(d.solarW) + ' W solar panel');
}
if (power.length) out.push(['Power', power.join(SEP)]);
var inst = labelOf(INSTALLATIONS, d.installation);
if (inst) out.push(['Installation', inst]);
return out;
}

var SEP = ' · ';
var COMPASS = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'];

// fmtOne is a value on the 0.1 grid as text, without "-0.0".
function fmtOne(v) {
var s = v.toFixed(1);
return s === '-0.0' ? '0.0' : s;
}

// compassPoint is the eight-point compass name of a whole number of
// degrees 0-359 from true north, or '' for anything else.
function compassPoint(deg) {
if (typeof deg !== 'number' || deg % 1 !== 0 || deg < 0 || deg > 359) return '';
return COMPASS[Math.round(deg / 45) % 8];
}

// directionText is "135° (SE) · 40° beam", or '' without a direction:
// a beamwidth alone says nothing (it needs azimuthDeg, #1017 M3).
function directionText(d) {
var c = compassPoint(d.azimuthDeg);
if (!c) return '';
var s = d.azimuthDeg + '° (' + c + ')';
if (isNum(d.beamwidthDeg)) s += SEP + d.beamwidthDeg + '° beam';
return s;
}

// radioText is the TX power at the antenna port, the cable loss and,
// with a TX power, the EIRP it gives (TX − cable loss + gain; a missing
// gain is counted as 0 dBi and said so, #1017 M0 §9.2), or ''.
function radioText(d) {
var parts = [];
var tx = isNum(d.txPowerDbm), loss = isNum(d.cableLossDb), gain = isNum(d.gainDbi);
if (tx) parts.push(fmtOne(d.txPowerDbm) + ' dBm at the antenna port');
if (loss) parts.push('cable loss ' + fmtOne(d.cableLossDb) + ' dB');
if (tx) {
var eirp = d.txPowerDbm - (loss ? d.cableLossDb : 0) + (gain ? d.gainDbi : 0);
parts.push('≈ ' + fmtOne(eirp) + ' dBm EIRP' + (gain ? '' : ' (0 dBi antenna assumed)'));
}
return parts.join(SEP);
}

// stationHardwareKey is the hardware key a /station answer shows, or '':
// the catalogue is asked for only then (#1017, +0 requests without).
function stationHardwareKey(r) {
Expand All @@ -267,7 +322,7 @@
// The server answers details:null when stale; the guard holds even if a
// stale answer ever carries them (review PR#908 F4).
if (!d || typeof d !== 'object' || r.stale) return null;
var rows = detailValues(d);
var rows = detailValues(d, true);
var hwText = hardwareText(entries, stationHardwareKey(r), d.hardwareModel);
if (hwText) rows.unshift(['Hardware', hwText]);
var contact = typeof d.contactPublic === 'string' && d.contactPublic ? d.contactPublic : '';
Expand Down Expand Up @@ -1755,6 +1810,7 @@
partsOf: partsOf,
describeClaim: describeClaim,
stationView: stationView,
compassPoint: compassPoint,
stationPrefill: stationPrefill,
keptStationFields: keptStationFields,
stationHardwareKey: stationHardwareKey,
Expand Down
1 change: 1 addition & 0 deletions scripts/e2e-shards.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@
{"file":"test-1018-m1b-signin-e2e.js","shard":3,"env":{"BASE_URL":"$BASE_URL"},"output":"e2e","meanSeconds":0,"measurementNote":"New suite; #1018 M1b sign in with Bluetooth/USB: a fake companion replaces navigator.serial and navigator.bluetooth before the app loads and answers the companion protocol byte for byte ('<'/'>' frames over the port, one frame per Nordic UART write and notification), signing in Node with a TEST ed25519 key; the account API is answered by Playwright routes (the CI server runs with accounts off) and the signed-login route verifies the signature over the challenge it issued. At 375x560 in light and dark with real taps over USB: Bluetooth and USB above the code flow, the challenge for the SELF_INFO key, only commands 1/33/34/35 reach the companion, queued then proven, the redeem with the secret, Signed in without the rename note, nothing secret in the URL, the port closed at 115200; at 1280x800 the same over Bluetooth with the NUS filter and a disconnect; another key's signature shows the 401 and re-enables the buttons; without Web Serial and Web Bluetooth the fallback text and the working code flow. 5 cases, about 25s locally; no CI duration measured yet. Assigned to shard 3, the lightest by the sum of meanSeconds."},
{"file":"test-antenna-claims-e2e.js","shard":2,"env":{"BASE_URL":"$BASE_URL"},"output":"e2e","meanSeconds":0,"measurementNote":"New suite; #789 M2b owner antenna-height claim flow on the node page and the admin queue (Tools > Antenna Height Claims) with the antenna-claim API answered by Playwright routes (the CI server runs with the feature off) and the page timers on Playwright's clock, moved in 1 s steps that each wait for every status check to settle: feature off shows no section, a repeater gets the section (deep link scrolls to it) and a companion never, a height off the 0.1 m grid is refused before any request, the code, the 23-byte name check (and a longer name with the code inside it) and the set name command, status queued to pending to proven to approved then no more polling with no two checks closer than 2 s across a theme refresh, the deep link restores the claim after a reload, the clear path and a 429, bounded polling with a status-aware give-up text and Check again, leaving the node page stops the view and coming back starts a live one, the admin key kept in memory only, markup in a node name kept as text, the 409 newer-approved refusal, reject, revoke with a confirm, the filter deep link, the owner flow plus an admin decision with real taps at 375x560 from a cold start (44 px buttons and links), and with 11 queued claims at 375x560 and 1280x800 a decision's result on screen. 10 cases, about 19s locally; no CI duration measured yet. Assigned to shard 2, the lightest by meanSeconds."},
{"file":"test-issue-911-gesture-hints-non-blocking-e2e.js","shard":2,"env":{"BASE_URL":"$BASE_URL"},"output":"e2e","meanSeconds":0,"measurementNote":"New suite; #911 a first-visit gesture hint never swallows a tap meant for a page control: cold start (nothing pre-seeded) at 375x560 and 360x640 with real taps, a probe that compares what each point hits with and without the hints (a 6 px grid over every pill outside Got it, and the middle of every visible control); the first tap on I know what I'm doing, on the Nodes search field through the edge-swipe pill and on a node row through the row-swipe pill (Home > More > Nodes) reaches the control and dismisses only the hint it went through; taps outside every pill and a touch scroll that starts on a pill dismiss nothing; the tab-swipe hint gives way to the row-swipe one on Nodes and one hint per slot on Packets, no two pills overlapping; only the edge-swipe hint on the node page, Back to nodes, the claim height field, Get code and Start over; Got it hit by the first tap during the fade-in; with a control put under each Got it the hint moves off it and Got it still takes a tap; and a self-check that a blocking pill and a covered control turn the probe red. 18 cases, about 40s locally; no CI duration measured yet."},
{"file":"test-issue-1017-station-block-e2e.js","shard":2,"env":{"BASE_URL":"$BASE_URL"},"output":"e2e","meanSeconds":8,"measurementNote":"New suite; #1017 the public Station block on the node page shows every approved public station value (hardware, antenna, gain, direction with compass point and beam, TX power at the antenna port, cable loss and EIRP, power sources with battery Wh and solar panel W, installation, public contact) with the owner note, with GET /api/antenna-claims/config and /station answered by Playwright routes (the CI server has claims off): nothing for a pending answer (details:null), a hidden node (404) or a stale answer, owner-only contactAdmin and claim-state fields never in the page, missing values give no row, phone 375x560 light and dark from a cold start on Home with real taps and desktop 1280x800 dark with every row inside the screen and no sideways scroll. 10 cases, about 8s locally; no CI duration measured yet. Assigned to shard 2, the lightest by the sum of meanSeconds."},
{"file":"test-issue-1017-m2-e2e.js","shard":3,"env":{"BASE_URL":"$BASE_URL"},"output":"e2e","meanSeconds":17,"measurementNote":"New suite; #1017 M2 the station hardware picker in the owner claim form, the Hardware row of the node page Station block and the hardware label in the admin queue, with the real GET /api/hardware and the claim routes, /station and the observer record answered by Playwright routes: +0 catalogue and observer requests without hardware, the Station row from one catalogue request (other + model as text, an unknown key no row), at most 61 options in four optgroups, the search only after the 100 ms debounce, Use only for an empty field, the other model field shown and hidden, the body is exactly the visible fields, and phone 375x560 from a cold start on Home with real taps plus desktop 1280x800 (44 px controls, no sideways scroll). 11 cases, about 17s locally; no CI duration measured yet. Assigned to shard 3, the lightest by the sum of meanSeconds."},
{"file":"test-issue-898-m2-e2e.js","shard":3,"env":{"BASE_URL":"$BASE_URL"},"output":"e2e","meanSeconds":0,"measurementNote":"New suite; #898 M2 owner station details on the node page and in the admin queue, with the claim API and GET /api/nodes/{pk}/station answered by Playwright routes where the CI server has the feature off (the real config and /station answers are checked too): with details off no Station block, no details fieldset and no /station request; the public Station block with the public contact as text, asked once per node-page view across a theme re-render and Start over, nothing for stale, none or empty details; a /station answer that leaked contactAdmin shows it nowhere, does not pre-fill the admin field and is not sent, next to a public contact and with the public contact empty (no fallback); Keep + Keep cannot be sent; a combined claim posts the exact body and keeps no contact or detail in the URL, sessionStorage or localStorage; Remove details posts clearDetails; bad contacts and gain refused before any request; admin per-part lines, the replaced marker, contactAdmin for proven and approved only, markup in both contacts as text, the per-part 409; axe in light and dark; 375x560 (light, dark) and 360x640 from a cold start with real taps and 44 px targets, plus an admin decision at 375x560; consecutive taps at one point are spaced past Chromium's double-tap window by tests/e2e-tap.js. 22 cases, about 60s locally; no CI duration measured yet. Assigned to shard 3, the lightest by meanSeconds."},
{"file":"test-issue-880-live-follow-e2e.js","shard":2,"env":{"CHROMIUM_REQUIRE":"1","BASE_URL":"$BASE_URL"},"output":"e2e","meanSeconds":76,"measurementNote":"New suite; #880 M1 Live \"Follow a packet\" with a stubbed /api/packets/<hash> (an ADVERT over three fixture relays heard by six observers: one late, one naive clock, one skewed), stubbed /api/observers and /api/observers/clock-skew: desktop 1440x900 cold start, line popup Follow with one packet fetch, hop progress, live packets buffered but not animated, summary values and caption, close tears down card, layers, URL, Esc listener and frames; deep link and invalid deep link; reduced motion draws the end state with no follow frames; leaving Live mid-replay leaks nothing; feed card Follow at 700px waits out the settle window for a fresh packet and fetches at once for an older one; Follow next as a feed-header icon that moves no panel control, arm, cancel and pick, skipping packets the favourites, node or region filter hides, disarmed on leaving Live; VCR replay (Rewind) does not arm Follow next and does not animate under a follow; phone 360x640 with the panel pinned open folds it when a follow starts and keeps every marker above the full sheet; phone 375x560 with touch from a cold start by real taps (gear, Follow next folds the panel, 44px View packet and popup Follow, close) with the sheet above the bottom nav and no sideways scroll. About 76s locally (review round 1); no CI duration measured yet. Assigned to shard 2."},
Expand Down
1 change: 1 addition & 0 deletions test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ run test-channel-proposals.js
run test-admin-key.js
run test-hardware.js
run test-antenna-claims.js
run test-issue-1017-station-block.js
run test-1018-account.js
run test-1018-companion-link.js
run test-1018-m2a-links.js
Expand Down
Loading
Loading