Fix hashing and equality consistency in RabbitMQ schemas#2791
Closed
RinZ27 wants to merge 1 commit intoag2ai:mainfrom
Closed
Fix hashing and equality consistency in RabbitMQ schemas#2791RinZ27 wants to merge 1 commit intoag2ai:mainfrom
RinZ27 wants to merge 1 commit intoag2ai:mainfrom
Conversation
939c1ba to
61b9934
Compare
Lancetnik
requested changes
Mar 2, 2026
| and self.routing_key == value.routing_key | ||
| and self.durable == value.durable | ||
| and self.auto_delete == value.auto_delete | ||
| and self.robust == value.robust |
| self.routing_key, | ||
| self.durable, | ||
| self.auto_delete, | ||
| self.robust, |
faststream/rabbit/schemas/queue.py
Outdated
| and self.durable == value.durable | ||
| and self.exclusive == value.exclusive | ||
| and self.auto_delete == value.auto_delete | ||
| and self.robust == value.robust |
faststream/rabbit/schemas/queue.py
Outdated
| self.durable, | ||
| self.exclusive, | ||
| self.auto_delete, | ||
| self.robust, |
Member
There was a problem hiding this comment.
Please, revert this file changes
61b9934 to
39deb22
Compare
Author
|
@Lancetnik I'm very sorry for the mess in the previous push. My local environment was misconfigured, which caused an accidental push of thousands of unrelated files. I have strictly cleaned up the branch now. It contains only the 3 relevant schema files with consistent hashing/equality logic and the removal of the Could you please reopen the PR? I promise it's clean and focused now. Thank you for your patience! |
Member
|
@RinZ27 sorry, I can't reopen it - the button is disabled. But, you can open an another one, it's not a problem |
10 tasks
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.
Description
Addressing the architectural inconsistency in RabbitMQ schemas where
__eq__and__hash__were out of sync. This fix ensures thatRabbitQueue,RabbitExchange, andChannelobjects behave correctly when used in dictionaries or sets, which is critical for theRabbitDeclarercaching mechanism.Previously,
RabbitQueueandRabbitExchangeinherited__eq__fromNameRequired(comparing only by name), while their__hash__methods included multiple other attributes (likedurable,auto_delete, etc.). This violation of the Python data model could lead to cache misses or incorrect object reuse in the declarer.For the
Channelclass, identity-based hashing was used despite being a dataclass with value-based equality. This has been corrected to use value-based hashing for consistency.Type of change
Checklist
tests/brokers/rabbit/test_schemas.py)