Skip to content

Add transport status events#790

Merged
danditomaso merged 11 commits into
meshtastic:mainfrom
philon-:transport-status
Aug 24, 2025
Merged

Add transport status events#790
danditomaso merged 11 commits into
meshtastic:mainfrom
philon-:transport-status

Conversation

@philon-

@philon- philon- commented Aug 18, 2025

Copy link
Copy Markdown
Contributor

Description

This PR adds transport status events, transport tests and transport symbol docs.

Related Issues

Changes Made

Tests:

  • Updated vitest config to allow the use of pnpm run test in both ./ and packages/web
  • Created common ./tests/utils/transportContract.ts helper for common transport test cases (read/write, disconnect, link drop)

core:

  • Extended DeviceOutput with StatusEvent packet type
  • Added packet decode route for status packets, calling device.updateDeviceStatus which dispatches onDeviceStatus events

transport-http:

  • Fixed buffer typing issue
  • Handle timeouts better (read timeout 7s, write timeout 4s)
  • Emit connection status packets
  • Update/write symbol docs
  • Extra tests (read timeout, stop polling)

transport-node-serial:

  • Emit connection status packets
  • Update missing symbol docs
  • Extra tests (port closed)

transport-node:

  • Emit connection status packets
  • Update missing symbol docs
  • Extra tests (socket closed)

transport-web-bluetooth:

  • Emit connection status packets
  • Update missing symbol docs

transport-web-serial:

  • Emit connection status packets
  • Update missing symbol docs
  • Extra tests (os disconnect event)

transport-deno has not been updated

Testing Done

Updated automated tests
Tested with HTTP, Web Serial and Web Bluetooth.

nodeJS transports have not been tested (other than with the automated tests)

Screenshots (if applicable)

Checklist

  • Code follows project style guidelines
  • Documentation has been updated or added
  • Tests have been added or updated
  • All i18n translation labels have been added (read
    CONTRIBUTING_I18N_DEVELOPER_GUIDE.md for more details)

Add symbol docs
Emit transport status events
Transport test suite
Copilot AI review requested due to automatic review settings August 18, 2025 11:47
@vercel

vercel Bot commented Aug 18, 2025

Copy link
Copy Markdown

@philon- is attempting to deploy a commit to the Meshtastic Team on Vercel.

A member of the Team first needs to authorize it.

This comment was marked as outdated.

@philon- philon- changed the title Transport status events Add transport status events Aug 18, 2025
Comment thread package.json Outdated
Comment thread packages/transport-http/src/transport.ts Outdated
Comment thread packages/transport-node/src/transport.ts
@philon- philon- marked this pull request as draft August 22, 2025 12:05
@philon- philon- requested a review from Copilot August 22, 2025 12:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds transport status events across all transport implementations to provide better connection monitoring and debugging capabilities. It introduces a standardized approach for transports to emit connection status events through the device output stream.

  • Adds StatusEvent packet type to DeviceOutput and implements status event handling in the core packet decoder
  • Enhances all transport implementations to emit connection status events (connecting, connected, disconnected with reasons)
  • Creates a comprehensive transport contract test suite with common test utilities for all transports

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/utils/transportContract.ts New shared test contract for validating transport implementations
packages/web/vitest.config.ts Updated vitest configuration for better path resolution
packages/transport-web-serial/src/transport.ts Added status events, improved error handling, and comprehensive documentation
packages/transport-web-serial/src/transport.test.ts New test suite using transport contract
packages/transport-web-bluetooth/src/transport.ts Added status events, improved connection lifecycle management
packages/transport-web-bluetooth/src/transport.test.ts New test suite using transport contract
packages/transport-node/src/transport.ts Added status events and improved error handling for TCP connections
packages/transport-node/src/transport.test.ts New test suite using transport contract
packages/transport-node-serial/src/transport.ts Added status events for serial port connections
packages/transport-node-serial/src/transport.test.ts New test suite using transport contract
packages/transport-http/src/transport.ts Enhanced HTTP transport with timeouts and status events
packages/transport-http/src/transport.test.ts New test suite with timeout and polling tests
packages/core/src/utils/transform/decodePacket.ts Added status event handling to packet decoder
packages/core/src/types.ts Extended DeviceOutput with StatusEvent type
.vscode/settings.json Added vitest workspace configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread packages/transport-web-serial/src/transport.ts Outdated
philon- and others added 2 commits August 22, 2025 14:30
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@philon- philon- marked this pull request as ready for review August 22, 2025 12:37
@vercel

vercel Bot commented Aug 23, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
web-test Ready Ready Preview Comment Aug 23, 2025 2:48am

@danditomaso danditomaso merged commit d7e32e9 into meshtastic:main Aug 24, 2025
4 checks passed
@philon- philon- deleted the transport-status branch August 24, 2025 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants