mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-09-27 01:07:53 +00:00
fix: ping-bot reply says "observers" not "stations"
Matches the term used everywhere else in CoreScope (/api/observers, observer names, etc.) instead of an inconsistent synonym. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
3b5bc17180
commit
f0f28b5c32
+7
-7
@@ -1969,10 +1969,10 @@ func (db *DB) GetChannelMessages(channelHash string, limit, offset int, region .
|
||||
// pendingPing collects a ping-triggering message's REACH across every
|
||||
// observation of it, not just the first: hops/snr/resolvedPath track
|
||||
// the DEEPEST (max-hop) observation seen so far -- how far the packet
|
||||
// had propagated before the farthest-along station heard it -- and
|
||||
// observers is every distinct station that heard it at all (breadth).
|
||||
// had propagated before the farthest-along observer heard it -- and
|
||||
// observers is every distinct observer that heard it at all (breadth).
|
||||
// A single arbitrary "first observation wins" data point understates
|
||||
// both: two stations can hear the same flood at very different hop
|
||||
// both: two observers can hear the same flood at very different hop
|
||||
// depths depending on which relay leg reached them.
|
||||
type pendingPing struct {
|
||||
hops int
|
||||
@@ -2131,10 +2131,10 @@ func (db *DB) GetChannelMessages(channelHash string, limit, offset int, region .
|
||||
repeaterNames = append(repeaterNames, *pk)
|
||||
}
|
||||
}
|
||||
// Breadth: name the single station when there's only one (as
|
||||
// Breadth: name the single observer when there's only one (as
|
||||
// specific as before), otherwise report the count -- "heard by
|
||||
// 4 stations" says more about actual reach than an arbitrarily
|
||||
// picked single name once more than one station heard it.
|
||||
// 4 observers" says more about actual reach than an arbitrarily
|
||||
// picked single name once more than one observer heard it.
|
||||
observerLabel := ""
|
||||
switch len(p.observers) {
|
||||
case 0:
|
||||
@@ -2144,7 +2144,7 @@ func (db *DB) GetChannelMessages(channelHash string, limit, offset int, region .
|
||||
observerLabel = name
|
||||
}
|
||||
default:
|
||||
observerLabel = fmt.Sprintf("%d stations", len(p.observers))
|
||||
observerLabel = fmt.Sprintf("%d observers", len(p.observers))
|
||||
}
|
||||
if m, ok := msgMap[txID]; ok {
|
||||
m.Data["botReply"] = pingBotReply(p.hops, p.snr, observerLabel, p.scope, repeaterNames)
|
||||
|
||||
@@ -1492,11 +1492,11 @@ func TestGetChannelMessages_PingBotReply(t *testing.T) {
|
||||
}
|
||||
|
||||
// TestGetChannelMessages_PingBotReply_MultiObservation covers a single
|
||||
// ping transmission heard by TWO different observer stations at
|
||||
// ping transmission heard by TWO different observers at
|
||||
// DIFFERENT hop depths (normal in a mesh: one station may hear an early
|
||||
// relay leg, another a later one). The botReply must report the DEEPEST
|
||||
// (max-hop) observation's path/SNR -- not whichever observation happened
|
||||
// to be scanned first -- and the breadth ("N stations") once more than
|
||||
// to be scanned first -- and the breadth ("N observers") once more than
|
||||
// one distinct station heard it, per pingBotReply's doc comment.
|
||||
func TestGetChannelMessages_PingBotReply_MultiObservation(t *testing.T) {
|
||||
db := setupTestDB(t)
|
||||
@@ -1542,8 +1542,8 @@ func TestGetChannelMessages_PingBotReply_MultiObservation(t *testing.T) {
|
||||
if !strings.Contains(text, "via RepeaterAlpha → pkBravoRepeater → RepeaterCharlie") {
|
||||
t.Errorf("botReply text = %q, want the deeper observation's resolved relay path", text)
|
||||
}
|
||||
if !strings.Contains(text, "heard by 2 stations") {
|
||||
t.Errorf("botReply text = %q, want breadth reported as \"2 stations\" now that more than one station heard it", text)
|
||||
if !strings.Contains(text, "heard by 2 observers") {
|
||||
t.Errorf("botReply text = %q, want breadth reported as \"2 observers\" now that more than one observer heard it", text)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user