Skip to content

Handle Node serial transport disconnects as status events - #1431

Open
rcarteraz with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-build-and-package-job
Open

rcarteraz with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-build-and-package-job

Conversation

Copilot AI commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Description

build-and-package was failing on a single transport-node-serial contract test: an underlying serial-port error was escaping as a fatal stream error instead of being surfaced as a disconnect status. This change aligns serial transport behavior with the existing Node socket transport so link drops are reported as DeviceDisconnected events.

Related Issues

N/A

Changes Made

  • Transport error handling

    • Track terminal port error state in TransportNodeSerial
    • On serial error, tear down the port and emit DeviceDisconnected("port-error")
    • Treat read-loop termination after a port error as graceful stream closure instead of propagating a public read failure
  • Disconnect signal consistency

    • Suppress follow-on write-pipe disconnect handling once the port is already marked errored
    • Keep disconnect semantics consistent with packages/transport-node/src/transport.ts
  • Regression coverage

    • Add a focused test for the port-error path to verify consumers observe a disconnect status event
this.port.on("error", (err) => {
  this.errored = true;
  this.port?.removeAllListeners();
  this.port?.destroy();

  if (!this.closingByUser) {
    this.emitStatus(DeviceStatusEnum.DeviceDisconnected, "port-error");
  }
});

Testing Done

Added targeted regression coverage for the serial-port error disconnect path in packages/transport-node-serial/src/transport.test.ts.

Screenshots (if applicable)

N/A

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)

@vercel

vercel Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
web-test Ready Ready Preview Sep 10, 2026 9:15pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 95ba1b6b-288d-4e2f-ae7f-caa28c0e06e4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-authored-by: rcarteraz <6912600+rcarteraz@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions job build-and-package Handle Node serial transport disconnects as status events Sep 10, 2026
Copilot AI requested a review from rcarteraz September 10, 2026 21:17
@rcarteraz
rcarteraz marked this pull request as ready for review September 10, 2026 21:34
@rcarteraz
rcarteraz enabled auto-merge September 10, 2026 21:36

@danditomaso danditomaso left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the PR. Fundamentally I'm always against error booleans because it makes impossible states possible. A better approach is to expand the enum to include the generic error and base the UI on that.

Impossible state would be something like:
{
hasErrored:true
statusEnum: "success"

}

This branch was successfully deployed

1 active deployment
Preview – web-test — 24b4ed9e Deployed Sep 10, 2026 by vercel[bot]
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