108 Commits
Author SHA1 Message Date
efiten 59169ac69e android: Stop & close button on Home
Back and Home keep capture running in the background, and Disconnect sits on
Settings, so testers had no easy way to end the app. The button (native app
only) asks first while connected, disconnects, then closes the app with
@capacitor/app exitApp. Queued receptions stay and upload on the next connect.
The capture notification now points to the button.
2026-11-14 10:22:12 +01:00
efiten 7bcd48d1fd Merge pull request #52 from efiten/docs/deployment-help
android: the deployment card says step by step what to do
2026-11-12 16:56:09 +01:00
efiten fb34bd3725 android: the deployment card says step by step what to do
Three testers asked what to enter under Settings > Deployment. Until a deployment is chosen
the card now stands out (blue, title "First step: choose where your data goes") and lists
the steps: open your CoreScope on another screen, open Coverage, scan its QR code or type
the address under it. Once chosen it shrinks to one line naming where the app uploads.
2026-11-12 16:54:49 +01:00
efiten 436f859fb1 rf sampler: a sample every 100 m while moving, at most 15 s apart
A tester saw gaps between the RF hexes along a road. At 90 km/h the fixed 15 s cadence left
375 m between samples, more than one CoreScope hex at zoom 13 (about 340 m). The timer now
checks every 2 s and takes a sample once the phone moved 100 m since the last one, or 15 s
passed. Parked stays at 5 minutes. An RF sample is a Bluetooth stats query, no airtime.
2026-11-12 12:50:58 +01:00
efiten 4d388e0eb8 Merge pull request #49 from efiten/fix/qr-same-deployment
android: scanning the deployment already in use no longer restarts the app
2026-11-11 22:19:12 +01:00
efiten 734c0d0a8d android: scanning the deployment already in use no longer restarts the app
Choosing a deployment saves it and reloads the page, also when it is the one in use. On a
phone the QR scan of the same deployment dropped the companion link and cleared the debug
log. The same deployment now changes nothing; a different one asks first while connected.
2026-11-11 22:14:35 +01:00
efiten eab6eb5fc1 android: turn on R8 and send its mapping file to Play
Play Console flagged the bundle: DEX optimisation low, obfuscation 1%, no deobfuscation
file, no native debug symbols. Release builds now run R8 with resource shrinking and put
the native symbol table in the bundle; play-upload.mjs --mapping uploads mapping.txt.
Release APK 6.45 MB -> 3.35 MB. Capacitor's consumer rules keep every plugin class: the
seven plugins, MainActivity and AlwaysVisibleWebView keep their names in mapping.txt.
2026-11-11 21:58:27 +01:00
efiten 3aa6e1ec2c android: tell on Home when a newer version exists
Google Play updates silently and late, and a GitHub APK never updates by itself. At start
the app asks Play's in-app update API (@capawesome/capacitor-app-update 8.1.1); for a Play
install Play decides, and a tap starts the update in Play. Any other install compares its
version with version.json of its deployment, now written by every web build.
2026-11-11 21:37:10 +01:00
efiten e3d7d96b54 web: never stamp a reception with a fix from before the page went to the background
A hidden page gets no GPS updates while Web Bluetooth can still deliver packets, so a
reception was stamped with the last position from before the page was hidden. Fixes now
carry their receive time; a hidden page only uses a fix up to 30 s old (receptions, RF
samples, pings). After a minute or more in the background while connected, Home says how
long and how many receptions were saved or not saved.
2026-11-11 21:27:19 +01:00
efiten dd512261a4 regions: name the companion's refusal of an ask instead of 'no send-ack'
A companion up to firmware v1.16 answers CMD_SEND_ANON_REQ for a repeater that is not a
contact with ERR_CODE_TABLE_FULL when its contact list is full
(BaseChatMesh::allocateContactSlot); v1.17 reserves 8 slots for these asks. The app only
listened for RESP_CODE_SENT, so the refusal showed as a 4-second 'no send-ack'. The ask
now resolves on that error, logs the cause, and the header counts the refusals.
2026-11-11 21:22:42 +01:00
efiten e7376f0990 rf: re-arm the sampler at the moving cadence when moving again
While parked the next RF sample is armed 5 minutes out. On 'moving again' that timer kept
running, so the first minutes of a drive had no samples (4 min 19 s in a 2026-11-11 log,
20:20:28 to 20:24:47). setPaused(false) now re-arms it at 15 s when it was due later.

Release v1.24.5, SW cache v65.
2026-11-11 20:43:07 +01:00
efiten f280dec686 android: keep the WebView running with the screen off
Three v1.24.3 field logs of 2026-11-11 (three phones) show the same thing:
about 60 s after "app hidden" every upload, RF sample, region ask and uplink
ping stops until the screen is back on, for 7 to 25 minutes, while receptions
and discover go on. The catch-up of 149e39b keeps monitorTick alive but not
the jobs that wait on a timer, on IndexedDB or on the broker.

What changes:
- AlwaysVisibleWebView reports its window as visible at all times, so
  Chromium never treats the page as hidden. An app copy of
  capacitor_bridge_layout_main.xml puts it in place of CapacitorWebView.
- MainActivity sends appHidden / appVisible on onStop / onStart, because
  visibilitychange no longer fires. app.js logs both, wakelock.js re-acquires
  the screen lock on appVisible and leaves one that is still held alone.
- Service worker cache v64.

Verified: npm test, 485 of 485 pass. assembleDebug builds, and aapt2 shows
eu.on8ar.coredriverx.AlwaysVisibleWebView in the APK's layout.

Not verified: that this stops the freeze. No phone has run this build yet.
Battery use with the screen off is not measured. No version bump and no
release notes: those follow once a screen-off drive confirms it.
The web app (Chrome, Bluefy) is not changed by this and still freezes.
2026-11-11 20:09:21 +01:00
efiten 158120ec06 scripts: upload a signed bundle to a Play test track as a draft
Uses a service account key outside the repo and node:crypto for the OAuth JWT, so no new
dependency. The draft keeps the track's live release (tracks.update replaces the whole
list) and replaces an older draft. Release notes are the summary line of
docs/releases/vX.Y.Z.md, checked against Play's 500-character limit. An edit that is not
committed is deleted so it cannot block the next run.

Verified against Play: 'tracks' lists alpha with 12403 (1.24.3) completed. Not yet
verified: an actual upload, which needs a new versionCode.
2026-11-11 19:55:55 +01:00
efiten 86de4f69ad android: one-time battery tip before the first Connect
A OnePlus closed the app during a test walk (exit reason o-kill, importance
125, so with the foreground service running). Without an extra permission
the app cannot prevent that, so before the first Connect in the Android app
a popup says to set the battery setting to Unrestricted, linking
dontkillmyapp.com. Shown once (localStorage flag); storage that throws skips
it rather than blocking Connect. Same text in the user guide.

Release v1.24.3, SW cache coredrive-rx-v63.
2026-11-11 14:02:18 +01:00
efiten c761c65709 android: ask for notification permission before capture starts
On Android 13+ the foreground service notification stays hidden until the
user allows notifications, and background-geolocation does not ask.
NativeGps.start now calls LocalNotifications.requestPermissions() before
addWatcher; a refusal or error does not stop capture.

Release v1.24.2, SW cache coredrive-rx-v62.
2026-11-11 12:43:42 +01:00
efiten a73b615a55 release notes: each body holds only its own release
The folded history still made every body list all earlier releases, which
the GitHub releases list already shows. The body is now the tag's own
docs/releases file plus one link to the releases list. The job still fails
on a tag without a notes file.
2026-11-11 11:27:12 +01:00
efiten a3c99641fc release notes: folded summary is the first sentence only
Some release files open with a whole paragraph (v1.11.0 to v1.16.0), which
made their <summary> lines run over several lines.
2026-11-11 11:23:13 +01:00
efiten a7aa27f1c3 release notes: fold earlier releases into <details>
GitHub shows the assets below the release body. With all 45 release files
written out in full, the APK of v1.24.0 sat below an 88 KB body. The tag's own
notes stay in full; every older release becomes a closed <details> block under
'Earlier releases', summary = tag + its one-line summary. Nothing is dropped,
so the cumulative rule in AGENTS.md still holds.
2026-11-11 11:22:24 +01:00
efiten 149e39bb50 fix(native): keep uploading with the screen off
Field log 2026-11-10: with the screen off the Android WebView stopped
running JavaScript timers while Bluetooth frames and GPS fixes kept
arriving. For eleven minutes receptions were queued but nothing was
published, no RF sample was taken, no discover, region ask or uplink ping
went out, and the broker dropped the link for want of a keepalive. The
116-record backlog went out when the screen came back on; positions and
rx_at in client_rx_observations were correct.

Every frame and GPS fix now calls catchUp, which runs the jobs whose timer
is overdue: the monitor tick, the drain, the pending RF sample and, when
the drain is late and the broker link is down, one reconnect per 15 s.
src/catchup.js holds the decision (test/catchup.test.mjs). The debug log
now records when the app is hidden and visible again. Not yet tested on
the phone.
2026-11-10 22:20:04 +01:00
efiten 3963704592 fix(native): share the debug log through the Android share sheet
In the Android app the Share button did nothing: the WebView has no
navigator.share, and the download-link fallback is ignored there. The
native app now writes the log to its cache (@capacitor/filesystem 8.1.5)
and opens the share sheet with it as a .txt attachment (@capacitor/share
8.0.3). The web paths are unchanged. pickShareMethod picks 'native' first;
test/sharelog.test.mjs covers it.
2026-11-10 22:20:03 +01:00
efiten 26e2b096ba feat(native): scan the deployment URL from a QR code
The Deployment card in Settings gets a "Scan QR code" button. It uses
BarcodeScanner.scan() of @capacitor-mlkit/barcode-scanning 8.2.1 (exact; 8.2.2
was 10 days old), which runs the Google code scanner in Play services: its own
camera screen, no camera permission, the module downloaded once on first use
with progress shown in the card. A scanned code must spell out https:// itself
and then goes through the same config.json check as a typed URL. A cancelled
scan is silent; a QR code that is not a deployment URL says so.

The QR code itself comes from CoreScope's Coverage page (clientRxCoverage.appUrl),
which is a separate change in the CoreScope repository.

android/app/build.gradle leaves libbarhopper_v3.so out of the APK: that is the
bundled ML Kit detector used only by startScan and readBarcodesFromImage, which
the app never calls. Debug APK 29.5 MB with it, 9.2 MB without (4.9 MB before
the plugin).

- src/qrscan.js + test/qrscan.test.mjs: 8 tests (468 total pass)
- web build checked headless: appver filled, Deployment card hidden

Not tested on a device: the scan, the module download and the size cut are
unverified on hardware.
2026-11-10 09:38:25 +01:00
efiten 65de1920f9 feat(native): choose the deployment at runtime instead of baking config.json into the APK
The APK carried the config.json that happened to be in public/ at build time, so
every APK belonged to one deployment, and a real one would have put the broker
login inside the file.

The native app now asks for the URL of a CoreDrive RX web deployment under
Settings and reads that deployment's config.json through CapacitorHttp, outside
the WebView, so the deployment needs no CORS header for it. A new URL is checked
before it replaces the old one. The last good config of the same deployment is
kept in localStorage and used when a start has no network; a different
deployment drops it. android:sync removes config.json from the APK assets.

- src/deployment.js: URL normalization (https only), fetch + validate + cache
- src/config.js: setConfigSource and parseConfigText, fetch path unchanged
- test/deployment.test.mjs: 11 tests (460 total pass)
- web build checked headless: appver filled, Deployment card hidden

Not tested on a device yet.
2026-11-10 09:04:56 +01:00
efitenandClaude Opus 5.5 b6f90aed40 feat(native): Capacitor Bluetooth transport and background GPS behind src/platform.js
Step 1 of a native Android app (issue #13). The Android WebView has no Web
Bluetooth, so CapacitorBleTransport (src/transport-native.js) implements
the WebBluetoothTransport API on @capacitor-community/bluetooth-le: NUS
service, notify to every onFrame listener, serialised writes, reconnect
with backoff. The plugin requests a 512-byte MTU on connect (Device.kt).

NativeGps (src/gps-native.js) uses @capacitor-community/background-
geolocation with a backgroundMessage, which runs a foreground service, so
fixes should keep coming with the screen off. That is the point of the
native app; it is not verified on a device yet.

src/platform.js picks one or the other via Capacitor.isNativePlatform().
In the browser nothing changes in behaviour; the web bundle grows by
about 21 kB (512 kB, was 490 kB) because the plugin JS is now imported.
The service worker is not registered in the native app, and the Web
Bluetooth notice is not shown there.

Tests: 9 new in test/native.test.mjs with injected plugin fakes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 23:46:21 +01:00
efitenandClaude Opus 5.5 f5c231f58e feat(msgwait): count direct messages only, filter every companion channel
The first version filtered only #coredrive. Reading every channel slot of
the companion (CMD_GET_CHANNEL, once per connection, only with the notice
on) lets the app recognise any channel message the way the firmware does:
channel hash, then MAC (Mesh.cpp:225-236), for GRP_TXT and GRP_DATA. What
still triggers a count is a direct message or a room-server post.

The slots cannot change during the connection: the MeshCore app cannot
reach the companion while CoreDrive RX holds the BLE link. A slot the
uplink ping writes is added to the list as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 22:13:43 +01:00
efitenandClaude Opus 5.5 79c49e6ab1 feat: optional notice when a message waits on the companion
While CoreDrive RX holds the BLE link the MeshCore app cannot, so a user
asked whether they would miss messages. The companion already pushes a
one-byte PUSH_CODE_MSG_WAITING (0x83) per queued message; the app now
counts those on Home, behind a Settings toggle that is off by default,
with an optional two-tone sound. Nothing is fetched: CMD_SYNC_NEXT_MESSAGE
would remove the message from the companion's queue.

The push carries no type, so #coredrive traffic of other clients would be
counted too. src/msgwait.js matches each push against the 0x88 that came
just before it (logged before processing, Dispatcher.cpp:199): the first
copy of another client's ping-channel GRP_TXT expects one push, which is
swallowed; re-broadcasts expect none (wasSeen, Mesh.cpp:233); echoes of
our own ping expect none (markSeen on send, Mesh.cpp:651). A promise
chain keeps the async decrypt of the 0x88 ahead of the 0x83.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 22:07:35 +01:00
efitenandClaude Opus 5.5 a7a72d7eb7 fix(drain): keep another companion's backlog until it is connected
drainOnce published a row stamped with an earlier companion under that
companion's pubkey while the MQTT clientId was the companion connected
now. The documented ACL binds the topic to ${clientid}, so the broker
denies that publish, and with EMQX's default deny_action=ignore it still
sends a PUBACK. The row was removed from the queue and never stored.

Such rows now stay in the queue (counted as `waiting`) and go out once
their own companion is connected. The hold is asked for the connected
companion only. The debug log says once how many rows are waiting.

Tests: 430 pass (sandboxed run of the full suite). Not tested against a
live broker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NEgJ9U9V5WmHyRjL96MaDz
2026-10-23 09:19:50 +02:00
efitenandClaude Opus 5.5 2c1905f077 fix(config): keep verifyAdverts through normalizeConfig
normalizeConfig (src/config.js) copied every feature flag except
verifyAdverts. processFrame reads the flag from the normalized config
(src/app.js:1333), so verifyAdverts:true in config.json never reached
heardKeyAfterVerify and 0-hop adverts with an invalid signature were
still accepted under their claimed pubkey.

The existing test only called featureEnabled on hand-built objects.
The new test goes through normalizeConfig: true when set, false when
absent or false.

Tests: node --test, 429/429 pass (run in the WSL sandbox with the
installed node_modules of 4a91f20; the worktree has no node_modules).
Not done: version bump and docs/releases entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NEgJ9U9V5WmHyRjL96MaDz
2026-10-23 00:26:21 +02:00
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 5a4319736e fix(account): a linked companion no longer goes to My nodes
CoreScope stopped adding linked companions to My nodes (a companion is
not a node to monitor), and its link answer has no myNodes field any
more. The card and the log no longer mention My nodes, and an answer
from an earlier server build that still carries the field is ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 15:39:53 +02:00
efitenandClaude Opus 5.5 ea69769d5f fix(account): show the login only when CoreScope announces companion linking
A CoreScope with accounts but without companion linking (v3.14) sends
userManagement.enabled and answers POST /api/auth/device-token with its
SPA page, so the card appeared and every login failed with 'HTTP 200'.
Discovery now also needs userManagement.companionLinking; without it
the card stays hidden and uploading is as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:41:28 +02:00
efitenandClaude Opus 5.5 b1d43baf2d fix(account): retry a missing discovery and a waiting link with backoff
A CoreScope that was briefly unreachable at start, a slow mobile
request or a 429 left the link waiting, and only an 'online' event or a
reconnect asked again; navigator.onLine rarely changes, so a held queue
could stay held for the whole session. Both are now asked again after
30 s, 60 s, 2, 5 and then every 10 minutes, and stop on an answer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:11:47 +02:00
efitenandClaude Opus 5.5 0883f43b22 fix(account): a link attempt belongs to one companion; a BLE drop mid-sign is transient
An attempt for the previous companion could run into the next
connection and have the new companion sign its challenge (a 400 that
marked it failed), while the new companion got no attempt of its own.
Attempts are now per companion: one for another companion waits and
then runs, and signing checks that the target is still connected.

A BLE drop during signing followed by the transport's fast reconnect
let the 4 s step timeout read as 'firmware cannot sign' or a definite
failure, which blocked the link for the connection. A sign error after
the link changed, or with it down, is now transient and retried.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:10:45 +02:00
efitenandClaude Opus 5.5 0c942e483e fix(drain): publish every queued row under the companion that captured it
With the hold, a queue can keep one companion's rows for a long time.
Connecting another, linked companion then published that backlog under
the new pubkey: someone else's receptions counted as its coverage, and
data from an unlinked companion got past requireLinkedCompanion. Rows
now carry the capturing companion (rx, rx_name; not part of any MQTT
payload), drain publishes each under its own pubkey, and the hold is
decided per row. Rows queued before this version behave as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:09:40 +02:00
efitenandClaude Opus 5.5 62621c591c feat: CoreScope account card, auto-link on connect, hold while unlinked
Settings gets a 'CoreScope account' card, shown only when CoreScope has
user management on (or this companion's uploads are held). A connected
companion is linked automatically; the sign exchange holds the radio so
region discovery, the discover sweep and the RF sampler cannot answer
for it. Drain holds only when CoreScope requires linked companions.
The service worker no longer caches CoreScope's account/config answers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:03:04 +02:00
efitenandClaude Opus 5.5 298a67681f test: MQTT payload is identical with and without login; hold end to end
Drives the real Publisher payload builders through drainOnce with a
logged-out and a logged-in account and compares the bytes, and pins the
hold rules: flag off never waits, flag on holds an unlinked companion
without touching the queue, linking releases it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:00:25 +02:00
efitenandClaude Opus 5.5 40c294dba4 feat(drain): hold the queue while CoreScope requires a linked companion
One optional precondition next to publisher.connected(): when held, the
pass publishes nothing and does not touch the queue. Push pending now
names the hold instead of blaming the broker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 11:00:02 +02:00
efitenandClaude Opus 5.5 46f27bc618 feat: account card view model (pure)
Linked / linking / waiting / firmware cannot sign / failed + Retry, the
● on the connected companion, and the 'N waiting' line while held. The
card also shows while held after a failed discovery, so a held queue is
never unexplained.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 10:59:41 +02:00
efitenandClaude Opus 5.5 9f9ed11e63 feat(account): hold a freshly linked companion until the ingestor can see it
With requireLinkedCompanion, CoreScope's ingestor re-reads its linked
list on a miss at most once per 5 s and drops what arrives in between,
after the broker acked it. A fresh link now keeps the queue held for
6 s and then signals a change, so the first upload is not lost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 10:59:29 +02:00
efitenandClaude Opus 5.5 9c22d19453 feat(account): auto-link a connected companion to the account
Cached → done; refreshed list → done; else challenge, sign
'corescope-link:<host>:<challenge>' on the companion, post, cache.
410 retried once, 400 and unsupported firmware not retried until the
next connect or Retry, network, 429 and BLE drops wait for the next
attempt. myNodes full/failed is a note, not a failure. One attempt at
a time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 10:58:04 +02:00
efitenandClaude Opus 5.5 039a6747e6 feat(account): device-token login, logout, companions cache, 401
The password is sent once and never stored; the token is stored with its
origin and never logged. Logout revokes without waiting. Any 401 clears
the token. 429 says how long to wait when Retry-After is readable. No
request carries cookies: CoreScope judges a request with its session
cookie on that cookie alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 10:57:36 +02:00
efitenandClaude Opus 5.5 9ee9984b01 feat(account): discovery gate, origin-bound session, hold flag
Only userManagement.enabled === true turns the feature on; every other
outcome is off with one log line naming the reason (including the CORS
hint). clientRxRequireLinkedCompanion is remembered per origin; a
deployment that never answered means not required.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 10:57:02 +02:00
efitenandClaude Opus 5.5 304553f98b feat: companion signs bytes over CMD_SIGN_START/DATA/FINISH
Same onFrame/send path as selfinfo.js. 128-byte chunks stay under the
176-byte frame and the ESP32's 173-byte ATT payload. ERR or silence on
START means the firmware cannot sign; OK/ERR ahead of the START reply
belong to earlier commands and are ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 10:53:24 +02:00
efitenandClaude Opus 5.5 cea751fa7c feat(config): optional corescopeUrl, normalized to an origin
Falls back to the origin of resolveUrl; both empty turns the account
feature off. Runtime config only, nothing hardcoded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 10:52:35 +02:00
efitenandClaude Opus 5 0e72292253 fix: "Push pending now" during a slow connect left orphaned MQTT sockets (v1.18.4)
Publisher.reconnect() called mqtt.js client.reconnect() unconditionally.
mqtt.js connect() replaces this.stream without closing the previous one
(client.js:257), so a press while a CONNECT was still unanswered left the
earlier socket open. When an orphan closed, its 'close' set
client.connected = false over a live session and armed a reconnect that
orphaned that session in turn.

Field log 2026-09-19: connack timeouts on a weak mobile link, then five
presses in four seconds (12:05:54 to 12:05:57), then "connected" followed
by "offline" and "connection closed" in the same second at 12:05:58,
12:06:00, 12:06:02 and 12:06:04.

reconnect() now returns false and does nothing while an attempt is in
flight (no session, no reconnect timer armed); the Push button logs that.
Once the socket has closed it still skips the 4 s wait. Two tests run the
real mqtt.js client over a fake stream; without the guard the first fails.

Not verified: the EMQX log has no lines for this client id, so the
broker-side session takeover between the sockets was not observed.

Version, release notes and the service-worker cache bump ride along, as
AGENTS.md requires.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-19 19:54:05 +02:00
efitenandClaude Opus 5 1a98a6df8d fix: the region hold's default timers threw in the browser (v1.18.3)
holdUntilReply's default was `timers = { setTimeout, clearTimeout }`, so the
native timers were called with that object literal as `this`. Chromium rejects
that with "TypeError: Illegal invocation"; Node does not check, which is why
279 tests passed over it.

The throw lands inside askRepeater's try, after the ask has gone out, so the
20 s hold and the restore of the repeater's original contact path were both
skipped; the restore record waited in localStorage for the next connect. It
fires once per repeater per session, on the ask that applies the override.
Field log 2026-09-18: three of them, 14036f, e3d3f4 and cf7903, each on
"attempt 1 of 4".

Version, release notes and the service-worker cache bump ride along, as
AGENTS.md requires.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 10:57:17 +02:00
efitenandClaude Opus 5 ac9f5126be fix: end the contact-override hold when the repeater answers
A repeater saved as a contact has its stored path forced to zero-hop for the ask and put
back afterwards, and the queue waits for that round. It waited a flat 20s. In the
2026-09-14 commute log 49a98584fce5 and 72d171e63056 both answered 2s after the ask and
the queue then sat blocked 18s more each; cafe314d00e2, heard at 17:47:01, was not asked
until 17:47:14 because of it. Every answer visible across the field logs so far — 11 of
them — arrived 1–2s after its ask.

holdUntilReply resolves on whichever comes first: the matched reply for that target, or
OVERRIDE_HOLD_MS. onRegionsFrame releases the hold right after it files an answer, and a
reply that lands before the hold starts skips it. The no-reply fallback keeps its 20s:
how early a restore is safe while no answer has arrived is a firmware question, and this
only removes time after the answer is in hand.

The restore line now says which way the hold ended, "(reply in, hold ended early)" or
"(no reply in 20s)", so the next field log can confirm it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012GJuEuyG3JMrSeAGCmJ1GP
2026-09-14 18:09:15 +02:00
Erwin FitenandClaude Opus 5 ec55d31bfe fix: the debug log announced a healthy BLE link once a second
noteLinkState's guard was inverted. `state.linkQuiet` holds the INVERSE of
the link being up, so the steady state is `linkQuiet !== linkUp` and an edge
is `linkQuiet === linkUp`. The guard returned on the edge and fell through in
the steady state — the exact opposite of both.

Per-second monitorTick therefore wrote "companion link back" on every tick of
a perfectly healthy link, and swallowed the real transition: linkQuiet never
flipped off its `false` initial value, so "companion link down" could never be
reached at all. A field log from this morning shows 157 of 200 buffered lines
spent on the spam, the whole 200-line ring buffer covering 2m36s, and not one
"link down" line — defeating cc710a3, which added the pair so that a dropped
link would stop reading like an app that had crashed.

The edge decision moves to monitor.js as the pure `linkTransition`, next to
the other per-tick monitor helpers, since app.js cannot be imported under
node --test. Five regression tests cover both steady states, both edges, and a
full drop/return cycle driven tick by tick.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-14 09:48:06 +02:00