Commit Graph

3 Commits

Author SHA1 Message Date
Kpa-clawbot
6ec00a5aab test(go): fix failing test + add 18 tests, coverage 91.5% → 92.3%
Fix TestStoreGetAnalyticsChannelsNumericHash: corrected observation
transmission_id references (3,4,5 → 4,5,6) and changed assertion to
only check numeric-hash channels (seed data CHAN lacks channelHash).

New tests covering gaps:
- resolvePayloadTypeName unknown type fallback
- Cache hit paths for Topology, HashSizes, Channels
- GetChannelMessages edge cases (empty, offset, default limit)
- filterPackets: empty region, since/until, hash-only fast path,
  observer+type combo, node filter
- GetNodeHashSizeInfo: short hex, bad hex, bad JSON, missing pubKey,
  public_key field, flip-flop inconsistency detection
- handleResolveHops: empty param, empty hop skip, nonexistent prefix
- handleObservers error path (closed DB)
- handleAnalyticsChannels DB fallback (no store)
- GetChannelMessages dedup/repeats
- transmissionsForObserver from-slice filter path
- GetPerfStoreStats advertByObserver count
- handleAudioLabBuckets query error path

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-27 13:13:31 -07:00
Kpa-clawbot
1457795e3e fix: analytics channels + uniqueNodes mismatch
fixes #154: Go analytics channels showed single 'ch?' because
channelHash is a JSON number (from decoder.js) but the Go struct
declared it as string. json.Unmarshal failed on every packet.
Changed to interface{} with proper type conversion. Also fixed
chKey to use hash (not name) for grouping, matching Node.js.

fixes #155: uniqueNodes in topology analytics used hop resolution
count (phantom hops inflated it). Both Node.js and Go now use
db.getStats().totalNodes (7-day active window), matching /api/stats.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-27 12:07:50 -07:00
Kpa-clawbot
4101dc1715 test(go): push Go server test coverage from 77.9% to 91.4% (#145)
Add comprehensive coverage_test.go targeting all major coverage gaps:
- buildPacketWhere: all 8 filter types (0% -> covered)
- QueryMultiNodePackets: DB + store paths (0% -> covered)
- IngestNewFromDB: v3/v2 schema, dedup, defaults (0% -> covered)
- MaxTransmissionID: loaded + empty store (0% -> covered)
- handleBulkHealth DB fallback (24.4% -> covered)
- handleAnalyticsRF DB fallback (11.8% -> covered)
- handlePackets multi-node path (63.5% -> covered)
- handlePacketDetail no-store fallback (71.1% -> covered)
- handleAnalyticsChannels DB fallback (57.1% -> covered)
- detectSchema v2 path (30.8% -> covered)
- Store channel queries, analytics, helpers
- Prefix map resolve with GPS preference
- wsOrStatic, Poller, perfMiddleware slow queries
- Helper functions: pathLen, floatPtrOrNil, nilIfEmpty, etc.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-27 11:23:27 -07:00