Skip to content

fix(mesh): Set from field in locally handled packets#4543

Merged
jamesarich merged 2 commits into
mainfrom
fix/local-position
Feb 12, 2026
Merged

fix(mesh): Set from field in locally handled packets#4543
jamesarich merged 2 commits into
mainfrom
fix/local-position

Conversation

@jamesarich

Copy link
Copy Markdown
Collaborator

This pull request makes several improvements to how mesh packets are constructed and logged, ensuring that the sender information is correctly set and enhancing debug logging for packet handling.

Enhancements to packet construction:

  • Updated the MeshPacket creation in MeshCommandSender.kt to explicitly set the from field using the current node number, ensuring accurate sender identification in outgoing packets.
  • Modified the MeshPacket creation in MeshHistoryManager.kt to include the from field with the current node number, improving consistency in packet metadata.

Logging improvements:

  • Enhanced debug logging in PacketHandler.kt to include the sender node number (fromNum) when logging packet insertion, providing more detailed information for troubleshooting.

This commit ensures that the `from` field is correctly populated in `MeshPacket` instances that are generated and handled locally by the device.

Specifically, the changes are:
- In `MeshHistoryManager`, the `from` field is set to `myNodeNum` for store-and-forward requests.
- In `MeshCommandSender`, the `from` field is set using `nodeManager?.myNodeNum` when creating various mesh packets.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit enhances debugging by re-enabling a log message that was previously commented out. The new log message, now at the `debug` level, records the insertion of a mesh packet into the database.

To provide more context, the log message now includes the sender's node ID (`fromNum`), in addition to the message type and a one-line representation of the raw message. This helps in tracing the origin of packets during debugging.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
@jamesarich jamesarich enabled auto-merge February 12, 2026 13:58
@github-actions github-actions Bot added the bugfix PR tag label Feb 12, 2026
@jamesarich jamesarich added this pull request to the merge queue Feb 12, 2026
@codecov

codecov Bot commented Feb 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@62daf2e). Learn more about missing BASE report.
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
.../java/com/geeksville/mesh/service/PacketHandler.kt 0.00% 3 Missing ⚠️
...a/com/geeksville/mesh/service/MeshCommandSender.kt 0.00% 0 Missing and 1 partial ⚠️
.../com/geeksville/mesh/service/MeshHistoryManager.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4543   +/-   ##
=======================================
  Coverage        ?   14.43%           
=======================================
  Files           ?      424           
  Lines           ?    14518           
  Branches        ?     2411           
=======================================
  Hits            ?     2095           
  Misses          ?    12119           
  Partials        ?      304           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Merged via the queue into main with commit ed746a1 Feb 12, 2026
9 checks passed
@jamesarich jamesarich deleted the fix/local-position branch February 12, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant