feat(nodes): name the position source on the Node Details badge (#4498) - #4501
Conversation
The Position card showed a generic "GPS" for every real fix. The protobuf's `location_source` (LocSource) has been decoded, stored and formatted since #4176, but PR #4188 wired it only into the map popups — NodeDetailsBlock was never updated, so a manually-entered fix and an internal GPS fix looked identical. Wires the existing `formatLocationSource()` into the gps branch, so the badge reads "Internal GPS" / "External GPS" / "Manual". The helper returns null for LOC_UNSET or an absent value, so nodes that never reported a source keep the exact pre-#4498 wording. Also adds the "Exact" label the issue suggested for the null-accuracy case, but NOT as a blanket rule. `hasAccuracyCell()` is false for three different reasons: full precision (bits >= 32), a user override, and unset/zero precision bits. Only the first two are genuinely exact; the third means the device never reported how precise the fix was. Labelling all three "Exact" would assert something we don't know, so the unknown case still renders nothing — covered by a test. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9NzRtqE8eSMS8tvAeodUB
|
Claude finished @Yeraze's task —— View job PR Review: feat(nodes): name the position source on the Node Details badge (#4498)Tasks:
SummaryThis is a clean, well-scoped PR. The implementation logic is sound and the test coverage is comprehensive. A few minor observations below. NodeDetailsBlock.tsxMinor:
tooltip:
formatLocationSource(node.positionLocationSource) !== null
? t(
'node_details.position_source_gps_tooltip_sourced',
'Position reported by the device ({{source}}).',
{ source: formatLocationSource(node.positionLocationSource) },
)
: ...
: (() => {
const locSourceLabel = formatLocationSource(node.positionLocationSource);
return {
kind: 'gps',
label: locSourceLabel ?? t('node_details.position_source_gps', 'GPS'),
tooltip: locSourceLabel !== null
? t('node_details.position_source_gps_tooltip_sourced', 'Position reported by the device ({{source}}).', { source: locSourceLabel })
: t('node_details.position_source_gps_tooltip', 'Position reported by the device.'),
...
};
})()Not a blocker — just a readability nit. Minor: JSDoc comment inside the
The NodeDetailsBlock.position.test.tsxGood:
Minor: Test for
The test verifies Correctness AssessmentThe logic in the
Security / PerformanceNo concerns. This is purely a presentational change — VerdictApprove with the nit above. The double-call to |
Closes #4498.
The Position card showed a generic "GPS" for every real fix. The protobuf's
location_source(LocSource) has been decoded, stored and formatted since #4176, but PR #4188 wired it only into the map popups —NodeDetailsBlockwas never updated, so a manually-entered fix and an internal GPS fix looked identical.Wires the existing
formatLocationSource()into thegpsbranch, so the badge reads Internal GPS / External GPS / Manual. The helper returnsnullforLOC_UNSETor an absent value, so nodes that never reported a source keep the exact pre-#4498 wording.The "Exact" bonus, done differently to what the issue proposed
The issue suggests labelling the null-accuracy case "Exact". Implemented, but not as a blanket rule —
hasAccuracyCell()returns false for three different reasons:Only the first two are exact. The third means the device never told us how precise the fix was, and labelling it "Exact" would assert something we don't know. So the unknown case still renders nothing, and a test pins that specifically.
Test plan
Overridestill outranking LocSource,Exactfor full precision and for overrides, nothing for unreported precision, error bar for an imprecise fix.success: true, 13007 passed, 0 failed.npx tsc --noEmitclean;npm run lint:cino FAIL lines.Generated by Claude Code