Repository navigation
Conversation
joshuarli
added a commit
that referenced
this pull request
Nov 18, 2026
…on (#131170) Supersedes #129071. Builds on the outcome-capture idea from #128956, rebased onto current master. `post_and_try_retrieve_event` swallowed the `AssertionError` from the success path. That made every expected Relay rejection wait out the 16s ingest timeout, and let unrelated failures pass as rejections. `post_and_assert_rejected` replaces it. It reads the per-worker `outcomes` topic from the high watermarks captured before the POST, then waits for the outcome Relay emits for the project's org/project/key. It asserts that outcome's type and reason. Relay aggregates outcomes and drops event IDs, so the match uses org/project/key. That's unambiguous because project IDs are snowflakes and each case posts once. <!-- junior-request-attribution:start --> via @joshuarli. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A0647f040aa198c6c1f091bf70f7089e1 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A0647f040aa198c6c1f091bf70f7089e1) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A0647f040aa198c6c1f091bf70f7089e1/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Joshua Li <[email protected]>
This branch was successfully deployed
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.
Why
The existing negative Relay tests call a helper that catches an
AssertionErrorfrom the successful-ingestion path. An expected rejection therefore waits out the roughly 16-second ingestion timeout, and unrelated assertion failures can also look like successful rejection.The post-merge master run shows a 16.54s missing-signature case on backend shard 17, and three filter cases totaling 53.36s on backend shard 5. This patch targets that timeout floor directly.
Changes
OFFSET_ENDonly at first poll.post_and_assert_rejected, which submits a unique event ID, requires the cold asynchronous HTTP 200 response, and waits for the expected rejection outcome while pumping the existing ingestion consumer.Expected outcome reasons are
localhost,browser-extensions,web-crawlers, andlegacy-browsersfor filtered events;invalid_signaturefor untrusted, expired, or invalid signatures; andmissing_signaturefor missing or null signatures.The capture consumer is created only when a negative test invokes it and is closed in a
finallyblock. Kafka errors propagate rather than becoming successful rejection.Validation
git diff --checkpassed.The outcome schema and signature reasons were checked against Relay commit
2419fb638ab8ffb69928f36dfda5cf63da7604a0, particularly the outcome aggregation implementation and trusted-Relay integration tests.CI validation still needed
This workspace has neither Docker nor the running services needed for the real Relay/Kafka integration suite. The real consumer's high-water capture and actual outcome delivery have therefore not been integration-tested here. Normal pytest also encounters Redis-dependent global teardown. The focused mypy attempt failed during Django plugin/stub initialization; it did not establish a passing type check.
Run the normal backend suite, including
tests/relay_integration/test_message_filters.pyandtests/relay_integration/test_integration.py, and inspect all nine converted cases. Expected successful durations should follow actual outcome delivery instead of a fixed ingestion timeout, but no CI speedup is claimed yet. Consumer setup, Kafka polling, and outcome batching remain part of the new cost.