Skip to content

ref(cells): Update assert_webhook_payloads_for_mailbox#111856

Merged
lynnagara merged 8 commits intomasterfrom
webhook-payload-helper
Mar 31, 2026
Merged

ref(cells): Update assert_webhook_payloads_for_mailbox#111856
lynnagara merged 8 commits intomasterfrom
webhook-payload-helper

Conversation

@lynnagara
Copy link
Copy Markdown
Member

more region to cell renaming

@lynnagara lynnagara requested a review from a team March 30, 2026 22:08
@lynnagara lynnagara requested a review from a team as a code owner March 30, 2026 22:08
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 30, 2026

Backend Test Failures

Failures on 31886c3 in this run:

tests/sentry/middleware/integrations/parsers/test_github.py::GithubRequestParserTest::test_webhook_for_codecov_no_cellslog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/middleware/integrations/parsers/test_github.py:233: in test_webhook_for_codecov_no_cells
    assert_webhook_payloads_for_mailbox(
src/sentry/testutils/outbox.py:83: in assert_webhook_payloads_for_mailbox
    cell_names_set = set(cell_names or region_names)
E   TypeError: 'NoneType' object is not iterable

During handling of the above exception, another exception occurred:
tests/sentry/middleware/integrations/parsers/test_github.py:229: in test_webhook_for_codecov_no_cells
    with pytest.raises(
E   AssertionError: Regex pattern did not match.
E    Regex: 'Missing 1 WebhookPayloads for codecov'
E    Input: "'NoneType' object is not iterable"
tests/sentry/middleware/integrations/parsers/test_github.py::GithubRequestParserTypeRoutingTest::test_webhook_no_codecov_payload_when_forwarding_disabledlog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/middleware/integrations/parsers/test_github.py:274: in test_webhook_no_codecov_payload_when_forwarding_disabled
    assert_webhook_payloads_for_mailbox(
src/sentry/testutils/outbox.py:83: in assert_webhook_payloads_for_mailbox
    cell_names_set = set(cell_names or region_names)
E   TypeError: 'NoneType' object is not iterable

During handling of the above exception, another exception occurred:
tests/sentry/middleware/integrations/parsers/test_github.py:270: in test_webhook_no_codecov_payload_when_forwarding_disabled
    with pytest.raises(
E   AssertionError: Regex pattern did not match.
E    Regex: 'Missing 1 WebhookPayloads for codecov'
E    Input: "'NoneType' object is not iterable"
tests/sentry/middleware/integrations/parsers/test_github.py::GithubRequestParserTypeRoutingTest::test_webhook_for_codecovlog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/middleware/integrations/parsers/test_github.py:193: in test_webhook_for_codecov
    assert_webhook_payloads_for_mailbox(
src/sentry/testutils/outbox.py:83: in assert_webhook_payloads_for_mailbox
    cell_names_set = set(cell_names or region_names)
E   TypeError: 'NoneType' object is not iterable
tests/sentry/middleware/integrations/parsers/test_github.py::GithubRequestParserTest::test_webhook_for_codecovlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/middleware/integrations/parsers/test_github.py:193: in test_webhook_for_codecov
    assert_webhook_payloads_for_mailbox(
src/sentry/testutils/outbox.py:83: in assert_webhook_payloads_for_mailbox
    cell_names_set = set(cell_names or region_names)
E   TypeError: 'NoneType' object is not iterable
tests/sentry/middleware/integrations/parsers/test_github.py::GithubRequestParserTest::test_webhook_no_codecov_payload_when_forwarding_disabledlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/middleware/integrations/parsers/test_github.py:274: in test_webhook_no_codecov_payload_when_forwarding_disabled
    assert_webhook_payloads_for_mailbox(
src/sentry/testutils/outbox.py:83: in assert_webhook_payloads_for_mailbox
    cell_names_set = set(cell_names or region_names)
E   TypeError: 'NoneType' object is not iterable

During handling of the above exception, another exception occurred:
tests/sentry/middleware/integrations/parsers/test_github.py:270: in test_webhook_no_codecov_payload_when_forwarding_disabled
    with pytest.raises(
E   AssertionError: Regex pattern did not match.
E    Regex: 'Missing 1 WebhookPayloads for codecov'
E    Input: "'NoneType' object is not iterable"

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

"""
expected_payload = WebhookPayload.get_attributes_from_request(request=request)
region_names_set = set(region_names)
cell_names_set = set(cell_names or region_names or [])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Falsy-check on cell_names ignores explicit empty list

Low Severity

The expression cell_names or region_names or [] uses Python's truthiness check, which treats an empty list [] the same as None. If a caller explicitly passes cell_names=[] (meaning "expect no cells") while getsentry simultaneously passes region_names=["us"] during the transition period, the empty cell_names would be silently ignored and region_names would be used instead. Using cell_names if cell_names is not None else (region_names if region_names is not None else []) would correctly distinguish "not provided" from "explicitly empty." Current in-repo callers aren't affected because they never pass both parameters, but this could bite getsentry callers during the synchronization window.

Fix in Cursor Fix in Web

@lynnagara lynnagara merged commit 506d7d9 into master Mar 31, 2026
103 checks passed
@lynnagara lynnagara deleted the webhook-payload-helper branch March 31, 2026 18:14
dashed pushed a commit that referenced this pull request Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants