Commit Graph
2 Commits
Author SHA1 Message Date
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
Erwin FitenandClaude Opus 5 229bbf656c fix: a failed config fetch no longer silently disables the whole session
Two field logs traced to one root cause: config.json is fetched exactly once at
DOMContentLoaded and never retried, so a single transient failure at startup left
getConfig() returning null (or a stale cached copy) for the rest of the session.

Log A: no config at all. connectAll took its else branch, never built a Publisher,
and then reported "All connected - capturing" anyway. An hour of receptions queued
and nothing published. The Push button answered "nothing pending / not connected"
because drain() returns 0 for a null publisher exactly as it does for an empty
queue - and its reconnect branch was guarded on `publisher && !connected()`, which
skipped the one case needing recovery. The only message naming the cause went to
els('status'), which the next connect cleared with log('').

Log B: a config.json cached before rfSampler/regionDiscovery existed. Absent flags
normalize to false, so both features were dead while the served config said on -
publishing worked, everything looked green, and nothing reported it. A stale config
is worse than none: none is detectable, stale is not.

- sw.js: config.json bypasses the cache in both directions, and the
  caches.match('/') fallback is limited to navigations. Serving index.html for a
  JSON request is what turned an offline start into "invalid JSON: Unexpected
  token '<'".
- config.js: loadConfig dedupes concurrent attempts, caches only on success so a
  retry actually re-fetches, and names an HTML body instead of leaking a parse error.
- uplink.js (new, pure): uplinkState / uplinkWarning / pushOutcome /
  regionInertReason / buildLogHeader.
- app.js: retries the config on every connect, on `online`, and once a minute while
  missing; startPublisher() split out so a late config brings uploading up without
  reconnecting; a red Home banner while receptions are buffered but not uploaded;
  the progress list no longer claims an uplink it does not have; pushNow reports
  queue depth independently of link health and picks the matching repair.
- Region discovery names which of its four gates is holding it, once, in the log -
  "no regions lines" was consistent with all four and distinguished none. Its
  re-entry throttle is now stamped before the gates instead of after.
- Every exported log carries a header with app version, EFFECTIVE config flags,
  firmware version, region-discovery status, uplink state and queue depth. Both
  field logs arrived unattributable to a version; the header is built at share time
  so it cannot roll out of the 200-line ring buffer the way a startup line does.

Tests: 217 pass (+41). sw.js is driven in a node:vm ServiceWorkerGlobalScope so the
shipped file is tested, not a copy of its logic.

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