Rename Best RSSI to Strongest Neighbor. Closes #136.

This commit is contained in:
Jack Kingsman
2026-03-31 13:10:02 -07:00
parent 9f4737d350
commit c83f9b0005
4 changed files with 20 additions and 30 deletions
+15 -17
View File
@@ -171,24 +171,17 @@ function isNeighborIdentityResolvable(item: NeighborStat, contacts: Contact[]):
return resolveContact(item.key, contacts) !== null;
}
function formatStrongestPacketDetail(
function formatStrongestNeighborDetail(
stats: ReturnType<typeof buildRawPacketStatsSnapshot>,
contacts: Contact[]
): string | undefined {
if (!stats.strongestPacketPayloadType) {
const strongestNeighbor = stats.strongestNeighbors[0];
if (!strongestNeighbor || strongestNeighbor.bestRssi === null) {
return undefined;
}
const resolvedLabel =
resolveContactLabel(stats.strongestPacketSourceKey, contacts) ??
stats.strongestPacketSourceLabel;
if (resolvedLabel) {
return `${resolvedLabel} · ${stats.strongestPacketPayloadType}`;
}
if (stats.strongestPacketPayloadType === 'GroupText') {
return '<unknown sender> · GroupText';
}
return stats.strongestPacketPayloadType;
const resolvedNeighbor = resolveNeighbor(strongestNeighbor, contacts);
return `${formatRssi(resolvedNeighbor.bestRssi)} best heard`;
}
function getCoverageMessage(
@@ -450,8 +443,13 @@ export function RawPacketFeedView({
[nowSec, rawPacketStatsSession, selectedWindow]
);
const coverageMessage = getCoverageMessage(stats, rawPacketStatsSession);
const strongestPacketDetail = useMemo(
() => formatStrongestPacketDetail(stats, contacts),
const strongestNeighbor = useMemo(() => {
const topNeighbor = stats.strongestNeighbors[0];
return topNeighbor ? resolveNeighbor(topNeighbor, contacts) : null;
}, [contacts, stats]);
const strongestNeighborDetail = useMemo(
() => formatStrongestNeighborDetail(stats, contacts),
[contacts, stats]
);
const strongestNeighbors = useMemo(
@@ -578,9 +576,9 @@ export function RawPacketFeedView({
detail={`${formatPercent(stats.pathBearingRate)} path-bearing packets`}
/>
<StatTile
label="Best RSSI"
value={formatRssi(stats.bestRssi)}
detail={strongestPacketDetail ?? 'No signal sample in window'}
label="Strongest Neighbor"
value={strongestNeighbor?.label ?? '-'}
detail={strongestNeighborDetail ?? 'No neighbor RSSI sample in window'}
/>
<StatTile
label="Median RSSI"
+3 -1
View File
@@ -124,7 +124,9 @@ describe('linked channel references', () => {
it('ignores invalid or embedded channel-like text', () => {
expect(
findLinkedChannelReferences('skip #Bad #bad--name abc#ops #ops- #opsRoom #ops_room #good-room,')
findLinkedChannelReferences(
'skip #Bad #bad--name abc#ops #ops- #opsRoom #ops_room #good-room,'
)
).toEqual([]);
});
});
@@ -283,6 +283,8 @@ describe('RawPacketFeedView', () => {
fireEvent.click(screen.getByRole('button', { name: /show stats/i }));
fireEvent.change(screen.getByLabelText('Stats window'), { target: { value: 'session' } });
expect(screen.getAllByText('Alpha').length).toBeGreaterThan(0);
expect(screen.getByText('Strongest Neighbor')).toBeInTheDocument();
expect(screen.getByText('-70 dBm best heard')).toBeInTheDocument();
});
it('marks unresolved neighbor identities explicitly', () => {
-12
View File
@@ -106,9 +106,6 @@ export interface RawPacketStatsSnapshot {
medianRssi: number | null;
bestRssi: number | null;
rssiBuckets: RankedPacketStat[];
strongestPacketSourceKey: string | null;
strongestPacketSourceLabel: string | null;
strongestPacketPayloadType: string | null;
coverageSeconds: number;
windowFullyCovered: boolean;
oldestStoredTimestamp: number | null;
@@ -377,8 +374,6 @@ export function buildRawPacketStatsSnapshot(
['Weak (<-85 dBm)', 0],
]);
let strongestPacket: RawPacketStatsObservation | null = null;
for (const packet of packets) {
payloadCounts.set(packet.payloadType, (payloadCounts.get(packet.payloadType) ?? 0) + 1);
routeCounts.set(packet.routeType, (routeCounts.get(packet.routeType) ?? 0) + 1);
@@ -436,10 +431,6 @@ export function buildRawPacketStatsSnapshot(
} else {
rssiBucketCounts.set('Weak (<-85 dBm)', (rssiBucketCounts.get('Weak (<-85 dBm)') ?? 0) + 1);
}
if (!strongestPacket || strongestPacket.rssi === null || packet.rssi > strongestPacket.rssi) {
strongestPacket = packet;
}
}
}
@@ -527,9 +518,6 @@ export function buildRawPacketStatsSnapshot(
medianRssi,
bestRssi,
rssiBuckets: rankedBreakdown(rssiBucketCounts, rssiValues.length),
strongestPacketSourceKey: strongestPacket?.sourceKey ?? null,
strongestPacketSourceLabel: strongestPacket?.sourceLabel ?? null,
strongestPacketPayloadType: strongestPacket?.payloadType ?? null,
coverageSeconds,
windowFullyCovered,
oldestStoredTimestamp,