fix: pass computed fullRfLog flag, correct comment, document flag + cross-repo cost

buildRfLogRecord was called with the literal fullRfLog: true even though
the call is only reached when the computed `logged` is true. That made
the gate's correctness depend on the early `if (!logged) return` three
lines above rather than on the value itself — a future edit moving the
call would silently turn the opt-in into a no-op. Pass `logged` instead,
and hoist the doubled getConfig() call into a local.

The comment above claimed the unattributable-packet path "must move NO
coverage state", but it does assign state.motion and call setPaused() —
intentionally, since updateMotion is a pure function of the latest GPS
fix and applying the idle gate here is the point. Reworded to say the
motion/idle-gate state is deliberately shared, and only the counters,
SNR meter, recently-heard list, beeper and map hexes must not move.

README's config.json example was missing fullRfLog (public/config.example.json
already had it). Documents the flag and that enabling it while the
ingestor's clientRxObservations.enabled is false wastes mobile data on
packets the server decodes and discards with no row and no warning —
mirrored in CoreScope's docs/client-rx-coverage.md.

Bumps sw.js CACHE (v13 -> v14) for the src/app.js change.
This commit is contained in:
efiten committed 2026-08-18 10:50:46 +02:00
1 parent 9339b66e6f
commit 67f548c858
3 files changed
+19 -7

No files matched your search

+9 -2
View File
@@ -99,12 +99,19 @@ Put a `config.json` in the served directory (next to `index.html`). Start from t
"mqttUrl": "wss://broker.yourdomain:8084/ws",
"mqttUsername": "coredrive-rx",
"mqttPassword": "<your publish-only EMQX account password>",
"resolveUrl": "https://corescope.yourdomain/api/nodes/resolve"
"resolveUrl": "https://corescope.yourdomain/api/nodes/resolve",
"fullRfLog": false
}
```
> `mqttPassword` is a **publish-only, ACL-constrained** account — it is shipped to browsers, so treat
> it as shared, not a secret. `resolveUrl` is optional (see CORS below); omit it and the app shows
> heard-key prefixes instead of node names.
> heard-key prefixes instead of node names. `fullRfLog` is optional (default `false`); when `true`,
> packets the direct-only rule can't attribute (a DIRECT-route path, or noise) are queued and
> published too, as diagnostic-only rows — never coverage. **This is pure waste unless the CoreScope
> ingestor also has `clientRxObservations.enabled: true`**: with it off, the ingestor decodes and
> discards every one of these packets, writing no row and logging no warning, while `fullRfLog`
> multiplies your normal upload volume. Confirm the ingestor-side flag with your CoreScope sysop
> before turning this on.
Changing any value later is just a `config.json` edit + page refresh — no rebuild.
+1 -1
View File
@@ -1,7 +1,7 @@
// Minimal service worker: makes the app installable and lets the shell load
// offline. Network-first (always fresh online), cache fallback (offline).
// Only the static app assets go through fetch; MQTT runs over WSS (not cached).
const CACHE = 'coredrive-rx-v13';
const CACHE = 'coredrive-rx-v14';
self.addEventListener('install', () => self.skipWaiting());
self.addEventListener('activate', (e) => e.waitUntil((async () => {
+9 -4
View File
@@ -292,14 +292,19 @@ async function processFrame(dv) {
// transmitter removed itself from the path's front), and 1-byte hops are collision-prone —
// both are called out. Everything else (tx / no advert) is pure noise, verbose only.
const lastHop = pkt && pkt.hops.length ? pkt.hops[pkt.hops.length - 1] : null;
const logged = getConfig() && getConfig().fullRfLog;
const cfg = getConfig();
const logged = cfg && cfg.fullRfLog;
const suffix = logged ? ', logged' : ', skipped';
if (lastHop && pkt.hops.length && !isFloodRoute(pkt.routeType)) dbg('direct route — transmitter not in path' + suffix, 'st');
else if (lastHop && lastHop.length === 2) dbg('1-byte path-hash (' + lastHop + ') — seen' + suffix, 'st');
else if (state.verbose) dbg('not attributable (tx / no advert)' + suffix + sig, 'no');
// fullRfLog: the packet is not coverage and must move NO coverage state —
// no counters, no SNR meter, no hex, no beep. It is queued and nothing else.
// fullRfLog: the packet is not coverage, so the counters, SNR meter,
// recently-heard list, beeper and map hexes must not move. The motion/
// idle-gate state below IS deliberately shared with the coverage path —
// updateMotion is a pure function of the latest GPS fix and now, the same
// fix already drives it on every GPS callback, and applying the idle gate
// here is the point (a stationary phone shouldn't queue RF-log rows either).
if (!logged) return;
const rfFix = currentFix();
let rfCapture = false;
@@ -310,7 +315,7 @@ async function processFrame(dv) {
rfCapture = rfDec.capture;
}
const rfRec = buildRfLogRecord({
hk, fullRfLog: true, rawHex, snr: f.snr, rssi: f.rssi,
hk, fullRfLog: logged, rawHex, snr: f.snr, rssi: f.rssi,
fix: rfFix, captureAllowed: rfCapture, nowISO: new Date().toISOString(),
});
if (!rfRec) return;