Repository navigation
feat(node): list traceroutes other nodes ran to us on our own node - #7764
Conversation
Walkthrough
Priority: Merge Risk:
|
There was a problem hiding this comment.
🧹 Nitpick comments: 1
core/testing/src/commonMain/kotlin/org/meshtastic/core/testing/FakeMeshLogRepository.kt: 1
91-92:Trivial · Functional Correctness · Low value Match the production query order and limit in the fake.
This is a test-fidelity improvement rather than a current production or test failure. The final traceroute history sorts independently, and the existing test uses only three logs. A fixture with more than 5,000 port-and-sender matches can still include older
want_responseentries that production omits.Apply the operations in this order: filter by port and sender, sort and limit, then filter
want_response.Suggested fix
+import org.meshtastic.core.repository.MeshLogRepository.Companion.DEFAULT_MAX_LOGS ... override fun getInboundRequestLogs(portNum: PortNum): Flow<List<MeshLog>> = logsFlow.map { it.filter { log -> log.fromNum != MeshLog.NODE_NUM_LOCAL && - log.portNum == portNum.value && + log.portNum == portNum.value + } + .sortedByDescending(MeshLog::received_date) + .take(DEFAULT_MAX_LOGS) + .filter { log -> log.fromRadio.packet?.decoded?.want_response == true - } + } }

Review info
-
Run configuration-
- Source mode: Auto
- Repository: meshtastic/Meshtastic-Android
- Branch: feat/own-node-traced-by
- File: .coderabbit.yaml
- Commit: 2ce6911
- Layers: Repository YAML
- Review profile: CHILL
- Plan: Advanced
- Run ID:
74cbcb40-e875-458f-a50c-c3356c5693e0
Files selected for processing: 8-
core/data/src/commonMain/kotlin/org/meshtastic/core/data/repository/MeshLogRepositoryImpl.ktcore/database/src/commonMain/kotlin/org/meshtastic/core/database/dao/MeshLogDao.ktcore/database/src/commonTest/kotlin/org/meshtastic/core/database/dao/MeshLogDaoTest.ktcore/repository/src/commonMain/kotlin/org/meshtastic/core/repository/MeshLogRepository.ktcore/testing/src/commonMain/kotlin/org/meshtastic/core/testing/FakeMeshLogRepository.ktfeature/node/src/commonMain/kotlin/org/meshtastic/feature/node/component/TelemetricActionsSection.ktfeature/node/src/commonMain/kotlin/org/meshtastic/feature/node/domain/usecase/CommonGetNodeDetailsUseCase.ktfeature/node/src/commonTest/kotlin/org/meshtastic/feature/node/domain/usecase/TracerouteHistoryUseCaseTest.kt
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
-
Traceroutes other nodes run to us are logged under each tracer, so the only way to see who traced you was to open every node's page. Our own node now lists them all, as suggested in #android.
🌟 New Features
🛠️ Refactoring & Architecture
MeshLogDao.getLogsOnPortandMeshLogRepository.getInboundRequestLogsread one port's logs across all other nodes. Only the local node's page queries it. TheLIMITofDEFAULT_MAX_LOGS(5000) applies before thewant_responsefilter, because that flag lives in the stored proto - the per-node page has the same bound.Testing Performed
TracerouteHistoryUseCaseTest: our own history gathers traces from two nodes, newest first, and ignores one addressed elsewhere.MeshLogDaoTest:getLogsOnPortspans nodes, skips the excluded node and other ports.kmpSmokeCompileand-PwarningsAsErrors=truegreen except the knownTakCertificateGeneratorTesttimeout incore:takserver, which this change doesn't touch.Summary by CodeRabbit