Skip to content

Commit 638df4d

Browse files
committed
Merge branch 'master' into tkdodo/ref/repos-endpoint-to-apiOptions
2 parents ecff2e7 + 010f3aa commit 638df4d

File tree

324 files changed

+5589
-3675
lines changed

Some content is hidden

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

324 files changed

+5589
-3675
lines changed

.github/file-filters.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
sentry_frontend_workflow_file: &sentry_frontend_workflow_file
44
- added|modified: '.github/workflows/frontend.yml'
55

6+
sentry_frontend_snapshots_workflow_file: &sentry_frontend_snapshots_workflow_file
7+
- added|modified: '.github/workflows/frontend-snapshots.yml'
8+
69
# Provides list of changed files to test (jest)
710
# getsentry/sentry does not use the list directly, instead we shard tests inside jest.config.js
811
testable_modified: &testable_modified
@@ -30,6 +33,7 @@ typecheckable_rules_changed: &typecheckable_rules_changed
3033
# Trigger to apply the 'Scope: Frontend' label to PRs
3134
frontend_all: &frontend_all
3235
- *sentry_frontend_workflow_file
36+
- *sentry_frontend_snapshots_workflow_file
3337
- added|modified: '**/*.{ts,tsx,js,jsx,mjs}'
3438
- added|modified: 'static/**/*.{less,json,yml,md,mdx}'
3539
- added|modified: '{vercel,tsconfig,biome,package}.json'

.github/workflows/frontend-snapshots.yml

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -69,37 +69,19 @@ jobs:
6969

7070
- name: Install sentry-cli
7171
if: ${{ !cancelled() }}
72-
run: curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=3.3.4 sh
72+
run: curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=3.3.5 sh
7373

7474
- name: Upload snapshots
7575
id: upload
7676
if: ${{ !cancelled() }}
7777
env:
7878
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_SNAPSHOTS_AUTH_TOKEN }}
79-
run: |
80-
ARGS=(
81-
--log-level=debug
82-
--auth-token "${{ secrets.SENTRY_SNAPSHOTS_AUTH_TOKEN }}"
83-
build snapshots "${{ env.SNAPSHOT_OUTPUT_DIR }}"
84-
--app-id sentry-frontend
85-
--project sentry-frontend
86-
--head-sha "${{ github.event.pull_request.head.sha || github.sha }}"
87-
--vcs-provider github
88-
--head-repo-name "${{ github.repository }}"
89-
)
90-
91-
# PR-only flags: base-sha, base-ref, base-repo-name, head-ref, pr-number
92-
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
93-
ARGS+=(
94-
--base-sha "${{ github.event.pull_request.base.sha }}"
95-
--base-repo-name "${{ github.repository }}"
96-
--head-ref "${{ github.head_ref }}"
97-
--base-ref "${{ github.base_ref }}"
98-
--pr-number "${{ github.event.number }}"
99-
)
100-
fi
101-
102-
sentry-cli "${ARGS[@]}"
79+
run: >
80+
sentry-cli
81+
--log-level=debug
82+
build snapshots "${{ env.SNAPSHOT_OUTPUT_DIR }}"
83+
--app-id sentry-frontend
84+
--project sentry-frontend
10385
10486
- name: Report upload failure to Sentry
10587
if: ${{ failure() && steps.upload.outcome == 'failure' }}

eslint.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ export default typescript.config([
462462
'@sentry/no-flag-comments': 'error',
463463
'@sentry/no-static-translations': 'error',
464464
'@sentry/no-styled-shortcut': 'error',
465+
'@sentry/no-unnecessary-use-callback': 'error',
465466
},
466467
},
467468
{

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ dependencies = [
8787
"sentry-forked-email-reply-parser>=0.5.12.post1",
8888
"sentry-kafka-schemas>=2.1.27",
8989
"sentry-ophio>=1.1.3",
90-
"sentry-protos>=0.8.11",
90+
"sentry-protos>=0.8.12",
9191
"sentry-redis-tools>=0.5.0",
92-
"sentry-relay>=0.9.26",
92+
"sentry-relay>=0.9.27",
9393
"sentry-sdk[http2]>=2.47.0",
9494
"sentry-usage-accountant>=0.0.10",
9595
# remove once there are no unmarked transitive dependencies on setuptools

scripts/routes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ const CONSTANTS: Record<string, string> = {
207207
'IssueTaxonomy.ERRORS_AND_OUTAGES': 'errors-outages',
208208
'IssueTaxonomy.BREACHED_METRICS': 'breached-metrics',
209209
'IssueTaxonomy.WARNINGS': 'warnings',
210+
'IssueTaxonomy.SENTRY_CONFIGURATION': 'sentry-configuration',
210211
};
211212

212213
function resolveTemplate(expr: string): string {

src/sentry/api/serializers/models/organization.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ class BaseOrganizationSerializer(serializers.Serializer):
170170
max_length=DEFAULT_SLUG_MAX_LENGTH,
171171
)
172172

173+
def validate_name(self, value: str) -> str:
174+
if "://" in value:
175+
raise serializers.ValidationError(
176+
"Organization name cannot contain URL schemes (e.g. http:// or https://)."
177+
)
178+
return value
179+
173180
def validate_slug(self, value: str) -> str:
174181
# Historically, the only check just made sure there was more than 1
175182
# character for the slug, but since then, there are many slugs that

src/sentry/billing/platform/services/category_mapping.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@
2727
int(DataCategory.SECURITY): ProtoDataCategory.DATA_CATEGORY_SECURITY,
2828
int(DataCategory.PROFILE_CHUNK): ProtoDataCategory.DATA_CATEGORY_PROFILE_CHUNK,
2929
int(DataCategory.PROFILE_CHUNK_UI): ProtoDataCategory.DATA_CATEGORY_PROFILE_CHUNK_UI,
30+
int(DataCategory.TRANSACTION_PROCESSED): ProtoDataCategory.DATA_CATEGORY_TRANSACTION_PROCESSED,
31+
int(DataCategory.TRANSACTION_INDEXED): ProtoDataCategory.DATA_CATEGORY_TRANSACTION_INDEXED,
32+
int(DataCategory.PROFILE_INDEXED): ProtoDataCategory.DATA_CATEGORY_PROFILE_INDEXED,
33+
int(DataCategory.METRIC_BUCKET): ProtoDataCategory.DATA_CATEGORY_METRIC_BUCKET,
34+
int(DataCategory.ATTACHMENT_ITEM): ProtoDataCategory.DATA_CATEGORY_ATTACHMENT_ITEM,
35+
int(DataCategory.LOG_ITEM): ProtoDataCategory.DATA_CATEGORY_LOG_ITEM,
36+
int(DataCategory.PROFILE_BACKEND): ProtoDataCategory.DATA_CATEGORY_PROFILE_BACKEND,
37+
int(DataCategory.PROFILE_UI): ProtoDataCategory.DATA_CATEGORY_PROFILE_UI,
38+
int(DataCategory.TRACE_METRIC_BYTE): ProtoDataCategory.DATA_CATEGORY_TRACE_METRIC_BYTE,
3039
}
3140

3241

src/sentry/conf/server.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,10 +1205,15 @@ def SOCIAL_AUTH_DEFAULT_USERNAME() -> str:
12051205
"task": "relocation:sentry.relocation.transfer.find_relocation_transfer_region",
12061206
"schedule": crontab("*/5", "*", "*", "*", "*"),
12071207
},
1208+
# TODO(constantinius): Remove fetch-ai-model-costs once all consumers have migrated to fetch-ai-model-metadata
12081209
"fetch-ai-model-costs": {
12091210
"task": "ai_agent_monitoring:sentry.tasks.ai_agent_monitoring.fetch_ai_model_costs",
12101211
"schedule": crontab("*/30", "*", "*", "*", "*"),
12111212
},
1213+
"fetch-ai-model-metadata": {
1214+
"task": "ai_agent_monitoring:sentry.tasks.ai_agent_monitoring.fetch_ai_model_metadata",
1215+
"schedule": crontab("*/30", "*", "*", "*", "*"),
1216+
},
12121217
"llm-issue-detection": {
12131218
"task": "issues:sentry.tasks.llm_issue_detection.run_llm_issue_detection",
12141219
"schedule": crontab("0", "*", "*", "*", "*"),

src/sentry/features/temporary.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,6 @@ def register_temporary_features(manager: FeatureManager) -> None:
337337
manager.add("organizations:seer-issue-view", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
338338
# Enable Autofix to use Seer Explorer instead of legacy Celery pipeline
339339
manager.add("organizations:autofix-on-explorer", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
340-
# Enable Autofix to use Seer Explorer V2 designs
341-
manager.add("organizations:autofix-on-explorer-v2", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
342340
# Enable Seer Workflows in Slack
343341
manager.add("organizations:seer-slack-workflows", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
344342
# Enable Seer Explorer in Slack via @mentions

src/sentry/integrations/github/client.py

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ class GitHubReaction(StrEnum):
9494
EYES = "eyes"
9595

9696

97+
class GitHubApiEndpoint(StrEnum):
98+
COMPARE_COMMITS = "compare_commits"
99+
GET_COMMITS = "get_commits"
100+
GET_COMMIT = "get_commit"
101+
CHECK_FILE = "check_file"
102+
103+
97104
class GithubSetupApiClient(IntegrationProxyClient):
98105
"""
99106
API Client that doesn't require an installation.
@@ -342,7 +349,11 @@ def get_last_commits(self, repo: str, end_sha: str) -> Sequence[Any]:
342349
see https://docs.github.com/en/rest/commits/commits#list-commits-on-a-repository
343350
using end_sha as parameter.
344351
"""
345-
return self.get_cached(f"/repos/{repo}/commits", params={"sha": end_sha})
352+
return self.get_cached(
353+
f"/repos/{repo}/commits",
354+
params={"sha": end_sha},
355+
endpoint=GitHubApiEndpoint.GET_COMMITS,
356+
)
346357

347358
def compare_commits(self, repo: str, start_sha: str, end_sha: str) -> list[Any]:
348359
"""
@@ -352,6 +363,7 @@ def compare_commits(self, repo: str, start_sha: str, end_sha: str) -> list[Any]:
352363
return self._get_with_pagination(
353364
f"/repos/{repo}/compare/{start_sha}...{end_sha}",
354365
response_key="commits",
366+
endpoint=GitHubApiEndpoint.COMPARE_COMMITS,
355367
)
356368

357369
def repo_hooks(self, repo: str) -> Sequence[Any]:
@@ -364,13 +376,15 @@ def get_commits(self, repo: str) -> Sequence[Any]:
364376
"""
365377
https://docs.github.com/en/rest/commits/commits#list-commits
366378
"""
367-
return self.get(f"/repos/{repo}/commits")
379+
return self.get(f"/repos/{repo}/commits", endpoint=GitHubApiEndpoint.GET_COMMITS)
368380

369381
def get_commit(self, repo: str, sha: str) -> Any:
370382
"""
371383
https://docs.github.com/en/rest/commits/commits#get-a-commit
372384
"""
373-
return self.get_cached(f"/repos/{repo}/commits/{sha}")
385+
return self.get_cached(
386+
f"/repos/{repo}/commits/{sha}", endpoint=GitHubApiEndpoint.GET_COMMIT
387+
)
374388

375389
def get_installation_info(self, installation_id: int | str) -> Any:
376390
"""
@@ -601,7 +615,11 @@ def get_assignees(self, repo: str) -> Sequence[Any]:
601615
return self._get_with_pagination(f"/repos/{repo}/assignees")
602616

603617
def _get_with_pagination(
604-
self, path: str, response_key: str | None = None, page_number_limit: int | None = None
618+
self,
619+
path: str,
620+
response_key: str | None = None,
621+
page_number_limit: int | None = None,
622+
endpoint: GitHubApiEndpoint | None = None,
605623
) -> list[Any]:
606624
"""
607625
Github uses the Link header to provide pagination links. Github
@@ -622,7 +640,7 @@ def _get_with_pagination(
622640
output: list[dict[str, Any]] = []
623641

624642
page_number = 1
625-
resp = self.get(path, params={"per_page": self.page_size})
643+
resp = self.get(path, params={"per_page": self.page_size}, endpoint=endpoint)
626644
output.extend(resp) if not response_key else output.extend(resp[response_key])
627645
next_link = get_next_link(resp)
628646

@@ -631,7 +649,7 @@ def _get_with_pagination(
631649
while next_link and page_number < page_number_limit:
632650
# If a per_page is specified, GitHub preserves the per_page value
633651
# in the response headers.
634-
resp = self.get(next_link)
652+
resp = self.get(next_link, endpoint=endpoint)
635653
output.extend(resp) if not response_key else output.extend(resp[response_key])
636654

637655
next_link = get_next_link(resp)
@@ -761,7 +779,11 @@ def get_labels(self, owner: str, repo: str) -> list[Any]:
761779
return self._get_with_pagination(f"/repos/{owner}/{repo}/labels")
762780

763781
def check_file(self, repo: Repository, path: str, version: str | None) -> object | None:
764-
return self.head_cached(path=f"/repos/{repo.name}/contents/{path}", params={"ref": version})
782+
return self.head_cached(
783+
path=f"/repos/{repo.name}/contents/{path}",
784+
params={"ref": version},
785+
endpoint=GitHubApiEndpoint.CHECK_FILE,
786+
)
765787

766788
def get_file(
767789
self, repo: Repository, path: str, ref: str | None, codeowners: bool = False

0 commit comments

Comments
 (0)