Repository navigation
Deliver asyncio receive errors to buffered readers - #2169
Conversation
AI Review: Deliver asyncio receive errors to buffered readersFindings
Verdictrequest changes |
|
the 2 failing runs are unrelated. |
Signed-off-by: Andrew Jessop <354059055+Solarboaters@users.noreply.github.com>
|
Updated in a4588ea: receive errors now remove the bus reader, and the regression confirms nothing is delivered afterwards. Moved the tests into the existing notifier/listener files and removed the private-reader assertion; 730 tests pass (142 skipped), plus lint and all five mypy targets. No physical CAN hardware tested. |
Summary of Changes
Route
bus.recv()failures in the asyncio file-descriptor callback to listeners'on_errorhandlers, recordingNotifier.exceptionas the threaded path does. Stop watching the failing bus descriptor after a receive error so a disconnected device cannot repeatedly enqueue errors.AsyncBufferedReaderqueues these errors with messages and raises them to the waiting consumer in receive order, instead of leaving it waiting without notification.Related Issues / Pull Requests
Fixes #1865. The inverter/battery disconnection report motivated the reproduction.
Type of Change
Checklist
tox). Equivalent configured commands were run directly: full Python 3.12 suite, plus Black/Ruff/Pylint, all five mypy targets, Sphinx HTML and doctests on Python 3.14. The full tox interpreter/platform matrix was not run.Validation
The original three regressions fail on unchanged main. The revised selector test also fails against the previous PR head because it continues delivering data after the receive error; the update stops reception from that bus. Tests now live in the existing notifier/listener test files and exercise production callbacks with a real socketpair.
Current revision: 27 targeted tests passed, one hardware skip; full Python 3.12 suite: 730 passed, 142 skipped, 49 subtests passed. Black, Ruff, Pylint and all five mypy targets pass. The earlier revision also passed Python 3.14 regressions and documentation builds; those were not rerun locally for this follow-up. Hosted CI is pending on the updated head.
The socketpair simulates the CAN backend's receive error; no physical CAN interface, inverter or battery was tested.