Commit Graph
16 Commits
Author SHA1 Message Date
efitenandClaude Opus 5.5 52c95526a5 feat: choose the uplink ping scope from the repeaters around the companion (v1.22.0)
A fixed uplinkScope ("be") reaches almost nobody just over the border: of
the Limburg border repeaters in CoreScope's node_declared_regions, many in NL
declare only *, nl or nl-li. uplinkScope is now a preference list
("de,nl,be"). Per ping, src/autoscope.js counts how many of the repeaters
heard directly in the last 5 minutes forward each candidate (the companion's
default scope first, then the list) and takes the most forwarded. With none
forwarded but *, the ping goes out un-scoped (fw v12+); with nothing known,
in the companion's default scope (CMD_GET_DEFAULT_FLOOD_SCOPE, fw v10+).

Declared regions come from CoreScope GET /api/nodes/declared-regions
(uplinkRegionsUrl, default corescopeUrl + that path, every 30 min) merged
with this session's own region answers. The MQTT payload is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 21:28:16 +02:00
efitenandClaude Opus 5.5 70a59c6197 feat: uplink ping, test whether the mesh hears the companion
CoreDrive only measured what the companion hears. With uplinkPing on (off by
default), it sends a short message on a dedicated hashtag channel
(#coredrive) carrying only a random tag, listens 10 s for a repeater
re-broadcasting it, and publishes the result on the new topic
meshcore/client/{pk}/uplink (UPLINK_PING): tag, packet hash of the echo,
every echo with its first and last hop, and the GPS fix. The position never
goes over the mesh.

- src/grptxt.js: hashtag channel key, channel hash, GRP_TXT MAC check and
  AES-128-ECB decrypt, and the packet hash, per the firmware
  (Mesh.cpp:540-557, Utils.cpp:127-145, Packet.cpp:41-50). Checked against a
  real #wardriving packet from CoreScope live: same text and same hash
  (12c82f82df4cc29c). AES-ECB comes from @noble/ciphers 2.0.1, as WebCrypto
  has no ECB.
- src/uplinkping.js: channel message, get/set channel and flood-scope frames
  (companion_radio/MyMesh.cpp), slot choice that never overwrites another
  channel, echo matching on the tag.
- src/uplinksched.js: a ping only with a fix of 100 m or better, after
  uplinkIntervalSec (60) and uplinkMinMoveM (250), under uplinkMaxPerHour (50),
  and not in a ~180 m cell pinged in the last uplinkSkipDays (7).
- uplinkScope (e.g. "be") sends the ping as a region-scoped flood via
  CMD_SET_FLOOD_SCOPE (fw v8+) and resets the override right after.
- app.js holds the radio (acquireRadio) for the whole exchange, as OK/ERR
  replies carry no correlator; it skips while parked, signing or asking.
- DEVICE_INFO now yields the channel slot count; log header gets a ping row.

Tests: 417 pass (+20): crypto against the real packet, frames, slot choice,
echo matching, scheduler, config defaults, payload shape, header row. Not
tested on air: no ping has been sent from a real companion yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 15:52:02 +02:00
efitenandClaude Opus 5.5 5da69305b8 feat: ask a repeater without a CoreScope name for its own name
Field case 2026-10-16: c0cdee59e0db981b answered every discover sweep,
but CoreScope has never seen its advert, so it stayed a bare prefix and
got no regions ask either.

- nodeNames flag (on when config.json exists and omits it, off without
  a config, like regionDiscovery). With it on, discover requests drop
  DISCOVER_PREFIX_ONLY, so replies carry the full 32-byte pubkey
  (+24 bytes each, simple_repeater/MyMesh.cpp:824).
- A repeater heard in range is looked up once per session. Only when
  CoreScope answers without a name is it asked ANON_REQ_TYPE_OWNER
  (MyMesh.cpp:165). The reply is "name\nowner_info"; owner_info is
  dropped.
- Name and regions asks share one queue and one per-encounter budget
  (src/asknext.js): the companion keeps one pending anon request
  (companion_radio/MyMesh.cpp:1570) and the repeater limiter is shared
  across request types. The name is asked first.
- The name replaces the prefix in the recent list and regions card, and
  is published on meshcore/client/{pk}/names as NODE_NAME with the
  companion's fix. New topic; /packets is unchanged.
- Debug header: a names row and nodeNames in the config row.

Not done: CoreScope does not ingest /names yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 09:25:48 +02:00
efitenandClaude Opus 5.5 11ca093dd9 feat(names): resolve an ambiguous path hash to its one forwarder
A 2-byte path hash that CoreScope calls ambiguous stayed a bare prefix,
even when the only other match cannot forward. Field case 2026-10-16:
e470 matched BE-HSS-HVZZWL-DIS (repeater) and Aegis (companion), so the
repeater got no name and no regions ask.

Companions and sensors do not forward by default
(companion_radio/MyMesh.cpp:486), so for keys of 4 bytes or fewer the
candidates are fetched from the new optional searchUrl
(/api/nodes/search) and narrowed to repeater/room. Exactly one left:
that is the node. A full search page (10 rows) decides nothing, because
it may have cut off a second forwarder.

Not covered: a companion with client-repeat turned on is ignored here.
Resolve and pubkey lookups now share one session cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 09:25:34 +02:00
efitenandClaude Opus 5.5 270b63dc0b release: v1.19.0, CoreScope login and companion linking
Minor: the MQTT payload contract is unchanged. SW cache v54. Optional
corescopeUrl. Release notes in docs/releases/v1.19.0.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:12:27 +02:00
efitenandClaude Opus 5 ebbca34fcb feat: a much stronger reception buys one more ask; no signal floor
The 2026-09-12 commute answered the question v1.15's instrumentation was built to ask.

No floor. The ranges came back overlapping — answered snr -5.25 … +12 dB, silent -11 …
-0.75 dB — and two of the three answers came from asks at snr -5.25 / rssi -117 and snr
-1.75 / rssi -113. Any floor worth setting would have blocked them. The earlier reading
that looked like a clean split was drawn from the old scheduler, where silent asks were
timer asks whose signal I took from a reception minutes earlier: the number was standing
in for freshness, not for link quality, and once every ask fired on a live reception the
correlation vanished.

What the same log did show: efef79435050 spent its three asks between 21:06:50 and
21:08:08, all around -115 dBm and all unanswered, and was then heard from 21:09:37 at
-76 to -69 dBm — up to 46 dB stronger, the best receptions of the drive — with nothing
left to spend, because the encounter only ends after five minutes of silence and it kept
coming in loud. So a reception at least 6 dB better in snr than the best one this
encounter already asked on now earns exactly one extra ask, once per encounter.

The per-encounter allowance also goes 3 -> 4, as asked.

Both of those need the firmware's limiter to stop being an approximation: at most 4 asks
to one repeater in any 180s, which is what simple_repeater accepts across every
requester and type. Enforced directly now, ageing on its own clock so an encounter reset
does not clear it, and deliberately not configurable. Note it mostly does not come up on
the road — 180 seconds is about 3 km, by which time the repeater is out of range — and
the field log bears that out: the receptions it would have held off all came from nodes
heard for minutes at a time.

One interaction worth knowing: four asks 30s apart fills the 180s window, so a target
that spends the full allowance cannot take its bonus until the oldest ask ages out,
roughly half a minute. regionMaxAsks: 3 in config.json leaves that slot free instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HSoyBhrLLtSqLgBMEKMiJV
2026-09-12 23:52:02 +02:00
efitenandClaude Opus 5 8bfadeaac8 feat: pace region discovery by what the radio hears, not by a clock
The scheduler had three limits and four drives showed each one costing answers rather
than protecting anything. All three are gone; what replaces them is bounded by the
repeater firmware's own limiter instead of by a clock of our own invention.

The shared one-ask-per-60s airtime budget. One ask, from wherever, blocked every
repeater heard in the following minute. The 2026-09-11 80 km log has a2cf63b9fd89 asked
at 18:24:55 on rssi -120 and silent, then heard at 18:25:26 on -102 — 18 dB stronger —
and skipped, because the budget had gone on the weaker reception 31 seconds earlier and
that same ask had put it into backoff.

The 5/15/30-minute per-target backoff, counted per session. A repeater asked once from a
bad spot was locked out for the rest of the drive. It is replaced by an encounter: three
unanswered asks at least 30s apart, then left alone until it has been out of earshot for
five minutes, after which the next reception is a new encounter with a fresh run. Three
asks 30s apart is 3 in any 180s window, inside simple_repeater's 4 anon requests per
180s shared across all requesters — the cap is what keeps us there, not the spacing.

The single in-flight slot. It capped the feature at three asks a minute, and at one per
session whenever a request went unanswered. Several requests can now be outstanding, so
replies are attributed on the 4-byte tag the companion echoes back and an unmatched
reply is dropped rather than guessed at: "something is pending" would file one
repeater's declared regions under another and store it as fact.

Measured, not assumed. A build without the three limits sent 15 asks and got 6 answers;
v1.14.0 on a comparable run sent 5 and got 1. That build is the one merged here (the
beta/regions-sprint commits below), with the pacing tightened from 15s/6 asks to
30s/3 asks so one repeater sees strictly less than the firmware allows one client.

Also here: every ask now carries the snr and rssi of the reception that triggered it,
into the reply or into the timeout. Four drives point at a split — every ask at snr
+1.75 dB or better was answered, every one at -1.25 dB or worse was not — that until now
had to be assembled by hand from pairs of log lines the ring buffer rolls out mid-drive.
No signal floor is applied; this is the measurement that would justify one.

Deleted rather than left behind: selectNextTarget's successors (heardAskDecision,
commitAsk, undoAsk, isTargetDue, dueDelayMs, retryBackoffFor, recordCandidate,
applyRegionsReply, pendingExpired) and monitor's regionDiscoverDue/REGION_INTERVAL_MS.
regionreq.js is framing only now; regionsched.js owns the scheduling.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HSoyBhrLLtSqLgBMEKMiJV
2026-09-12 12:59:06 +02:00
efitenandClaude Opus 5 efcdc2a780 beta: give the asking an end, and make both throttles tunable on the server
Two gaps in the first cut, both raised from the field side.

"Until it answers" never ends. A repeater held in range that does not reply was asked
again on every reception for the rest of the session, which is a poll, not a
measurement. An encounter now gets betaMaxAsks unanswered asks (6) and then stops. What
reopens it is silence: after betaForgetMin (5) without hearing that node, the next
reception is a NEW encounter and the count starts clean, because the same repeater met
40 km later is a different distance and a different antenna aspect, and the failures of
the last meeting say nothing about this one. An answer still ends it permanently, and no
encounter reopens that.

The encounter is ended by silence rather than by elapsed time, so a node heard steadily
for ten minutes stays one meeting instead of being handed a fresh run halfway through.

Second, the 2s queue interval was the wrong knob to state as the rate, and it was
hardcoded. There are two distinct limits and they now live in config.json, editable on
the server between drives with no rebuild:

  betaAskGapSec     2   between ANY two transmitted asks; stops rounds overlapping
  betaTargetGapSec 15   between two asks to the SAME repeater; this is the rate that
                        matters for a node parked in range, heard many times a minute
  betaMaxAsks       6   unanswered asks per encounter
  betaForgetMin     5   silence that starts a new encounter

A value that is missing or unusable (string, negative, NaN) takes the default rather
than disabling the limit it configures: on a transmitting path a typo must not read as
"no limit".

enqueue now returns WHY it said no ('answered' / 'queued' / 'capped' / 'too-soon')
instead of a bare false, the per-ask log line carries "attempt N of M this encounter",
and the header gained a row counting receptions ignored because the repeater had used
its asks. Without that count a capped node and a node that stopped transmitting look
identical in the log.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HSoyBhrLLtSqLgBMEKMiJV
2026-09-12 10:37:33 +02:00
efitenandClaude Opus 5 d2e2573375 feat: verify advert signatures before an identity reaches CoreScope (closes #11)
An Advert's Ed25519 signature is the only cryptographic proof of identity MeshCore
offers. Everything else is plaintext and attacker-chosen: pubkey, name and self-reported
position are whatever the sender wrote, and hop counts, paths and prefixes carry no MAC.
The capture rule in this repo covers provenance, not authenticity, so a 0-hop advert can
be genuinely heard direct and still name a node that does not exist. Adverts captured
here are published to CoreScope, the registry the name resolvers read from, so one
forgery heard by one driver becomes a named node on someone else's screen.

parsePacket now returns advertSig: the pubkey, the signature and the exact message the
firmware signs, which is pubkey(32) || timestamp(4, LE) || app_data with app_data
truncated to MAX_ADVERT_DATA_SIZE (meshcore-firmware src/Mesh.cpp:271-280 verifies what
:404-437 signed, cap at src/MeshCore.h:12). The timestamp goes in as the raw wire bytes,
not the parsed advertTs, so no re-encoding can disagree with what was received. Getting
the 32-byte cap wrong would make every long advert look forged, so the fixture test
covers it, and the real captured advert already in the fixtures verifies against its own
signature, which is what proves the construction rather than asserting it.

src/advertsig.js does the crypto and nothing else. Verification is async: @noble/ed25519
needs a hash and only the async path has one without extra wiring. The capture handler
was already async. A forged advert can carry a pubkey or signature that is not a valid
curve point, which noble rejects by throwing, so that is caught and read as a failed
verification rather than taking the capture path down.

A failed check drops the identity and keeps the reception. The SNR and RSSI measured at
that position are real whoever wrote the advert; only the name attached to them is
worthless, and discarding the row would lose genuine coverage. This is deliberately
narrower than core-hunter, which refuses the whole reception (efiten/core-hunter#356),
because that repo is about identity and this one is about coverage. As a side effect the
node stops being a region-discovery candidate, so the app never sends an anonymous
request to an address somebody invented.

verifyAdverts is off unless config.json says otherwise, and is listed false in
FEATURE_DEFAULTS as well as NO_CONFIG_DEFAULTS. It is the only flag that makes the app
record less than it heard, and inheriting that silently would look like adverts going
missing. The exported log header reports it next to the other three, because "no advert
in the capture" and "advert rejected" are otherwise the same silence.

Not done: no Settings UI for the flag, config.json only, matching the other three. The
gate is not exercised against a forged advert on real hardware, only against fixtures
and a signed synthetic advert.

New dependency: @noble/ed25519 3.2.0. Bundle 435.17 kB -> 442.78 kB (gzip 136.22 ->
139.71).

Tests: 255 pass (+16). SW cache v39 -> v40.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Manrn3qdrTJFz3C4o9PPFL
2026-09-09 17:55:29 +02:00
Erwin FitenandClaude Opus 5 8d6254f8ce feat(config): regionDiscovery defaults ON in an existing config, OFF with none
Completes the default-on change. The transmitting feature's default now depends on
WHERE the silence comes from, which is the distinction that makes it safe:

- an absent key in a config.json that EXISTS -> on. That file is a deployment whose
  operator owns the repeaters being asked, and this is exactly the case that bit us:
  a config predating the key silently reported the feature off.
- no config loaded at all -> off. The app then knows nothing about whose mesh it is
  on, and repeaters rate-limit anonymous requests to 4 per 180s shared across every
  requester and type, so one client asking once a minute claims most of that budget.
  Collecting on an assumption spends our own bandwidth; transmitting on one spends a
  stranger's airtime.

FEATURE_DEFAULTS / NO_CONFIG_DEFAULTS make that split explicit, and every
regionDiscovery gate in app.js now goes through featureEnabled() so "which default
applies" has exactly one answer, in config.js. Those gates read
`!cfg || !cfg.regionDiscovery`, which happened to be equivalent for a normalized
config but restated the policy in five places.

Tests: 220 pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-07 09:53:19 +02:00
Erwin FitenandClaude Opus 5 89565ff1f9 feat(config): the two logging flags default ON; collect even with no config
Goal: never lose a window of coverage data to a config problem. Data that was
never collected is gone for good; data collected and discarded server-side costs
only bandwidth.

Two separate changes, because they cover two different failures:

- normalizeConfig: an ABSENT fullRfLog/rfSampler key now means on. A config.json
  written before those keys existed reported both off while the served file said
  on - indistinguishable from the features being broken. An explicit `false`
  still wins.
- featureEnabled(cfg, name): resolves a flag when there is NO config at all. Every
  gate read `!cfg || !cfg.X`, i.e. "we do not know yet" == "off", so a failed
  config fetch stopped data collection on top of stopping uploads. The app now
  keeps capturing on defaults and the queue publishes once config arrives.

regionDiscovery deliberately still defaults to false. It is the only feature that
transmits, against third-party repeaters that rate-limit anonymous requests to 4
per 180s shared across every requester and type - one client asking once a minute
already claims most of that budget. Spending someone else's airtime on an
assumption is not a default.

The exported log header now names the defaults in force when no config loaded, so
a reader can tell what is in the queued records without guessing.

Documented in the README together with the two standing warnings that make this a
real trade: fullRfLog multiplies upload volume and is discarded unless the
ingestor has clientRxObservations.enabled, and an rfSampler publish denied by the
broker ACL is still PUBACKed, so it looks healthy while the server stores nothing.
config.example.json updated to match the new defaults.

Tests: 220 pass (+3).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-07 09:49:51 +02:00
efitenandClaude Opus 5 d16e55de97 feat: round-robin region discovery on the discover clock
Ask exactly one repeater per region-discovery round (half the 30s discover
cadence, so once a minute) for its declared flood-allowed region list, and
compare it later against what CoreScope observes it actually forward.

- src/regionreq.js: selectNextTarget(state) -> pubkey|null, pure round-robin
  selection with demotion for non-answerers (never dropped, since silence is
  ambiguous: out of range, rate-limited, old firmware, or busy).
- src/meshpacket.js: parsePacket now also returns advertTs (the node's own
  re-advert clock, so a repeater is re-asked only after a config edit) and
  advertType (ADV_TYPE_*, so only ADV_TYPE_REPEATER nodes are ever asked --
  only simple_repeater firmware implements the reply).
- src/app.js: wiring only. Candidates are 0-hop adverts (full pubkey, direct
  RF range) from repeaters; maybeQueryRegions() rides the discover clock at
  half rate and sends at most one buildRegionsRequest per round, logged at
  the tx (orange) level; onRegionsFrame is a dedicated listener fed the RAW
  notification (never parseFrame(...).data, which strips the code byte and
  would silently break parseRegionsResponse's bytes[0] check).
- Feature gate: FIRMWARE_VER_CODE >= 13 (CMD_SEND_ANON_REQ's non-contact
  allowance), read via the existing requestDeviceInfo() call at connect;
  when regionDiscovery is configured on but the firmware is too old, the
  feature stays off and Settings shows why.
- config.regionDiscovery defaults to false (config.js, config.example.json).
- index.html: regionsInfo status line in Settings/Diagnostics.
- sw.js: cache buster v18 -> v19 (frontend files changed).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 15:11:02 +02:00
efiten 156757a853 feat: RF environment sampler with moving/parked cadence 2026-08-18 11:05:54 +02:00
efitenandClaude Opus 5 9339b66e6f feat: optional full RF logging of unattributable receptions (v1.5.0)
Adds fullRfLog (default off) so a sysop can opt in to queuing receptions
the capture path cannot attribute to a node — DIRECT routes, 1-byte path
hashes, etc — as a diagnostic RF observation stream. The decision lives
in a new pure src/capture.js so it stays testable without a DOM; an
unattributable reception moves no coverage state (counters, SNR meter,
recently-heard, beeper, map hexes untouched). MQTT payload shape and
Publisher.buildPayload are unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 10:17:27 +02:00
Erwin FitenandClaude Opus 4.8 61f0ab911a chore: rename corescope-rx -> coredrive-rx (CoreDrive RX)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 11:10:18 +02:00
efiten b61e92a40b feat(config): add config.example.json; gitignore real config.json; drop .env 2026-06-13 21:40:35 +02:00