Skip to content

feat: Add rejectNetworkError to calls (part three)#3767

Merged
nicholas-codecov merged 14 commits intomainfrom
gh-eng-3329-add-reject-network-error-to-calls-part-three
Feb 25, 2025
Merged

feat: Add rejectNetworkError to calls (part three)#3767
nicholas-codecov merged 14 commits intomainfrom
gh-eng-3329-add-reject-network-error-to-calls-part-three

Conversation

@nicholas-codecov
Copy link
Copy Markdown
Contributor

@nicholas-codecov nicholas-codecov commented Feb 24, 2025

Description

This PR is part three in a series, where we're going through and updating our query requests to utilize the new rejectNetworkError helper function.

Ticket: codecov/engineering-team#3329

Notable Changes

  • Update hooks to use rejectNetworkError (see commits)
  • Remove redundant function in useRepoComponentsArgs
  • Update tests

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.68%. Comparing base (c34d9c1) to head (99110d3).
Report is 3 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3767      +/-   ##
==========================================
- Coverage   98.68%   98.68%   -0.01%     
==========================================
  Files         825      825              
  Lines       14835    14831       -4     
  Branches     4251     4250       -1     
==========================================
- Hits        14640    14636       -4     
  Misses        188      188              
  Partials        7        7              
Files with missing lines Coverage Δ
src/services/pull/usePullBundleComparisonList.tsx 100.00% <100.00%> (ø)
src/services/pull/usePullBundleHeadList.tsx 100.00% <100.00%> (ø)
src/services/pull/usePullCompareTotalsTeam.tsx 100.00% <100.00%> (ø)
src/services/pull/usePullComponents.tsx 100.00% <100.00%> (ø)
...c/services/pull/usePullCoverageDropdownSummary.tsx 100.00% <100.00%> (ø)
src/services/pull/usePullTeam.tsx 100.00% <100.00%> (ø)
...ervices/pull/useSingularImpactedFileComparison.tsx 100.00% <100.00%> (ø)
src/services/pulls/usePulls.tsx 100.00% <100.00%> (ø)
src/services/repo/useActivateMeasurements.tsx 100.00% <100.00%> (ø)
src/services/repo/useComponentsBackfilled.tsx 100.00% <100.00%> (ø)
... and 3 more

... and 18 files with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.69% <ø> (ø)
Pages 98.26% <ø> (ø)
Services 99.27% <100.00%> (-0.01%) ⬇️
Shared 99.11% <ø> (ø)
UI 99.07% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c34d9c1...99110d3. Read the comment docs.

@codecov-public-qa
Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
4214 1 4213 0
View the top 1 failed tests by shortest run time
src/pages/RepoPage/RepoPage.test.tsx > RepoPage > there is no repo data > renders not found
Stack Traces | 1.07s run time
TestingLibraryElementError: Unable to find an element with the text: /not found/i. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

Ignored nodes: comments, script, style
<body>
  <div>
    <article
      class="mx-auto flex h-full flex-col items-center justify-center"
    >
      <img
        alt="illustration error"
        class="_illustrationError_0e4e25 mx-auto"
        src=".../NetworkErrorBoundary/assets/error-upsidedown-umbrella.svg"
      />
      <h1
        class="mt-6 text-2xl"
      >
        Bad Request
      </h1>
      <p
        class="my-4 px-3 sm:px-0"
      >
        Check on
         
        <a
          class="
  font-sans cursor-pointer

  hover:underline

  focus:ring-2
 text-ds-blue-default inline-flex items-center gap-1"
          data-cy="status"
          data-marketing="status"
          data-testid="status"
          href="https://status.codecov.io/"
          rel="noreferrer"
          target="blank"
        >
          Codecov's status
          <span
            class="text-ds-gray-quinary"
          >
            <svg
              class="w-4 h-4"
              data-icon=""
              data-testid=""
              fill="none"
              stroke="currentColor"
              viewBox="0 0 24 24"
              xmlns="http://www.w3.org/2000/svg"
            >
              <path
                d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
                stroke-linecap="round"
                stroke-linejoin="round"
                stroke-width="2"
              />
            </svg>
          </span>
        </a>
         
        or see
         
        <a
          class="
  font-sans cursor-pointer

  hover:underline

  focus:ring-2
 text-ds-blue-default inline-flex items-center gap-1"
          data-cy="docs"
          data-marketing="docs"
          data-testid="docs"
          href="https://docs.codecov.io/"
          rel="noreferrer"
          target="blank"
        >
          our docs
          <span
            class="text-ds-gray-quinary"
          >
            <svg
              class="w-4 h-4"
              data-icon=""
              data-testid=""
              fill="none"
              stroke="currentColor"
              viewBox="0 0 24 24"
              xmlns="http://www.w3.org/2000/svg"
            >
              <path
                d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
                stroke-linecap="round"
                stroke-linejoin="round"
                stroke-width="2"
              />
            </svg>
          </span>
        </a>
         
        for common support.
      </p>
      <p>
        <strong>
          Error 
          400
        </strong>
      </p>
      <div
        class="my-4"
      >
        <button
          class="
  flex items-center gap-1
  rounded py-1 px-4
  transition-colors duration-150 motion-reduce:transition-none

  focus:outline-none focus:ring

  disabled:cursor-not-allowed 
 disabled:text-ds-gray-quaternary disabled:border-ds-gray-tertiary disabled:bg-ds-gray-primary 
    justify-center font-semibold
    text-ds-gray-octonary bg-ds-gray-primary border-ds-gray-quaternary
    border-solid border shadow

    hover:bg-ds-gray-secondary
  "
        >
          Return to previous page
        </button>
      </div>
    </article>
  </div>
</body>

Ignored nodes: comments, script, style
<body>
  <div>
    <article
      class="mx-auto flex h-full flex-col items-center justify-center"
    >
      <img
        alt="illustration error"
        class="_illustrationError_0e4e25 mx-auto"
        src=".../NetworkErrorBoundary/assets/error-upsidedown-umbrella.svg"
      />
      <h1
        class="mt-6 text-2xl"
      >
        Bad Request
      </h1>
      <p
        class="my-4 px-3 sm:px-0"
      >
        Check on
         
        <a
          class="
  font-sans cursor-pointer

  hover:underline

  focus:ring-2
 text-ds-blue-default inline-flex items-center gap-1"
          data-cy="status"
          data-marketing="status"
          data-testid="status"
          href="https://status.codecov.io/"
          rel="noreferrer"
          target="blank"
        >
          Codecov's status
          <span
            class="text-ds-gray-quinary"
          >
            <svg
              class="w-4 h-4"
              data-icon=""
              data-testid=""
              fill="none"
              stroke="currentColor"
              viewBox="0 0 24 24"
              xmlns="http://www.w3.org/2000/svg"
            >
              <path
                d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
                stroke-linecap="round"
                stroke-linejoin="round"
                stroke-width="2"
              />
            </svg>
          </span>
        </a>
         
        or see
         
        <a
          class="
  font-sans cursor-pointer

  hover:underline

  focus:ring-2
 text-ds-blue-default inline-flex items-center gap-1"
          data-cy="docs"
          data-marketing="docs"
          data-testid="docs"
          href="https://docs.codecov.io/"
          rel="noreferrer"
          target="blank"
        >
          our docs
          <span
            class="text-ds-gray-quinary"
          >
            <svg
              class="w-4 h-4"
              data-icon=""
              data-testid=""
              fill="none"
              stroke="currentColor"
              viewBox="0 0 24 24"
              xmlns="http://www.w3.org/2000/svg"
            >
              <path
                d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
                stroke-linecap="round"
                stroke-linejoin="round"
                stroke-width="2"
              />
            </svg>
          </span>
        </a>
         
        for common support.
      </p>
      <p>
        <strong>
          Error 
          400
        </strong>
      </p>
      <div
        class="my-4"
      >
        <button
          class="
  flex items-center gap-1
  rounded py-1 px-4
  transition-colors duration-150 motion-reduce:transition-none

  focus:outline-none focus:ring

  disabled:cursor-not-allowed 
 disabled:text-ds-gray-quaternary disabled:border-ds-gray-tertiary disabled:bg-ds-gray-primary 
    justify-center font-semibold
    text-ds-gray-octonary bg-ds-gray-primary border-ds-gray-quaternary
    border-solid border shadow

    hover:bg-ds-gray-secondary
  "
        >
          Return to previous page
        </button>
      </div>
    </article>
  </div>
</body>waitForWrapper node_modules/@.../dom/dist/wait-for.js:163:27node_modules/@.../dom/dist/query-helpers.js:86:33
 ❯ .../pages/RepoPage/RepoPage.test.tsx:293:37

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

@codecov-staging
Copy link
Copy Markdown

codecov-staging bot commented Feb 24, 2025

Bundle Report

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

Detailed changes
Bundle name Size Change
gazebo-staging-system 6.13MB 313 bytes (0.01%) ⬆️
gazebo-staging-esm 6.21MB 307 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: gazebo-staging-system

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-legacy.*.js 368 bytes 113.78kB 0.32%
assets/index-legacy.*.js -185 bytes 709.68kB -0.03%
assets/index-legacy.*.js 130 bytes 12.67kB 1.04%

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

  • ./src/services/pull/usePullBundleComparisonList.tsx → Total Size: 4.22kB

  • ./src/services/pull/usePullBundleHeadList.tsx → Total Size: 3.59kB

  • ./src/services/pull/usePullTeam.tsx → Total Size: 5.76kB

  • ./src/services/pull/useSingularImpactedFileComparison.tsx → Total Size: 3.11kB

  • ./src/services/pull/usePullComponents.tsx → Total Size: 4.03kB

  • ./src/services/pull/usePullCoverageDropdownSummary.tsx → Total Size: 3.57kB

  • ./src/services/pull/usePullCompareTotalsTeam.tsx → Total Size: 4.77kB

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

  • ./src/services/repo/useComponentsBackfilled.tsx → Total Size: 2.98kB

  • ./src/services/repo/useRepoComponents.tsx → Total Size: 3.96kB

  • ./src/services/repo/useActivateMeasurements.tsx → Total Size: 2.38kB

  • ./src/services/repo/useRepoBackfilled.tsx → Total Size: 2.73kB

  • ./src/services/repo/useRepo.tsx → Total Size: 2.87kB

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

  • ./src/services/pulls/usePulls.tsx → Total Size: 6.7kB
view changes for bundle: gazebo-staging-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index.*.js 368 bytes 126.36kB 0.29%
assets/index.*.js -190 bytes 630.1kB -0.03%
assets/index.*.js 129 bytes 13.63kB 0.96%

Files in assets/index.*.js:

  • ./src/services/pull/usePullBundleHeadList.tsx → Total Size: 3.59kB

  • ./src/services/pull/usePullBundleComparisonList.tsx → Total Size: 4.22kB

  • ./src/services/pull/useSingularImpactedFileComparison.tsx → Total Size: 3.11kB

  • ./src/services/pull/usePullTeam.tsx → Total Size: 5.76kB

  • ./src/services/pull/usePullCompareTotalsTeam.tsx → Total Size: 4.77kB

  • ./src/services/pull/usePullCoverageDropdownSummary.tsx → Total Size: 3.57kB

  • ./src/services/pull/usePullComponents.tsx → Total Size: 4.03kB

Files in assets/index.*.js:

  • ./src/services/repo/useRepo.tsx → Total Size: 2.87kB

  • ./src/services/repo/useComponentsBackfilled.tsx → Total Size: 2.98kB

  • ./src/services/repo/useRepoComponents.tsx → Total Size: 3.96kB

  • ./src/services/repo/useActivateMeasurements.tsx → Total Size: 2.36kB

  • ./src/services/repo/useRepoBackfilled.tsx → Total Size: 2.73kB

Files in assets/index.*.js:

  • ./src/services/pulls/usePulls.tsx → Total Size: 6.7kB

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 24, 2025

Bundle Report

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

Detailed changes
Bundle name Size Change
gazebo-production-system 6.13MB 313 bytes (0.01%) ⬆️
gazebo-production-esm 6.21MB 307 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: gazebo-production-system

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-legacy.*.js 130 bytes 12.67kB 1.04%
assets/index-legacy.*.js -185 bytes 709.68kB -0.03%
assets/index-legacy.*.js 368 bytes 113.78kB 0.32%

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

  • ./src/services/pulls/usePulls.tsx → Total Size: 6.7kB

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

  • ./src/services/repo/useRepoComponents.tsx → Total Size: 3.96kB

  • ./src/services/repo/useComponentsBackfilled.tsx → Total Size: 2.98kB

  • ./src/services/repo/useActivateMeasurements.tsx → Total Size: 2.38kB

  • ./src/services/repo/useRepo.tsx → Total Size: 2.87kB

  • ./src/services/repo/useRepoBackfilled.tsx → Total Size: 2.73kB

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

  • ./src/services/pull/useSingularImpactedFileComparison.tsx → Total Size: 3.11kB

  • ./src/services/pull/usePullComponents.tsx → Total Size: 4.03kB

  • ./src/services/pull/usePullBundleHeadList.tsx → Total Size: 3.59kB

  • ./src/services/pull/usePullCoverageDropdownSummary.tsx → Total Size: 3.57kB

  • ./src/services/pull/usePullTeam.tsx → Total Size: 5.76kB

  • ./src/services/pull/usePullCompareTotalsTeam.tsx → Total Size: 4.77kB

  • ./src/services/pull/usePullBundleComparisonList.tsx → Total Size: 4.22kB

view changes for bundle: gazebo-production-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index.*.js 129 bytes 13.63kB 0.96%
assets/index.*.js 368 bytes 126.36kB 0.29%
assets/index.*.js -190 bytes 630.1kB -0.03%

Files in assets/index.*.js:

  • ./src/services/pulls/usePulls.tsx → Total Size: 6.7kB

Files in assets/index.*.js:

  • ./src/services/pull/usePullBundleHeadList.tsx → Total Size: 3.59kB

  • ./src/services/pull/usePullComponents.tsx → Total Size: 4.03kB

  • ./src/services/pull/usePullTeam.tsx → Total Size: 5.76kB

  • ./src/services/pull/usePullCoverageDropdownSummary.tsx → Total Size: 3.57kB

  • ./src/services/pull/useSingularImpactedFileComparison.tsx → Total Size: 3.11kB

  • ./src/services/pull/usePullBundleComparisonList.tsx → Total Size: 4.22kB

  • ./src/services/pull/usePullCompareTotalsTeam.tsx → Total Size: 4.77kB

Files in assets/index.*.js:

  • ./src/services/repo/useComponentsBackfilled.tsx → Total Size: 2.98kB

  • ./src/services/repo/useRepoComponents.tsx → Total Size: 3.96kB

  • ./src/services/repo/useRepoBackfilled.tsx → Total Size: 2.73kB

  • ./src/services/repo/useActivateMeasurements.tsx → Total Size: 2.36kB

  • ./src/services/repo/useRepo.tsx → Total Size: 2.87kB

@codecov-qa
Copy link
Copy Markdown

codecov-qa bot commented Feb 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.68%. Comparing base (c34d9c1) to head (99110d3).
Report is 3 commits behind head on main.

✅ All tests successful. No failed tests found.

@@            Coverage Diff             @@
##             main    #3767      +/-   ##
==========================================
- Coverage   98.68%   98.68%   -0.01%     
==========================================
  Files         825      825              
  Lines       14835    14831       -4     
  Branches     4243     4242       -1     
==========================================
- Hits        14640    14636       -4     
  Misses        188      188              
  Partials        7        7              
Files with missing lines Coverage Δ
src/services/pull/usePullBundleComparisonList.tsx 100.00% <100.00%> (ø)
src/services/pull/usePullBundleHeadList.tsx 100.00% <100.00%> (ø)
src/services/pull/usePullCompareTotalsTeam.tsx 100.00% <100.00%> (ø)
src/services/pull/usePullComponents.tsx 100.00% <100.00%> (ø)
...c/services/pull/usePullCoverageDropdownSummary.tsx 100.00% <100.00%> (ø)
src/services/pull/usePullTeam.tsx 100.00% <100.00%> (ø)
...ervices/pull/useSingularImpactedFileComparison.tsx 100.00% <100.00%> (ø)
src/services/pulls/usePulls.tsx 100.00% <100.00%> (ø)
src/services/repo/useActivateMeasurements.tsx 100.00% <100.00%> (ø)
src/services/repo/useComponentsBackfilled.tsx 100.00% <100.00%> (ø)
... and 3 more

... and 18 files with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.69% <ø> (ø)
Pages 98.26% <ø> (ø)
Services 99.27% <100.00%> (-0.01%) ⬇️
Shared 99.11% <ø> (ø)
UI 99.07% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c34d9c1...99110d3. Read the comment docs.

@codecov-staging
Copy link
Copy Markdown

codecov-staging bot commented Feb 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

@@            Coverage Diff             @@
##             main    #3767      +/-   ##
==========================================
- Coverage   98.68%   98.68%   -0.01%     
==========================================
  Files         825      825              
  Lines       14835    14831       -4     
  Branches     4251     4242       -9     
==========================================
- Hits        14640    14636       -4     
  Misses        188      188              
  Partials        7        7              
Files with missing lines Coverage Δ
src/services/pull/usePullBundleComparisonList.tsx 100.00% <100.00%> (ø)
src/services/pull/usePullBundleHeadList.tsx 100.00% <100.00%> (ø)
src/services/pull/usePullCompareTotalsTeam.tsx 100.00% <100.00%> (ø)
src/services/pull/usePullComponents.tsx 100.00% <100.00%> (ø)
...c/services/pull/usePullCoverageDropdownSummary.tsx 100.00% <100.00%> (ø)
src/services/pull/usePullTeam.tsx 100.00% <100.00%> (ø)
...ervices/pull/useSingularImpactedFileComparison.tsx 100.00% <100.00%> (ø)
src/services/pulls/usePulls.tsx 100.00% <100.00%> (ø)
src/services/repo/useActivateMeasurements.tsx 100.00% <100.00%> (ø)
src/services/repo/useComponentsBackfilled.tsx 100.00% <100.00%> (ø)
... and 3 more

... and 18 files with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.69% <ø> (ø)
Pages 98.26% <ø> (ø)
Services 99.27% <100.00%> (-0.01%) ⬇️
Shared 99.11% <ø> (ø)
UI 99.07% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c34d9c1...99110d3. Read the comment docs.

@codecov-releaser
Copy link
Copy Markdown
Collaborator

codecov-releaser commented Feb 24, 2025

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
81359bc Mon, 24 Feb 2025 16:51:07 GMT Expired Expired
99110d3 Mon, 24 Feb 2025 17:05:02 GMT Cloud Enterprise

data: {},
dev: 'useSingularImpactedFileComparison - 404 missing data',
} satisfies NetworkErrorObject)
// we can set to null, and use the error display message we currently have, rather than throwing
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure I understand what's going on here. Can you provide some more context?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so before we were throwing an error here rather than returning anything. However, in all locations where this is being used, we're checking to ensure data exists and is not a nullish value, and if it is, we display an error message.

Copy link
Copy Markdown
Contributor

@spalmurray-codecov spalmurray-codecov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question, but I trust you know what you're doing lol

@nicholas-codecov nicholas-codecov added this pull request to the merge queue Feb 25, 2025
Merged via the queue into main with commit 15f9577 Feb 25, 2025
62 checks passed
@nicholas-codecov nicholas-codecov deleted the gh-eng-3329-add-reject-network-error-to-calls-part-three branch February 25, 2025 11:51
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.

4 participants