Skip to content

Validate RFC 2217 settings before sending any of them - #161

Open
Happyfield7 wants to merge 1 commit into
puddly:devfrom
Happyfield7:validate-rfc2217-settings-first
Open

Happyfield7 wants to merge 1 commit into
puddly:devfrom
Happyfield7:validate-rfc2217-settings-first

Conversation

@Happyfield7

Copy link
Copy Markdown
Contributor

Problem

The RFC 2217 backend builds the configuration commands lazily and sends each one before the next field is checked. reconfigure_port(baudrate=19200, byte_size=9) therefore gets SET-BAUDRATE acknowledged by the server and only then raises UnsupportedSetting for the byte size: the call fails, but the port already runs at 19200. Checked against ser2net 4.6 over a pty, sync and async.

Change

RFC2217Serial._build_port_config_commands() builds the full command tuple before anything is sent, so a rejected setting fails before the first command goes out. The order of the commands is unchanged, and the sync and async paths both use it.

Testing

A small RFC 2217 server in the tests records the commands it receives; sync and async tests check that a rejected byte size sends nothing. Both fail without the change. Full suite passes on macOS and Debian sid, and the ser2net reproduction keeps the line at 9600 with the change.

@codecov

codecov Bot commented Nov 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.39%. Comparing base (2c500d7) to head (791f48a).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #161      +/-   ##
==========================================
+ Coverage   94.38%   94.39%   +0.01%     
==========================================
  Files          25       25              
  Lines        4437     4446       +9     
==========================================
+ Hits         4188     4197       +9     
  Misses        249      249              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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.

1 participant