Skip to content

feat(cells): Remove legacy non-org-scoped accept invite API route#112767

Merged
lynnagara merged 3 commits intomasterfrom
remove-legacy-org-invite-api
Apr 13, 2026
Merged

feat(cells): Remove legacy non-org-scoped accept invite API route#112767
lynnagara merged 3 commits intomasterfrom
remove-legacy-org-invite-api

Conversation

@lynnagara
Copy link
Copy Markdown
Member

@lynnagara lynnagara commented Apr 12, 2026

The /api/0/accept-invite/{member_id}/{token}/ required no organization context, relying on a cell mapping lookup to determine the org. The org-scoped /api/0/accept-invite/{organization_id_or_slug}/{member_id}/{token}/ is now the only supported route.

This PR removes the legacy API route and any references to it:

  • Remove the URL pattern from api/urls.py
  • Remove the legacy pattern from controlsiloUrlPatterns.ts (regenerated)
  • Remove the legacy type from knownSentryApiUrls.generated.ts (regenerated)
  • Remove entries from the apidocs ownership and publish status allowlists

It also cleans up AcceptOrganizationInvite and get_invite_state now that organization_id_or_slug is always provided:

  • Fix member_id and organization_id_or_slug type annotations in convert_args and get() to the proper type, django passes kwargs as strings
  • Drop int | str from organization_id_or_slug since no caller ever passes an integer
  • Remove redundant str() wrapping on .isdecimal() call
  • Remove dead not request.user.is_authenticated branch in post()
  • Add TODO to further narrow type and remove None from get_invite_state once the temporary redirect is cleaned up

Removing this route is harmless as the web UI has been previously updated to always
use the new url in #112634. This is effectively dead code.

This is not a public URL that requires a formal deprecation process.

The /api/0/accept-invite/{member_id}/{token}/ endpoint required no organization
context, relying on a cell mapping lookup to determine the org. The org-scoped
/api/0/accept-invite/{organization_id_or_slug}/{member_id}/{token}/ is now the
only supported cell-safe route.

This PR removes the legacy API route and any references to it:
- Remove the URL pattern from api/urls.py
- Remove the legacy pattern from controlsiloUrlPatterns.ts (regenerated)
- Remove the legacy type from knownSentryApiUrls.generated.ts (regenerated)
- Remove entries from the apidocs ownership and publish status allowlists

Removing this route is harmless as the web UI has been updated to always use the
new url in #112634. This is not a public
URL that requires a formal deprecation process.
@lynnagara lynnagara requested review from a team as code owners April 12, 2026 20:39
@github-actions github-actions bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels Apr 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

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 prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Tests reference removed URL name causing NoReverseMatch failures
    • Updated the invite acceptance tests to remove all reverse() calls to the deleted route and consistently use the remaining organization-scoped URL pattern.

Create PR

Or push these changes by commenting:

@cursor push 7de1168e85
Preview (7de1168e85)
diff --git a/tests/sentry/api/endpoints/test_accept_organization_invite.py b/tests/sentry/api/endpoints/test_accept_organization_invite.py
--- a/tests/sentry/api/endpoints/test_accept_organization_invite.py
+++ b/tests/sentry/api/endpoints/test_accept_organization_invite.py
@@ -36,7 +36,6 @@
 
     def _get_paths(self, args):
         return (
-            reverse("sentry-api-0-accept-organization-invite", args=args),
             reverse(
                 "sentry-api-0-organization-accept-organization-invite",
                 args=[self.organization.slug] + args,
@@ -49,15 +48,16 @@
 
     def _get_urls(self):
         return (
-            "sentry-api-0-accept-organization-invite",
+            self.organization.slug,
+            self.organization.id,
+        )
+
+    def _get_path(self, organization_id_or_slug, args):
+        return reverse(
             "sentry-api-0-organization-accept-organization-invite",
+            args=[organization_id_or_slug] + args,
         )
 
-    def _get_path(self, url, args):
-        if url == self._get_urls()[0]:
-            return reverse(url, args=args)
-        return reverse(url, args=[self.organization.slug] + args)
-
     def _require_2fa_for_organization(self):
         with assume_test_silo_mode_of(Organization):
             self.organization.update(flags=F("flags").bitor(Organization.flags.require_2fa))
@@ -205,7 +205,10 @@
 
         with override_settings(SILO_MODE=SiloMode.CONTROL, SENTRY_MONOLITH_REGION="something-else"):
             resp = self.client.get(
-                reverse("sentry-api-0-accept-organization-invite", args=[om.id, om.token])
+                reverse(
+                    "sentry-api-0-organization-accept-organization-invite",
+                    args=[self.organization.id, om.id, om.token],
+                )
             )
         assert resp.status_code == 400

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e04da93. Configure here.

Comment thread src/sentry/api/urls.py
Comment thread src/sentry/api/urls.py
Comment on lines 3783 to 3787
name="sentry-api-0-data-export-notifications",
),
re_path(
r"^accept-invite/(?P<member_id>[^/]+)/(?P<token>[^/]+)/$",
AcceptOrganizationInvite.as_view(),
name="sentry-api-0-accept-organization-invite",
),
re_path(
r"^notification-defaults/$",
NotificationDefaultsEndpoints.as_view(),
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.

Bug: The removal of the sentry-api-0-accept-organization-invite URL pattern will cause tests to fail, as they still try to reverse this URL name.
Severity: CRITICAL

Suggested Fix

Update the tests in tests/sentry/api/endpoints/test_accept_organization_invite.py that rely on the removed URL name sentry-api-0-accept-organization-invite. They should be modified to use the new URL pattern's name or structure to generate the correct URLs, ensuring they align with the updated routing configuration.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/sentry/api/urls.py#L3783-L3787

Potential issue: The removal of the URL pattern named
`sentry-api-0-accept-organization-invite` will cause a
`django.urls.exceptions.NoReverseMatch` exception during test execution. Multiple tests
in `tests/sentry/api/endpoints/test_accept_organization_invite.py` still use
`reverse("sentry-api-0-accept-organization-invite", ...)` to generate URLs for API
calls. This affects the `_get_paths` method and the
`test_multi_region_organizationmember_id__non_monolith` test, among others, which will
lead to widespread test failures and block the CI pipeline.

Did we get this right? 👍 / 👎 to inform future reviews.

The /api/0/accept-invite/{member_id}/{token}/ endpoint required no organization
context, relying on a cell mapping lookup to determine the org. The org-scoped
/api/0/accept-invite/{organization_id_or_slug}/{member_id}/{token}/ is now the
only supported cell-safe route.

This PR removes the legacy API route and any references to it:
- Remove the URL pattern from api/urls.py
- Remove the legacy pattern from controlsiloUrlPatterns.ts (regenerated)
- Remove the legacy type from knownSentryApiUrls.generated.ts (regenerated)
- Remove entries from the apidocs ownership and publish status allowlists

Removing this route is harmless as the web UI has been updated to always use the
new url in #112634. This is not a public
URL that requires a formal deprecation process.
@github-actions
Copy link
Copy Markdown
Contributor

Backend Test Failures

Failures on e8bdf28 in this run:

tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_2fa_cookie_deleted_after_acceptlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:422: in test_2fa_cookie_deleted_after_accept
    path = self._get_path(url, [om.id, om.token])
tests/sentry/api/endpoints/test_accept_organization_invite.py:58: in _get_path
    return reverse(url, args=args)
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_can_accept_when_user_has_2falog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:370: in test_can_accept_when_user_has_2fa
    path = self._get_path(url, [om.id, om.token])
tests/sentry/api/endpoints/test_accept_organization_invite.py:58: in _get_path
    return reverse(url, args=args)
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_can_accept_while_authenticatedlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:255: in test_can_accept_while_authenticated
    path = self._get_path(url, [om.id, om.token])
tests/sentry/api/endpoints/test_accept_organization_invite.py:58: in _get_path
    return reverse(url, args=args)
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_cannot_accept_expiredlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:287: in test_cannot_accept_expired
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_cannot_accept_unapproved_invitelog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:306: in test_cannot_accept_unapproved_invite
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_cannot_accept_when_user_needs_2falog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:399: in test_cannot_accept_when_user_needs_2fa
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_invalid_member_idlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:82: in test_invalid_member_id
    for path in self._get_paths([1, 2]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_invalid_tokenlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:90: in test_invalid_token
    for path in self._get_paths([om.id, 2]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_invite_not_pendinglog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:97: in test_invite_not_pending
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_invite_unapprovedlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:108: in test_invite_unapproved
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_member_already_existslog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:329: in test_member_already_exists
    path = self._get_path(url, [om.id, om.token])
tests/sentry/api/endpoints/test_accept_organization_invite.py:58: in _get_path
    return reverse(url, args=args)
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_multi_region_organizationmember_idlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:183: in test_multi_region_organizationmember_id
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_multi_region_organizationmember_id__non_monolithlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:208: in test_multi_region_organizationmember_id__non_monolith
    reverse("sentry-api-0-accept-organization-invite", args=[om.id, om.token])
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_needs_authenticationlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:116: in test_needs_authentication
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_not_needs_authenticationlog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:127: in test_not_needs_authentication
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_user_can_use_ssolog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:235: in test_user_can_use_sso
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_user_has_2falog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:221: in test_user_has_2fa
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.
tests/sentry/api/endpoints/test_accept_organization_invite.py::AcceptInviteTest::test_user_needs_2falog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/api/endpoints/test_accept_organization_invite.py:142: in test_user_needs_2fa
    for path in self._get_paths([om.id, om.token]):
tests/sentry/api/endpoints/test_accept_organization_invite.py:39: in _get_paths
    reverse("sentry-api-0-accept-organization-invite", args=args),
.venv/lib/python3.13/site-packages/django/urls/base.py:98: in reverse
    resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
.venv/lib/python3.13/site-packages/django/urls/resolvers.py:831: in _reverse_with_prefix
    raise NoReverseMatch(msg)
E   django.urls.exceptions.NoReverseMatch: Reverse for 'sentry-api-0-accept-organization-invite' not found. 'sentry-api-0-accept-organization-invite' is not a valid view function or pattern name.

Comment on lines -270 to +271
elif not request.user.is_authenticated or not helper.valid_request:
elif not helper.valid_request:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For others - helper.valid_request contains a user.is_authenticated check as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This function also returns early a few lines above if not request.user.is_authenticated

@lynnagara lynnagara merged commit 12f6e6a into master Apr 13, 2026
60 checks passed
@lynnagara lynnagara deleted the remove-legacy-org-invite-api branch April 13, 2026 21:03
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 Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants