Skip to content

Add fixture-driven validation tests for the AMQP 1.0 reader - #125

Merged
Gsantomaggio merged 1 commit into
v2_mainfrom
feat/validate_amqp_messages
Aug 27, 2026
Merged

Add fixture-driven validation tests for the AMQP 1.0 reader#125
Gsantomaggio merged 1 commit into
v2_mainfrom
feat/validate_amqp_messages

Conversation

@Gsantomaggio

Copy link
Copy Markdown
Member

Port the 004_amqp10_validation fixture corpus into tests/unit/resources and add one decode test per fixture (empty message, vbin8/vbin32 body size boundary, large ApplicationProperties maps, Properties+map combos, UUID/unicode fields, nil-amid-mixed-types, exact-match golden message, and rejection of a message with conflicting body sections), mirroring rabbitmq-stream-dotnet-client's Tests/Amqp10Tests.cs approach.

Fix a decoder bug these fixtures surfaced: Decoder._read_compound forced the cursor to start+declared_size after parsing a list/map/array instead of trusting where parsing its self-describing elements actually landed, silently truncating a trailing field whenever a producer's declared size was wrong (message_from_version_1_0_0.amqp undercounts by exactly the count field's width). The declared size is now only used as an upfront overrun guard.

Port the 004_amqp10_validation fixture corpus into tests/unit/resources
and add one decode test per fixture (empty message, vbin8/vbin32 body
size boundary, large ApplicationProperties maps, Properties+map combos,
UUID/unicode fields, nil-amid-mixed-types, exact-match golden message,
and rejection of a message with conflicting body sections), mirroring
rabbitmq-stream-dotnet-client's Tests/Amqp10Tests.cs approach.

Fix a decoder bug these fixtures surfaced: Decoder._read_compound forced
the cursor to start+declared_size after parsing a list/map/array instead
of trusting where parsing its self-describing elements actually landed,
silently truncating a trailing field whenever a producer's declared size
was wrong (message_from_version_1_0_0.amqp undercounts by exactly the
count field's width). The declared size is now only used as an upfront
overrun guard.

Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
@Gsantomaggio Gsantomaggio self-assigned this Aug 27, 2026
@Gsantomaggio Gsantomaggio added enhancement New feature or request v2 V2 version in: https://github.com/rabbitmq/rabbitmq-amqp-python-client/tree/v2_main labels Aug 27, 2026
@Gsantomaggio Gsantomaggio added this to the 2.0.0-alpha.1 milestone Aug 27, 2026
@Gsantomaggio
Gsantomaggio merged commit 5ec0502 into v2_main Aug 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request v2 V2 version in: https://github.com/rabbitmq/rabbitmq-amqp-python-client/tree/v2_main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant