Repository navigation
Closes #23463: Include ObjectChange IDs in event data and webhook payloads - #23497
Merged
Merged
Conversation
- Pass object_change_ids to send_webhook() only when it's non-empty, so job events and no-op saves don't send the new kwarg to older workers - Tolerate queued events which lack an object_change_ids list - Filter ObjectChanges by object type as well as ID in tests
jeremystretch
marked this pull request as ready for review
October 26, 2026 16:37
jeremystretch
requested review from
a team and
bctiemann
and removed request for
a team
October 26, 2026 16:37
pheus
approved these changes
Oct 27, 2026
pheus
left a comment
Contributor
There was a problem hiding this comment.
Thanks! This looks good to me.
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.
Closes: #23463
Queued object events now carry the IDs of the change log records behind them, so webhooks and
EVENTS_PIPELINEconsumers can tie an event to its changelog entries.ObjectChangethey record (or update, for M2M changes) toenqueue_event(), which takes a new optionalobject_change_idargument.object_change_idslist. Changes to the same object within a request are coalesced into one event, so the list can hold several IDs, in the order they were recorded and without duplicates. A save that records no change adds nothing.send_webhook(), which addsobject_change_idsto the webhook context when it's not empty, the same waysnapshotsis handled. Job events never have one.This follows the implementation proposed in the issue, plus the pass-through to webhooks (the issue's diff stops at the event queue). The list is created when an event is first queued, instead of using
setdefault()when events are coalesced.The change is additive:
enqueue_event()andsend_webhook()only gain optional arguments, and webhook jobs already queued before an upgrade still run. The reverse isn't fully covered: a worker still running older code will reject a webhook job that carriesobject_change_ids. To keep that window small, the argument is only passed when there are IDs to send.Tests: extended the create/update/delete event rule tests to check the IDs against the recorded
ObjectChange. Added tests for a coalesced event (create, update, M2M change and a no-op save in one request), for the webhook body, and for omitting the key when there are no IDs. I also checked it end to end against a scratch instance: created, updated, no-op-updated and deleted a site through the REST API, and in each webhook received,object_change_idsmatched the changelog entry for the same request (the no-op update had none). The full test suite,ruff check,makemigrations --checkand the docs build all pass.