Skip to content

Fix MessageQueueTrigger queue collision with trigger queue assignment - #41

Merged
zach-overflow merged 1 commit into
zo/global-trigger-q-supportfrom
xu/fix-message-queue-trigger-queue-collision
Aug 10, 2026
Merged

Fix MessageQueueTrigger queue collision with trigger queue assignment#41
zach-overflow merged 1 commit into
zo/global-trigger-q-supportfrom
xu/fix-message-queue-trigger-queue-collision

Conversation

@hanxdatadog

Copy link
Copy Markdown

What?

  • Renames MessageQueueTrigger's internal storage for its deprecated queue
    (broker URI) constructor param from self.queue to self.queue_uri, so
    it no longer collides with the new BaseEventTrigger.queue attribute this
    branch introduces for triggerer queue assignment.
  • Adds regression tests confirming the deprecated queue=/scheme=
    constructor params never populate the new triggerer-routing .queue
    attribute.

Why?

MessageQueueTrigger.__init__ unconditionally does self.queue = <broker URI or None>, directly overwriting the queue attribute this branch adds
to BaseTrigger for triggerer-host routing. MessageQueueTrigger backs
essentially every real-world AssetWatcher integration (SQS, Kafka, Redis,
Azure Service Bus, IBM MQ, PubSub via common.messaging) — any Dag still
using the documented-but-deprecated MessageQueueTrigger(queue="https:// sqs.../my-queue") call style would have that URI persisted into
Trigger.queue. Since ids_for_triggerer/get_sorted_triggers filter on
queue IS NULL for any triggerer started without --queues (i.e. every
triggerer today, since --queues requires queues_enabled=True), that
trigger would never be picked up by any triggerer again — silently, with
no error, regardless of whether queues_enabled is even turned on.

Testing

  • 2 existing tests updated to assert on the renamed queue_uri attribute;
    2 new regression tests confirming .queue stays None for both the
    deprecated queue= and the new scheme= construction styles.
  • breeze run pytest providers/common/messaging/tests/unit/common/messaging/triggers/test_msg_queue.py — 20 passed.

Additional Notes

Scoped to MessageQueueTrigger only — confirmed via git grep it's the only
trigger class in the tree that assigns self.queue directly.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

MessageQueueTrigger's deprecated `queue` constructor param (a broker
URI) was stored under self.queue, silently colliding with the new
triggerer-routing `queue` attribute added to BaseTrigger/BaseEventTrigger.
Any Dag still using that deprecated call style would have its
asset-watcher Trigger row's queue column set to the broker URI, and
since every triggerer started without --queues filters on queue IS
NULL, the trigger would never be picked up again, silently.
@zach-overflow
zach-overflow marked this pull request as ready for review August 10, 2026 16:25
@zach-overflow
zach-overflow merged commit b169e5a into zo/global-trigger-q-support Aug 10, 2026
1 check passed
@zach-overflow
zach-overflow deleted the xu/fix-message-queue-trigger-queue-collision branch August 10, 2026 18:25
zach-overflow added a commit that referenced this pull request Aug 10, 2026
PR #41 renamed MessageQueueTrigger's deprecated broker-URI storage from
self.queue to self.queue_uri to avoid colliding with the new
BaseEventTrigger.queue triggerer-routing attribute, but missed this
provider-local test asserting on the old attribute name.
zach-overflow added a commit that referenced this pull request Aug 11, 2026
PR #41 renamed MessageQueueTrigger's deprecated broker-URI storage from
self.queue to self.queue_uri to avoid colliding with the new
BaseEventTrigger.queue triggerer-routing attribute, but missed this
provider-local test asserting on the old attribute name.
zach-overflow added a commit that referenced this pull request Aug 12, 2026
PR #41 renamed MessageQueueTrigger's deprecated broker-URI storage from
self.queue to self.queue_uri to avoid colliding with the new
BaseEventTrigger.queue triggerer-routing attribute, but missed this
provider-local test asserting on the old attribute name.
zach-overflow added a commit that referenced this pull request Aug 19, 2026
PR #41 renamed MessageQueueTrigger's deprecated broker-URI storage from
self.queue to self.queue_uri to avoid colliding with the new
BaseEventTrigger.queue triggerer-routing attribute, but missed this
provider-local test asserting on the old attribute name.
sortega pushed a commit that referenced this pull request Aug 24, 2026
apache#71346)

* Add trigger queue support for `BaseEventTrigger`

* Enable trigger queue support for async callbacks

* Add newsfragment

* Address classattr bug

* Address feedback

* remove unintentional uv.lock metadata addition

* Adjust queue value to accomodate subclasses not calling super().__init__()

* Fix MessageQueueTrigger queue collision with trigger queue assignment

MessageQueueTrigger's deprecated `queue` constructor param (a broker
URI) was stored under self.queue, silently colliding with the new
triggerer-routing `queue` attribute added to BaseTrigger/BaseEventTrigger.
Any Dag still using that deprecated call style would have its
asset-watcher Trigger row's queue column set to the broker URI, and
since every triggerer started without --queues filters on queue IS
NULL, the trigger would never be picked up again, silently.

* Fix IBM MQ test asserting on renamed MessageQueueTrigger attribute

PR #41 renamed MessageQueueTrigger's deprecated broker-URI storage from
self.queue to self.queue_uri to avoid colliding with the new
BaseEventTrigger.queue triggerer-routing attribute, but missed this
provider-local test asserting on the old attribute name.

* Fix compat-test failures from asserting on unreleased MessageQueueTrigger.queue

Provider distributions must keep passing tests against previously
released Airflow versions. BaseEventTrigger.queue is a new attribute
added by this branch, so any Airflow release before it ships doesn't
have the attribute at all, and BaseTrigger has no class-level default
either in those older releases. Assertions on trigger.queue therefore
raised AttributeError under the 3.0.6/3.1.8/3.3.0 compat test jobs.
Guard with getattr(trigger, "queue", None), matching the same pattern
already used for this attribute in airflow.serialization.encoders.

* Let MessageQueueTrigger set the triggerer queue via a distinct parameter

The `queue` constructor keyword is already claimed by the deprecated
broker queue URI, so there was no way for a user to route a
MessageQueueTrigger to a specific triggerer queue via
BaseEventTrigger.queue. Add a `triggerer_queue` parameter that is
forwarded to BaseEventTrigger.__init__ instead.

* Skip triggerer-queue assertions on pre-3.4 Airflow-core in compat tests

BaseEventTrigger.queue is unreleased (targets 3.4.0), so the Compat test
matrix against older published airflow-core wheels fails with
AttributeError when asserting on it directly.

* Revert "Skip triggerer-queue assertions on pre-3.4 Airflow-core in compat tests"

This reverts commit 1993585.

* Let MessageQueueTrigger's trigger queue work on any Airflow-core version, and fix trigger-queue terminology

The previous fix relied on BaseEventTrigger.__init__ to set the queue
attribute, which older published airflow-core releases silently drop,
breaking the Compat test matrix. Storing the value under our own name
and exposing it through a `queue` property/setter works regardless of
the installed core version, so no version-gated tests are needed.

Also corrects "triggerer queue" to "trigger queue" throughout, which is
the term used elsewhere for this concept.

* Undo `uv.lock` extras shift from local `uv run` call.

* remove news fragment

---------

Co-authored-by: Xu Han <xu.han@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants