Skip to content

fix: Gracefully handle missing repositories on pull page#3995

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/gazebo-17ze-not-found-errors
Open

fix: Gracefully handle missing repositories on pull page#3995
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/gazebo-17ze-not-found-errors

Conversation

@sentry

@sentry sentry Bot commented Jun 7, 2026

Copy link
Copy Markdown

Description

This PR addresses the issue of multiple "Not Found Error" events being logged in Sentry when a repository is not found on a pull request page, particularly for GitLab subgroup repositories.

Problem:
Previously, when the GraphQL API returned __typename: 'NotFoundError' for a repository (e.g., dmarcian:core/dmarcian), multiple frontend hooks on the pull request page (such as usePullBundleComparisonList, useRepoOverview, and PullPageDataQueryOpts) would independently call rejectNetworkError. This led to a cascade of Sentry events for the same underlying issue.

Root Cause:
Each hook was designed to reject its promise upon receiving a NotFoundError from the GraphQL API. The main PullRequestPage component was not short-circuiting early enough to prevent child components and their associated data-fetching hooks from executing when the repository was definitively not found.

This approach ensures that only a single, controlled NotFound state is reached, preventing unnecessary API calls and Sentry noise.

Code Example

No specific code examples are provided in the description.

Notable Changes

  1. Modified src/pages/PullRequestPage/queries/PullPageDataQueryOpts.tsx: Instead of calling rejectNetworkError when a NotFoundError is encountered, it now returns a sentinel object { notFound: true, ... }. This prevents an immediate Sentry log and allows for graceful handling.
  2. Modified src/pages/PullRequestPage/PullRequestPage.tsx: The main PullRequestPage component's guard condition was updated to check for data?.notFound (or !data?.pull). If true, it immediately renders the <NotFound /> component. This ensures that child components and their hooks (like usePullBundleComparisonList) are never mounted or executed when the repository is missing.
  3. Modified src/services/repo/useRepoOverview.ts: Similar to PullPageDataQueryOpts, useRepoOverview now returns { notFound: true, ... } instead of rejecting when a NotFoundError is received. This allows the PullRequestPage to detect a missing repository even earlier, before PullPageDataQueryOpts is called, further reducing redundant API calls and Sentry errors.

Screenshots

No screenshots are applicable for this change.

Link to Sample Entry

No sample entry link is provided in the description.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes GAZEBO-17ZE

@sentry

sentry Bot commented Jun 7, 2026

Copy link
Copy Markdown
Author

❌ 4 Tests Failed:

Tests completed Failed Passed Skipped
5729 4 5725 3
View the top 3 failed test(s) by shortest run time
src/pages/PullRequestPage/queries/PullPageDataQueryOpts.test.tsx > PullPageDataQueryOpts > calling hook > returns NotFoundError __typename > throws a 404
Stack Traces | 1.01s run time
AssertionError: expected false to be truthy

Ignored nodes: comments, script, style
<html>
  <head />
  <body>
    <div />
  </body>
</html>

- Expected
+ Received

- true
+ false

 ❯ .../PullRequestPage/queries/PullPageDataQueryOpts.test.tsx:282:60
 ❯ runWithExpensiveErrorDiagnosticsDisabled node_modules/@.../dom/dist/config.js:47:12
 ❯ checkCallback node_modules/@.../dom/dist/wait-for.js:124:77
 ❯ Timeout.checkRealTimersCallback node_modules/@.../dom/dist/wait-for.js:118:16
src/pages/PullRequestPage/queries/PullPageDataQueryOpts.test.tsx > PullPageDataQueryOpts > calling hook > user on team plan > returns the correct subset of data
Stack Traces | 1.01s run time
AssertionError: expected { pull: { pullId: 1, …(4) }, …(3) } to strictly equal { coverageEnabled: true, …(2) }

Ignored nodes: comments, script, style
<html>
  <head />
  <body>
    <div />
  </body>
</html>

- Expected
+ Received

  Object {
    "bundleAnalysisEnabled": true,
    "coverageEnabled": true,
+   "notFound": false,
    "pull": Object {
      "bundleAnalysisCompareWithBase": Object {
        "__typename": "BundleAnalysisComparison",
      },
      "commits": Object {
        "totalCount": 11,
      },
      "compareWithBase": Object {
        "__typename": "Comparison",
        "directChangedFilesCount": 0,
        "impactedFilesCount": 4,
      },
      "head": Object {
        "bundleAnalysis": Object {
          "bundleAnalysisReport": Object {
            "__typename": "BundleAnalysisReport",
            "isCached": false,
          },
        },
        "commitid": "123",
      },
      "pullId": 1,
    },
  }

 ❯ .../PullRequestPage/queries/PullPageDataQueryOpts.test.tsx:396:39
 ❯ runWithExpensiveErrorDiagnosticsDisabled node_modules/@.../dom/dist/config.js:47:12
 ❯ checkCallback node_modules/@.../dom/dist/wait-for.js:124:77
 ❯ Timeout.checkRealTimersCallback node_modules/@.../dom/dist/wait-for.js:118:16
src/pages/PullRequestPage/queries/PullPageDataQueryOpts.test.tsx > PullPageDataQueryOpts > calling hook > repository __typename of Repository > there is no data > returns the correct data
Stack Traces | 1.02s run time
AssertionError: expected { pull: null, …(3) } to strictly equal { coverageEnabled: null, …(2) }

Ignored nodes: comments, script, style
<html>
  <head />
  <body>
    <div />
  </body>
</html>

- Expected
+ Received

  Object {
    "bundleAnalysisEnabled": null,
    "coverageEnabled": null,
+   "notFound": false,
    "pull": null,
  }

 ❯ .../PullRequestPage/queries/PullPageDataQueryOpts.test.tsx:244:41
 ❯ runWithExpensiveErrorDiagnosticsDisabled node_modules/@.../dom/dist/config.js:47:12
 ❯ checkCallback node_modules/@.../dom/dist/wait-for.js:124:77
 ❯ Timeout.checkRealTimersCallback node_modules/@.../dom/dist/wait-for.js:118:16
src/pages/PullRequestPage/queries/PullPageDataQueryOpts.test.tsx > PullPageDataQueryOpts > calling hook > repository __typename of Repository > there is data > returns the correct data
Stack Traces | 1.06s run time
AssertionError: expected { pull: { pullId: 1, …(4) }, …(3) } to strictly equal { coverageEnabled: true, …(2) }

Ignored nodes: comments, script, style
<html>
  <head />
  <body>
    <div />
  </body>
</html>

- Expected
+ Received

  Object {
    "bundleAnalysisEnabled": true,
    "coverageEnabled": true,
+   "notFound": false,
    "pull": Object {
      "bundleAnalysisCompareWithBase": Object {
        "__typename": "BundleAnalysisComparison",
      },
      "commits": Object {
        "totalCount": 11,
      },
      "compareWithBase": Object {
        "__typename": "Comparison",
        "componentComparisonsCount": 6,
        "directChangedFilesCount": 0,
        "flagComparisonsCount": 1,
        "impactedFilesCount": 4,
        "indirectChangedFilesCount": 0,
      },
      "head": Object {
        "bundleAnalysis": Object {
          "bundleAnalysisReport": Object {
            "__typename": "BundleAnalysisReport",
            "isCached": false,
          },
        },
        "commitid": "123",
      },
      "pullId": 1,
    },
  }

 ❯ .../PullRequestPage/queries/PullPageDataQueryOpts.test.tsx:187:41
 ❯ runWithExpensiveErrorDiagnosticsDisabled node_modules/@.../dom/dist/config.js:47:12
 ❯ checkCallback node_modules/@.../dom/dist/wait-for.js:124:77
 ❯ Timeout.checkRealTimersCallback node_modules/@.../dom/dist/wait-for.js:118:16

@sentry

sentry Bot commented Jun 7, 2026

Copy link
Copy Markdown
Author

Bundle Report

Changes will increase total bundle size by 85 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system 5.87MB 39 bytes (0.0%) ⬆️
gazebo-production-esm 5.96MB 46 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: gazebo-production-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index.*.js 46 bytes 125.73kB 0.04%

Files in assets/index.*.js:

  • ./src/pages/PullRequestPage/queries/PullPageDataQueryOpts.tsx → Total Size: 5.74kB

  • ./src/pages/PullRequestPage/PullRequestPage.tsx → Total Size: 3.95kB

view changes for bundle: gazebo-production-system

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-legacy.*.js 39 bytes 113.11kB 0.03%

Files in assets/index-legacy.*.js:

  • ./src/pages/PullRequestPage/PullRequestPage.tsx → Total Size: 3.95kB

  • ./src/pages/PullRequestPage/queries/PullPageDataQueryOpts.tsx → Total Size: 5.74kB

@codecov-public-qa

codecov-public-qa Bot commented Jun 7, 2026

Copy link
Copy Markdown

❌ 4 Tests Failed:

Tests completed Failed Passed Skipped
5729 4 5725 3
View the top 3 failed test(s) by shortest run time
src/pages/PullRequestPage/queries/PullPageDataQueryOpts.test.tsx > PullPageDataQueryOpts > calling hook > returns NotFoundError __typename > throws a 404
Stack Traces | 1.01s run time
AssertionError: expected false to be truthy

Ignored nodes: comments, script, style
<html>
  <head />
  <body>
    <div />
  </body>
</html>

- Expected
+ Received

- true
+ false

 ❯ .../PullRequestPage/queries/PullPageDataQueryOpts.test.tsx:282:60runWithExpensiveErrorDiagnosticsDisabled node_modules/@.../dom/dist/config.js:47:12checkCallback node_modules/@.../dom/dist/wait-for.js:124:77Timeout.checkRealTimersCallback node_modules/@.../dom/dist/wait-for.js:118:16
src/pages/PullRequestPage/queries/PullPageDataQueryOpts.test.tsx > PullPageDataQueryOpts > calling hook > user on team plan > returns the correct subset of data
Stack Traces | 1.01s run time
AssertionError: expected { pull: { pullId: 1, …(4) }, …(3) } to strictly equal { coverageEnabled: true, …(2) }

Ignored nodes: comments, script, style
<html>
  <head />
  <body>
    <div />
  </body>
</html>

- Expected
+ Received

  Object {
    "bundleAnalysisEnabled": true,
    "coverageEnabled": true,
+   "notFound": false,
    "pull": Object {
      "bundleAnalysisCompareWithBase": Object {
        "__typename": "BundleAnalysisComparison",
      },
      "commits": Object {
        "totalCount": 11,
      },
      "compareWithBase": Object {
        "__typename": "Comparison",
        "directChangedFilesCount": 0,
        "impactedFilesCount": 4,
      },
      "head": Object {
        "bundleAnalysis": Object {
          "bundleAnalysisReport": Object {
            "__typename": "BundleAnalysisReport",
            "isCached": false,
          },
        },
        "commitid": "123",
      },
      "pullId": 1,
    },
  }

 ❯ .../PullRequestPage/queries/PullPageDataQueryOpts.test.tsx:396:39runWithExpensiveErrorDiagnosticsDisabled node_modules/@.../dom/dist/config.js:47:12checkCallback node_modules/@.../dom/dist/wait-for.js:124:77Timeout.checkRealTimersCallback node_modules/@.../dom/dist/wait-for.js:118:16
src/pages/PullRequestPage/queries/PullPageDataQueryOpts.test.tsx > PullPageDataQueryOpts > calling hook > repository __typename of Repository > there is no data > returns the correct data
Stack Traces | 1.02s run time
AssertionError: expected { pull: null, …(3) } to strictly equal { coverageEnabled: null, …(2) }

Ignored nodes: comments, script, style
<html>
  <head />
  <body>
    <div />
  </body>
</html>

- Expected
+ Received

  Object {
    "bundleAnalysisEnabled": null,
    "coverageEnabled": null,
+   "notFound": false,
    "pull": null,
  }

 ❯ .../PullRequestPage/queries/PullPageDataQueryOpts.test.tsx:244:41runWithExpensiveErrorDiagnosticsDisabled node_modules/@.../dom/dist/config.js:47:12checkCallback node_modules/@.../dom/dist/wait-for.js:124:77Timeout.checkRealTimersCallback node_modules/@.../dom/dist/wait-for.js:118:16

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

@codecov-releaser

Copy link
Copy Markdown
Collaborator

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
88aaa52 Sun, 07 Jun 2026 13:07:09 GMT Cloud Enterprise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant