Skip to content

fix: consistent hashing and equality for RabbitMQ schemas#2796

Open
RinZ27 wants to merge 2 commits intoag2ai:mainfrom
RinZ27:fix/rmq-schemas-identity-final
Open

fix: consistent hashing and equality for RabbitMQ schemas#2796
RinZ27 wants to merge 2 commits intoag2ai:mainfrom
RinZ27:fix/rmq-schemas-identity-final

Conversation

@RinZ27
Copy link
Copy Markdown

@RinZ27 RinZ27 commented Mar 5, 2026

Description

Consistent hashing and equality logic for RabbitMQ schemas (Queue, Exchange, and Channel). These changes allow schema objects to be used correctly in sets or as dictionary keys, which is essential for the internal declarer cache and prevents redundant declarations.

The robust parameter is now excluded from identity checks (__eq__ and __hash__) as requested, ensuring that connection-level properties do not affect the schema's unique identity.

Relates to #2791 (replacement for the closed PR)

Type of change

  • Bug fix (a non-breaking change that resolves an issue)
  • New feature (a non-breaking change that adds functionality)

Checklist

  • My code adheres to the style guidelines of this project
  • I have conducted a self-review of my own code
  • I have made the necessary changes to the documentation
  • My changes do not generate any new warnings
  • I have added tests to validate the effectiveness of my fix or the functionality of my new feature
  • Both new and existing unit tests pass successfully on my local environment
  • I have ensured that static analysis tests are passing
  • I have included code examples to illustrate the modifications

@RinZ27 RinZ27 requested a review from Lancetnik as a code owner March 5, 2026 02:58
@RinZ27 RinZ27 force-pushed the fix/rmq-schemas-identity-final branch from f1d1cd2 to d383d1a Compare March 5, 2026 03:00
@RinZ27 RinZ27 force-pushed the fix/rmq-schemas-identity-final branch from d383d1a to f1bacfa Compare March 6, 2026 03:19
@github-actions github-actions bot added the github_actions Pull requests that update GitHub Actions code label Mar 6, 2026
@RinZ27
Copy link
Copy Markdown
Author

RinZ27 commented Mar 6, 2026

Explicitly defined __eq__ for the Channel schema to ensure consistency with the updated hashing logic.

Modified test_subscriber_use_shared_channel to use a unique channel_number for sub2. Since the new hash logic correctly identifies default Channel() instances as identical (which is the goal of this PR), providing a distinct property is now required to verify that the broker can still handle multiple independent channels when configured to do so.

Additionally, included the missing on: push trigger in the CodeQL workflow to resolve the baseline security scanning alerts previously seen in the actions tab.

@RinZ27 RinZ27 requested a review from Sehat1137 as a code owner March 8, 2026 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant