fix(urls): Fix customer domain path regex rejecting org slugs starting with 'new'#109097
Draft
fix(urls): Fix customer domain path regex rejecting org slugs starting with 'new'#109097
Conversation
…g with "new" The `customer_domain_path` regex used `(?\!new)` as a negative lookahead to skip the `/organizations/new/` route (create new org), but this also blocked any org slug starting with "new" (e.g. "newt-corp", "newsletter"). Changed to `(?\!new/)` to only exclude the exact "new" slug. This was the root cause of the flaky test `test_redirect_to_event_customer_domain` which used a randomly generated org name via petname. When the random name happened to start with "new", the redirect URL retained the `/organizations/slug/` prefix instead of stripping it for customer domains. Also pins the test org to a deterministic name to prevent other similar issues from random name generation.
Member
Author
|
why the changes in tests/sentry/web/frontend/test_project_event.py? |
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.
Summary
customer_domain_path()regex insrc/sentry/organizations/absolute_url.pywhere the negative lookahead(?!new)was too broad/organizations/new/(create new org page), but it accidentally excluded any org slug starting with "new" (e.g., "newt-corp", "newsletter")(?!new)to(?!new\/)so only the exact slug "new" followed by "/" is excludedcreate_organization()uses random names viapetname.generate()— when a name starting with "new" was generated,absolute_url()failed to strip the/organizations/{slug}/prefix from the pathTest plan
/organizations/newt-corp/issues/→/issues//organizations/new/→/organizations/new/still passesFixes #109061