Repository navigation
Fix 1988 - #1989
Merged
Merged
Fix 1988#1989
Conversation
Add src/autobahn/wamp/test/test_wamp_payload_codec_error.py, which runs on both backends (trial with USE_TWISTED, pytest with USE_ASYNCIO): an ApplicationSession with a payload codec whose encode() raises must re-raise the codec's exception from call(), and send nothing. session.log is not mocked on purpose - a Mock has every method, so it would hide a logger method that one backend lacks. On Twisted the error is logged as a Failure by log.failure(), which trial reports as a test error; the test flushes it (trial TestCase only), since Twisted is not affected by crossbario#1988. Defect shown: on asyncio, call() raises AttributeError ("'_TxaioLogWrapper' object has no attribute 'failure'") from wamp/protocol.py:1950 instead of the codec's exception. Local (asgard1): cpy314 + pypy311 - trial PASSED, pytest FAILED with that AttributeError. Expected CI result: RED - the asyncio/pytest runs (unit-tests on all five Pythons, quality-checks) fail in test_call_reraises_payload_codec_error; the Twisted/trial runs and all other jobs are green. Note: This work was completed with AI assistance (Claude Code).
…hecker The red commit 78b4d55 failed check-typing (ty, quality-checks job): the test class used a base class chosen at import time (twisted.trial.unittest.TestCase or unittest.TestCase), which ty sees as a union type it cannot use as a base ("unsupported-base"). I had not run `just check-typing` before pushing it. Now the test body is a module-level function taking a unittest.TestCase, called from one class per backend: a trial TestCase under USE_TWISTED (it flushes the logged CodecError, as before), a stdlib TestCase otherwise. The test itself is unchanged. Local (asgard1): `just check-typing cpy314` passes; cpy314 + pypy311 - trial PASSED, pytest FAILED with the AttributeError from wamp/protocol.py:1950 (the crossbario#1988 defect). Expected CI result: RED - only the asyncio/pytest runs (unit-tests on all five Pythons, quality-checks) fail in test_call_reraises_payload_codec_error; check-typing, the trial runs and all other jobs are green. Note: This work was completed with AI assistance (Claude Code).
…ackends ApplicationSession.call() logged a payload codec failure with self.log.failure(), which only the Twisted logger has: on asyncio the except block itself raised AttributeError, so the codec's exception was neither logged nor raised to the caller. Log it with log.error() and the traceback from txaio.failure_format_traceback(txaio.create_failure()) - the same pattern as the crossbario#1986 asyncio receive-path fix - which works on both backends, then re-raise. The other log.failure() calls in the code base are in Twisted-only modules (autobahn/twisted/...); wamp/protocol.py had only this one. Changelog bullet in the asyncio group. Local (asgard1): full matrix green, 20/20 (cpy311-314 + pypy311 x trial/pytest x NVX on/off), one more test passing per run than before; the asyncio log line shows the procedure and the codec's traceback. Re-run after red (2) restructured the test: still 20/20. ruff check and `just check-typing cpy314` (ty) pass. Expected CI result: GREEN - all jobs, including test_call_reraises_payload_codec_error on both backends. Note: This work was completed with AI assistance (Claude Code).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #1988