Skip to content

[WIP/DNM] Hackweek - PR page #97989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open

[WIP/DNM] Hackweek - PR page #97989

wants to merge 19 commits into from

Conversation

rbro112
Copy link
Member

@rbro112 rbro112 commented Aug 18, 2025

DO NOT MERGE

Copy link
Member Author

rbro112 commented Aug 18, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Aug 18, 2025
@rbro112 rbro112 changed the title Hackweek - PR page [WIP/DNM] Hackweek - PR page Aug 18, 2025
@trevor-e trevor-e requested review from a team as code owners August 18, 2025 17:42
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 18, 2025
Copy link
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.

cursor[bot]

This comment was marked as outdated.

return Response(response_data)

except InvalidSearchQuery as e:
return Response({"detail": f"Invalid search query: {e}"}, status=400)

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.

Copilot Autofix

AI about 4 hours ago

To fix the problem, we should avoid returning the raw exception message to the user. Instead, return a generic error message such as "Invalid search query." in the response, while logging the actual exception message and stack trace for internal debugging. This change should be made in the except InvalidSearchQuery as e: block, specifically on line 670. No new imports are needed, as logging is already set up. The rest of the code and functionality should remain unchanged.

Suggested changeset 1
src/sentry/issues/endpoints/organization_pr_issues.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/sentry/issues/endpoints/organization_pr_issues.py b/src/sentry/issues/endpoints/organization_pr_issues.py
--- a/src/sentry/issues/endpoints/organization_pr_issues.py
+++ b/src/sentry/issues/endpoints/organization_pr_issues.py
@@ -667,7 +667,7 @@
                     "error": str(e),
                 },
             )
-            return Response({"detail": f"Invalid search query: {e}"}, status=400)
+            return Response({"detail": "Invalid search query."}, status=400)
         except Exception as e:
             logger.exception(
                 "[telkins] Unexpected error in OrganizationPrDataEndpoint",
EOF
@@ -667,7 +667,7 @@
"error": str(e),
},
)
return Response({"detail": f"Invalid search query: {e}"}, status=400)
return Response({"detail": "Invalid search query."}, status=400)
except Exception as e:
logger.exception(
"[telkins] Unexpected error in OrganizationPrDataEndpoint",
Copilot is powered by AI and may make mistakes. Always verify output.
Copy link

codecov bot commented Aug 18, 2025

❌ 7 Tests Failed:

Tests completed Failed Passed Skipped
38658 7 38651 601
View the top 3 failed test(s) by shortest run time
IssueList -> Polling stops polling for new issues when endpoint returns a 401
Stack Traces | 0.276s run time
Error: Dogfooding test: Unexpected runtime error in issues list
    at .../views/issueList/overview.tsx:183:15
    at callTimer (.../sentry/node_modules/.pnpm/@[email protected]/node_modules/@.../fake-timers/src/fake-timers-src.js:806:24)
    at Object.next (.../sentry/node_modules/.pnpm/@[email protected]/node_modules/@.../fake-timers/src/fake-timers-src.js:1533:17)
    at Object.runAll (.../sentry/node_modules/.pnpm/@[email protected]/node_modules/@.../fake-timers/src/fake-timers-src.js:1592:23)
    at FakeTimers.runAllTimers (.../sentry/node_modules/.pnpm/@[email protected]/node_modules/@.../fake-timers/build/index.js:532:19)
    at Object.runAllTimers (.../sentry/node_modules/.pnpm/[email protected]..../jest-runtime/build/index.js:1791:44)
    at runAllTimers (.../views/issueList/overview.polling.spec.tsx:75:10)
    at Object.<anonymous> (.../views/issueList/overview.polling.spec.tsx:229:5)
IssueList withStores and feature flags pins a saved query
Stack Traces | 1.7s run time
Error: Expected test not to call console.error().

If the error is expected, test for it explicitly by mocking it out using jest.spyOn(console, 'error').mockImplementation() and test that the warning occurs.

Dogfooding test: Console error with stack trace {
  component: 'IssueListOverview',
  timestamp: '2017-10-17T02:41:20.000Z',
  userAgent: 'Mozilla/5.0 (linux) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/26.1.0',
  location: 'http://localhost/'
}
    at console.captureMessage [as error] (.../sentry/node_modules/.pnpm/[email protected]..../node_modules/jest-fail-on-console/index.js:83:25)
    at error (.../views/issueList/overview.tsx:201:17)
    at Timeout.task [as _onTimeout] (.../sentry/node_modules/.pnpm/[email protected]..../jsdom/browser/Window.js:579:19)
    at listOnTimeout (node:internal/timers:588:17)
    at processTimers (node:internal/timers:523:7)
    at flushUnexpectedConsoleCalls (.../sentry/node_modules/.pnpm/[email protected]..../node_modules/jest-fail-on-console/index.js:48:13)
    at Object.<anonymous> (.../sentry/node_modules/.pnpm/[email protected]..../node_modules/jest-fail-on-console/index.js:145:7)
    at Promise.finally.completed (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:1559:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:1499:10)
    at _callCircusHook (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:978:40)
    at _runTest (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:951:5)
    at _runTestsForDescribeBlock (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:839:13)
    at _runTestsForDescribeBlock (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:829:11)
    at _runTestsForDescribeBlock (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:829:11)
    at run (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:757:3)
    at runAndTransformResultsToJestFormat (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:1920:21)
    at jestAdapter (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/runner.js:101:19)
    at runTestInternal (.../sentry/node_modules/.pnpm/[email protected]..../jest-runner/build/testWorker.js:272:16)
    at runTest (.../sentry/node_modules/.pnpm/[email protected]..../jest-runner/build/testWorker.js:340:7)
    at Object.worker (.../sentry/node_modules/.pnpm/[email protected]..../jest-runner/build/testWorker.js:494:12)
IssueListOverview (actions) priority removes issues after bulk reprioritizing (when excluding priorities)
Stack Traces | 2.35s run time
Error: Expected test not to call console.error().

If the error is expected, test for it explicitly by mocking it out using jest.spyOn(console, 'error').mockImplementation() and test that the warning occurs.

Dogfooding test: Console error with stack trace {
  component: 'IssueListOverview',
  timestamp: '2017-10-17T02:41:20.000Z',
  userAgent: 'Mozilla/5.0 (linux) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/26.1.0',
  location: 'http://localhost/'
}
    at console.captureMessage [as error] (.../sentry/node_modules/.pnpm/[email protected]..../node_modules/jest-fail-on-console/index.js:83:25)
    at error (.../views/issueList/overview.tsx:201:17)
    at Timeout.task [as _onTimeout] (.../sentry/node_modules/.pnpm/[email protected]..../jsdom/browser/Window.js:579:19)
    at listOnTimeout (node:internal/timers:588:17)
    at processTimers (node:internal/timers:523:7)

Error: Uncaught [Error: Dogfooding test: Unexpected runtime error in issues list]
    at reportException (.../sentry/node_modules/.pnpm/[email protected]..../living/helpers/runtime-script-errors.js:66:24)
    at Timeout.task [as _onTimeout] (.../sentry/node_modules/.pnpm/[email protected]..../jsdom/browser/Window.js:584:9)
    at listOnTimeout (node:internal/timers:588:17)
    at processTimers (node:internal/timers:523:7) {
  detail: Error: Dogfooding test: Unexpected runtime error in issues list
      at .../views/issueList/overview.tsx:183:15
      at Timeout.task [as _onTimeout] (.../sentry/node_modules/.pnpm/[email protected]..../jsdom/browser/Window.js:579:19)
      at listOnTimeout (node:internal/timers:588:17)
      at processTimers (node:internal/timers:523:7),
  type: 'unhandled exception'
}
    at console.captureMessage [as error] (.../sentry/node_modules/.pnpm/[email protected]..../node_modules/jest-fail-on-console/index.js:83:25)
    at VirtualConsole.<anonymous> (.../sentry/node_modules/.pnpm/@[email protected][email protected]/node_modules/@.../environment-jsdom-abstract/build/index.js:78:23)
    at VirtualConsole.emit (node:events:518:28)
    at reportException (.../sentry/node_modules/.pnpm/[email protected]..../living/helpers/runtime-script-errors.js:70:28)
    at Timeout.task [as _onTimeout] (.../sentry/node_modules/.pnpm/[email protected]..../jsdom/browser/Window.js:584:9)
    at listOnTimeout (node:internal/timers:588:17)
    at processTimers (node:internal/timers:523:7)
    at flushUnexpectedConsoleCalls (.../sentry/node_modules/.pnpm/[email protected]..../node_modules/jest-fail-on-console/index.js:48:13)
    at Object.<anonymous> (.../sentry/node_modules/.pnpm/[email protected]..../node_modules/jest-fail-on-console/index.js:145:7)
    at Promise.finally.completed (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:1559:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:1499:10)
    at _callCircusHook (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:978:40)
    at _runTest (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:951:5)
    at _runTestsForDescribeBlock (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:839:13)
    at _runTestsForDescribeBlock (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:829:11)
    at _runTestsForDescribeBlock (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:829:11)
    at run (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:757:3)
    at runAndTransformResultsToJestFormat (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/jestAdapterInit.js:1920:21)
    at jestAdapter (.../sentry/node_modules/.pnpm/[email protected][email protected]..../jest-circus/build/runner.js:101:19)
    at runTestInternal (.../sentry/node_modules/.pnpm/[email protected]..../jest-runner/build/testWorker.js:272:16)
    at runTest (.../sentry/node_modules/.pnpm/[email protected]..../jest-runner/build/testWorker.js:340:7)
    at Object.worker (.../sentry/node_modules/.pnpm/[email protected]..../jest-runner/build/testWorker.js:494:12)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

},
)
return Response(
{"detail": f"An error occurred while processing PR data: {str(e)}"}, status=500

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.

Copilot Autofix

AI about 4 hours ago

To fix the problem, we should avoid returning the string representation of the exception (str(e)) in the HTTP response to the user. Instead, return a generic error message such as "An error occurred while processing PR data." The full exception details should continue to be logged server-side for debugging. This change should be made in the except Exception as e: block, specifically on line 680 of src/sentry/issues/endpoints/organization_pr_issues.py. No new imports or methods are required, as logging is already in place.


Suggested changeset 1
src/sentry/issues/endpoints/organization_pr_issues.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/sentry/issues/endpoints/organization_pr_issues.py b/src/sentry/issues/endpoints/organization_pr_issues.py
--- a/src/sentry/issues/endpoints/organization_pr_issues.py
+++ b/src/sentry/issues/endpoints/organization_pr_issues.py
@@ -677,7 +677,7 @@
                 },
             )
             return Response(
-                {"detail": f"An error occurred while processing PR data: {str(e)}"}, status=500
+                {"detail": "An error occurred while processing PR data."}, status=500
             )
 
     def get_projects(self, request: Request, organization: Organization) -> list[Project]:
EOF
@@ -677,7 +677,7 @@
},
)
return Response(
{"detail": f"An error occurred while processing PR data: {str(e)}"}, status=500
{"detail": "An error occurred while processing PR data."}, status=500
)

def get_projects(self, request: Request, organization: Organization) -> list[Project]:
Copilot is powered by AI and may make mistakes. Always verify output.
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

request, organization, projects, environments, filenames
)

return Response(issues_data)

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.

Copilot Autofix

AI about 4 hours ago

To fix the problem, we should avoid exposing the raw exception message to the user. Instead, we should return a generic error message in the API response, while still logging the detailed exception (including the stack trace) on the server for debugging purposes. This can be achieved by modifying the _get_issues_data method to return a generic error message in the "error" field, rather than including str(e). Only the log should contain the full exception details. The rest of the code can remain unchanged, as this preserves existing functionality and error handling.

Specifically, in src/sentry/issues/endpoints/organization_pr_issues.py, update the except Exception as e: block in _get_issues_data (lines 461-464) to return a generic error message, e.g., "Failed to fetch issues due to an internal error.", instead of including str(e).


Suggested changeset 1
src/sentry/issues/endpoints/organization_pr_issues.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/sentry/issues/endpoints/organization_pr_issues.py b/src/sentry/issues/endpoints/organization_pr_issues.py
--- a/src/sentry/issues/endpoints/organization_pr_issues.py
+++ b/src/sentry/issues/endpoints/organization_pr_issues.py
@@ -460,7 +460,7 @@
 
         except Exception as e:
             logger.exception("[telkins] Error getting issues data for PR")
-            return {"issues": [], "error": f"Failed to fetch issues: {str(e)}"}
+            return {"issues": [], "error": "Failed to fetch issues due to an internal error."}
 
 
 @region_silo_endpoint
EOF
@@ -460,7 +460,7 @@

except Exception as e:
logger.exception("[telkins] Error getting issues data for PR")
return {"issues": [], "error": f"Failed to fetch issues: {str(e)}"}
return {"issues": [], "error": "Failed to fetch issues due to an internal error."}


@region_silo_endpoint
Copilot is powered by AI and may make mistakes. Always verify output.
},
)
return Response(
{"detail": f"An error occurred while processing PR issues data: {str(e)}"},

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.

Copilot Autofix

AI about 4 hours ago

To fix the problem, we should avoid exposing the stringified exception (str(e)) in the user-facing response. Instead, return a generic error message such as "An error occurred while processing PR issues data." to the user. The detailed exception information should continue to be logged using logger.exception for internal debugging. The change should be made in the except Exception as e: block in the get method of the relevant class in src/sentry/issues/endpoints/organization_pr_issues.py, specifically replacing line 206.

No new imports or methods are required, as logging is already in place.


Suggested changeset 1
src/sentry/issues/endpoints/organization_pr_issues.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/sentry/issues/endpoints/organization_pr_issues.py b/src/sentry/issues/endpoints/organization_pr_issues.py
--- a/src/sentry/issues/endpoints/organization_pr_issues.py
+++ b/src/sentry/issues/endpoints/organization_pr_issues.py
@@ -203,7 +203,7 @@
                 },
             )
             return Response(
-                {"detail": f"An error occurred while processing PR issues data: {str(e)}"},
+                {"detail": "An error occurred while processing PR issues data."},
                 status=500,
             )
 
EOF
@@ -203,7 +203,7 @@
},
)
return Response(
{"detail": f"An error occurred while processing PR issues data: {str(e)}"},
{"detail": "An error occurred while processing PR issues data."},
status=500,
)

Copilot is powered by AI and may make mistakes. Always verify output.
cursor[bot]

This comment was marked as outdated.

},
)
return Response(
{"detail": f"An error occurred while fetching pull requests: {str(e)}"},

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.

Copilot Autofix

AI about 3 hours ago

To fix the problem, we should avoid including the exception message (str(e)) in the response sent to the user. Instead, return a generic error message such as "An error occurred while fetching pull requests." The exception and stack trace should continue to be logged server-side for debugging purposes. The change should be made in the get method of OrganizationPullRequestsEndpoint, specifically in the block handling exceptions (lines 217-228). No new imports are needed, as logging is already set up.


Suggested changeset 1
src/sentry/issues/endpoints/organization_pull_requests.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/sentry/issues/endpoints/organization_pull_requests.py b/src/sentry/issues/endpoints/organization_pull_requests.py
--- a/src/sentry/issues/endpoints/organization_pull_requests.py
+++ b/src/sentry/issues/endpoints/organization_pull_requests.py
@@ -223,7 +223,7 @@
                 },
             )
             return Response(
-                {"detail": f"An error occurred while fetching pull requests: {str(e)}"},
+                {"detail": "An error occurred while fetching pull requests."},
                 status=500,
             )
 
EOF
@@ -223,7 +223,7 @@
},
)
return Response(
{"detail": f"An error occurred while fetching pull requests: {str(e)}"},
{"detail": "An error occurred while fetching pull requests."},
status=500,
)

Copilot is powered by AI and may make mistakes. Always verify output.
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