Skip to content

Commit 19c3449

Browse files
committed
Merge remote-tracking branch 'origin/master' into kddubey/issue-summary/thresholds-possible-cause-frontend
2 parents 1fc50e7 + e37eb2e commit 19c3449

File tree

153 files changed

+3775
-1082
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+3775
-1082
lines changed

migrations_lockfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ remote_subscriptions: 0003_drop_remote_subscription
1515

1616
replays: 0004_index_together
1717

18-
sentry: 0822_alert_rule_always_organization
18+
sentry: 0823_projectcodeowners_raw_never_null
1919

2020
social_auth: 0002_default_auto_field
2121

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ ignore_missing_imports = true
118118
module = [
119119
"sentry.api.base",
120120
"sentry.api.bases.organization_events",
121-
"sentry.api.endpoints.codeowners",
122121
"sentry.api.endpoints.event_attachments",
123122
"sentry.api.endpoints.group_integration_details",
124123
"sentry.api.endpoints.group_integrations",

requirements-dev-frozen.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ sentry-cli==2.16.0
186186
sentry-covdefaults-disable-branch-coverage==1.0.2
187187
sentry-devenv==1.14.2
188188
sentry-forked-django-stubs==5.1.2.post1
189-
sentry-forked-djangorestframework-stubs==3.15.2.post1
189+
sentry-forked-djangorestframework-stubs==3.15.2.post2
190190
sentry-forked-email-reply-parser==0.5.12.post1
191191
sentry-kafka-schemas==1.0.2
192192
sentry-ophio==1.0.0

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ packaging>=21.3
3939

4040
# for type checking
4141
sentry-forked-django-stubs>=5.1.2.post1
42-
sentry-forked-djangorestframework-stubs>=3.15.2.post1
42+
sentry-forked-djangorestframework-stubs>=3.15.2.post2
4343
lxml-stubs
4444
msgpack-types>=0.2.0
4545
mypy>=1.14

src/sentry/api/bases/organization.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -661,12 +661,10 @@ def has_release_permission(
661661
actor_id = None
662662
has_perms = None
663663
key = None
664-
if getattr(request, "user", None) and request.user.id:
664+
if request.user.is_authenticated:
665665
actor_id = "user:%s" % request.user.id
666-
if getattr(request, "auth", None) and getattr(request.auth, "id", None):
667-
actor_id = "apikey:%s" % request.auth.id # type: ignore[union-attr]
668-
elif getattr(request, "auth", None) and getattr(request.auth, "entity_id", None):
669-
actor_id = "apikey:%s" % request.auth.entity_id # type: ignore[union-attr]
666+
elif request.auth is not None:
667+
actor_id = "apikey:%s" % request.auth.entity_id
670668
if actor_id is not None:
671669
requested_project_ids = project_ids
672670
if requested_project_ids is None:

src/sentry/api/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import orjson
66
from django.conf import settings
7+
from django.contrib.auth.models import AnonymousUser
78
from django.urls import resolve
89
from rest_framework.test import APIRequestFactory, force_authenticate
910

@@ -79,7 +80,7 @@ def request(
7980
mock_request.superuser = Superuser(mock_request)
8081
else:
8182
mock_request.auth = auth
82-
mock_request.user = user
83+
mock_request.user = user or AnonymousUser()
8384
mock_request.is_sudo = lambda: is_sudo
8485
mock_request.session = {}
8586
mock_request.superuser = Superuser(mock_request)

src/sentry/api/endpoints/codeowners/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from .analytics import * # NOQA
2121

2222

23-
class ProjectCodeOwnerSerializer(CamelSnakeModelSerializer):
23+
class ProjectCodeOwnerSerializer(CamelSnakeModelSerializer[ProjectCodeOwners]):
2424
code_mapping_id = serializers.IntegerField(required=True)
2525
raw = serializers.CharField(required=True)
2626
organization_integration_id = serializers.IntegerField(required=False)
@@ -114,9 +114,9 @@ def update(
114114
if "id" in validated_data:
115115
validated_data.pop("id")
116116
for key, value in validated_data.items():
117-
setattr(self.instance, key, value)
118-
self.instance.save()
119-
return self.instance
117+
setattr(instance, key, value)
118+
instance.save()
119+
return instance
120120

121121

122122
class ProjectCodeOwnersMixin:

src/sentry/api/endpoints/codeowners/index.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ def refresh_codeowners_schema(self, codeowner: ProjectCodeOwners, project: Proje
3232
):
3333
return
3434

35-
if codeowner.raw is None:
36-
return
37-
3835
# Convert raw to issue owners syntax so that the schema can be created
3936
raw = codeowner.raw
4037
associations, _ = validate_codeowners_associations(codeowner.raw, project)

src/sentry/api/endpoints/group_ai_summary.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,18 @@
3333
from rest_framework.request import Request
3434

3535

36+
class SummarizeIssueScores(BaseModel):
37+
possible_cause_confidence: float
38+
possible_cause_novelty: float
39+
40+
3641
class SummarizeIssueResponse(BaseModel):
3742
group_id: str
3843
headline: str
3944
whats_wrong: str | None = None
4045
trace: str | None = None
4146
possible_cause: str | None = None
47+
scores: SummarizeIssueScores | None = None
4248

4349

4450
@region_silo_endpoint

src/sentry/api/endpoints/release_deploys.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,12 @@ def post(self, request: Request, organization, version) -> Response:
124124
if not self.has_release_permission(request, organization, release):
125125
# Logic here copied from `has_release_permission` (lightly edited for results to be more
126126
# human-readable)
127-
auth = None
128-
if getattr(request, "user", None) and request.user.id:
127+
if request.user.is_authenticated:
129128
auth = f"user.id: {request.user.id}"
130-
elif getattr(request, "auth", None) and getattr(request.auth, "id", None):
131-
auth = f"auth.id: {request.auth.id}" # type: ignore[union-attr]
132-
elif getattr(request, "auth", None) and getattr(request.auth, "entity_id", None):
133-
auth = f"auth.entity_id: {request.auth.entity_id}" # type: ignore[union-attr]
129+
elif request.auth is not None:
130+
auth = f"auth.entity_id: {request.auth.entity_id}"
131+
else:
132+
auth = None
134133
if auth is not None:
135134
logging_info.update({"auth": auth})
136135
logger.info(

0 commit comments

Comments
 (0)