Skip to content

fix: Handle segments ProviderError #3852

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

Merged
merged 4 commits into from
Apr 28, 2025
Merged

fix: Handle segments ProviderError #3852

merged 4 commits into from
Apr 28, 2025

Conversation

suejung-sentry
Copy link
Contributor

@suejung-sentry suejung-sentry commented Apr 23, 2025

Handle when segments returns ProviderError or UnknownPath here.

Closes codecov/engineering-team#3485
Screenshot 2025-04-25 at 9 56 49 AM
Screenshot 2025-04-25 at 9 57 24 AM

Copy link

codecov bot commented Apr 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.72%. Comparing base (8267885) to head (db32dfe).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3852   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files         827      827           
  Lines       15006    15031   +25     
  Branches     4293     4297    +4     
=======================================
+ Hits        14815    14840   +25     
  Misses        184      184           
  Partials        7        7           
Files with missing lines Coverage Δ
...hangedTab/shared/CommitFileDiff/CommitFileDiff.tsx 98.14% <100.00%> (+0.52%) ⬆️
...rectChangesTable/CommitFileDiff/CommitFileDiff.tsx 98.18% <100.00%> (+0.50%) ⬆️
src/services/comparison/constants.ts 100.00% <ø> (ø)
...ommitAndParent/useComparisonForCommitAndParent.tsx 100.00% <ø> (ø)
src/services/navigation/useStaticNavLinks.ts 98.86% <100.00%> (+0.01%) ⬆️
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.28% <100.00%> (+<0.01%) ⬆️
Services 99.35% <100.00%> (+<0.01%) ⬆️
Shared 99.11% <ø> (ø)
UI 99.15% <ø> (ø)

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 8267885...db32dfe. Read the comment docs.

@codecov-qa
Copy link

codecov-qa bot commented Apr 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.72%. Comparing base (8267885) to head (db32dfe).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main    #3852   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files         827      827           
  Lines       15006    15031   +25     
  Branches     4293     4297    +4     
=======================================
+ Hits        14815    14840   +25     
  Misses        184      184           
  Partials        7        7           
Files with missing lines Coverage Δ
...hangedTab/shared/CommitFileDiff/CommitFileDiff.tsx 98.14% <100.00%> (+0.52%) ⬆️
...rectChangesTable/CommitFileDiff/CommitFileDiff.tsx 98.18% <100.00%> (+0.50%) ⬆️
src/services/comparison/constants.ts 100.00% <ø> (ø)
...ommitAndParent/useComparisonForCommitAndParent.tsx 100.00% <ø> (ø)
src/services/navigation/useStaticNavLinks.ts 98.86% <100.00%> (+0.01%) ⬆️
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.28% <100.00%> (+<0.01%) ⬆️
Services 99.35% <100.00%> (+<0.01%) ⬆️
Shared 99.11% <ø> (ø)
UI 99.15% <ø> (ø)

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 8267885...db32dfe. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

codecov-public-qa bot commented Apr 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.72%. Comparing base (8267885) to head (db32dfe).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main    #3852   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files         827      827           
  Lines       15006    15031   +25     
  Branches     4285     4297   +12     
=======================================
+ Hits        14815    14840   +25     
  Misses        184      184           
  Partials        7        7           
Files with missing lines Coverage Δ
...hangedTab/shared/CommitFileDiff/CommitFileDiff.tsx 98.14% <100.00%> (+0.52%) ⬆️
...rectChangesTable/CommitFileDiff/CommitFileDiff.tsx 98.18% <100.00%> (+0.50%) ⬆️
src/services/comparison/constants.ts 100.00% <ø> (ø)
...ommitAndParent/useComparisonForCommitAndParent.tsx 100.00% <ø> (ø)
src/services/navigation/useStaticNavLinks.ts 98.86% <100.00%> (+0.01%) ⬆️
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.28% <100.00%> (+<0.01%) ⬆️
Services 99.35% <100.00%> (+<0.01%) ⬆️
Shared 99.11% <ø> (ø)
UI 99.15% <ø> (ø)

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 8267885...db32dfe. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codecov-staging
Copy link

codecov-staging bot commented Apr 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main    #3852   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files         827      827           
  Lines       15006    15031   +25     
  Branches     4285     4297   +12     
=======================================
+ Hits        14815    14840   +25     
  Misses        184      184           
  Partials        7        7           
Files with missing lines Coverage Δ
...hangedTab/shared/CommitFileDiff/CommitFileDiff.tsx 98.14% <100.00%> (+0.52%) ⬆️
...rectChangesTable/CommitFileDiff/CommitFileDiff.tsx 98.18% <100.00%> (+0.50%) ⬆️
src/services/comparison/constants.ts 100.00% <ø> (ø)
...ommitAndParent/useComparisonForCommitAndParent.tsx 100.00% <ø> (ø)
src/services/navigation/useStaticNavLinks.ts 98.86% <100.00%> (+0.01%) ⬆️
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.28% <100.00%> (+<0.01%) ⬆️
Services 99.35% <100.00%> (+<0.01%) ⬆️
Shared 99.11% <ø> (ø)
UI 99.15% <ø> (ø)

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 8267885...db32dfe. Read the comment docs.

@suejung-sentry suejung-sentry force-pushed the sshin/1317 branch 2 times, most recently from acf7d29 to 6731c18 Compare April 24, 2025 00:40
Copy link

codecov bot commented Apr 24, 2025

Bundle Report

Changes will increase total bundle size by 4.71kB (0.04%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system 6.21MB 2.29kB (0.04%) ⬆️
gazebo-production-esm 6.29MB 2.42kB (0.04%) ⬆️

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 118 bytes 716.84kB 0.02%
assets/index-legacy.*.js 2.17kB 115.89kB 1.91%

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

  • ./src/services/navigation/useStaticNavLinks.ts → Total Size: 16.99kB

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

  • ./src/services/comparison/constants.ts → Total Size: 1.03kB

  • ./src/pages/CommitDetailPage/CommitCoverage/routes/IndirectChangesTab/IndirectChangesTable/CommitFileDiff/CommitFileDiff.tsx → Total Size: 6.04kB

  • ./src/pages/CommitDetailPage/CommitCoverage/routes/FilesChangedTab/shared/CommitFileDiff/CommitFileDiff.tsx → Total Size: 6.06kB

  • ./src/services/comparison/useComparisonForCommitAndParent/useComparisonForCommitAndParent.tsx → Total Size: 4.22kB

view changes for bundle: gazebo-production-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index.*.js 2.3kB 127.33kB 1.84%
assets/index.*.js 118 bytes 639.45kB 0.02%

Files in assets/index.*.js:

  • ./src/pages/CommitDetailPage/CommitCoverage/routes/FilesChangedTab/shared/CommitFileDiff/CommitFileDiff.tsx → Total Size: 6.06kB

  • ./src/pages/CommitDetailPage/CommitCoverage/routes/IndirectChangesTab/IndirectChangesTable/CommitFileDiff/CommitFileDiff.tsx → Total Size: 6.04kB

  • ./src/services/comparison/useComparisonForCommitAndParent/useComparisonForCommitAndParent.tsx → Total Size: 4.22kB

  • ./src/services/comparison/constants.ts → Total Size: 1.03kB

Files in assets/index.*.js:

  • ./src/services/navigation/useStaticNavLinks.ts → Total Size: 16.99kB

Copy link
Contributor

✅ Sentry found no issues in your recent changes ✅

@codecov-staging
Copy link

codecov-staging bot commented Apr 24, 2025

Bundle Report

Changes will increase total bundle size by 4.71kB (0.04%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-staging-system 6.21MB 2.29kB (0.04%) ⬆️
gazebo-staging-esm 6.29MB 2.42kB (0.04%) ⬆️

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 2.17kB 115.89kB 1.91%
assets/index-legacy.*.js 118 bytes 716.84kB 0.02%

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

  • ./src/services/comparison/constants.ts → Total Size: 1.03kB

  • ./src/services/comparison/useComparisonForCommitAndParent/useComparisonForCommitAndParent.tsx → Total Size: 4.22kB

  • ./src/pages/CommitDetailPage/CommitCoverage/routes/IndirectChangesTab/IndirectChangesTable/CommitFileDiff/CommitFileDiff.tsx → Total Size: 6.04kB

  • ./src/pages/CommitDetailPage/CommitCoverage/routes/FilesChangedTab/shared/CommitFileDiff/CommitFileDiff.tsx → Total Size: 6.06kB

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

  • ./src/services/navigation/useStaticNavLinks.ts → Total Size: 16.99kB
view changes for bundle: gazebo-staging-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index.*.js 2.3kB 127.33kB 1.84%
assets/index.*.js 118 bytes 639.45kB 0.02%

Files in assets/index.*.js:

  • ./src/pages/CommitDetailPage/CommitCoverage/routes/FilesChangedTab/shared/CommitFileDiff/CommitFileDiff.tsx → Total Size: 6.06kB

  • ./src/services/comparison/useComparisonForCommitAndParent/useComparisonForCommitAndParent.tsx → Total Size: 4.22kB

  • ./src/services/comparison/constants.ts → Total Size: 1.03kB

  • ./src/pages/CommitDetailPage/CommitCoverage/routes/IndirectChangesTab/IndirectChangesTable/CommitFileDiff/CommitFileDiff.tsx → Total Size: 6.04kB

Files in assets/index.*.js:

  • ./src/services/navigation/useStaticNavLinks.ts → Total Size: 16.99kB

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Apr 24, 2025

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
6731c18 Thu, 24 Apr 2025 00:46:12 GMT Expired Expired
d89167c Thu, 24 Apr 2025 01:05:30 GMT Expired Expired
5c887ba Thu, 24 Apr 2025 20:59:34 GMT Expired Expired
db32dfe Fri, 25 Apr 2025 17:07:43 GMT Cloud Enterprise

return <DiffRenderer impactedFile={comparisonData.impactedFile} path={path} />
// since above we've handled when segments is of one of the other union types,
// we can safely assert that it's of type SegmentComparisons now
const impactedFile = comparisonData.impactedFile as ImpactedFileType

Choose a reason for hiding this comment

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

Do you need to assert this? TS should automatically narrow it. If it's not doing that, a case may be missed in the conditional 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm yeah I think the problem was that the type narrowing only applied to the top-level variable, but didn't carry through to the nested property access. I wasn't able to get it to infer the narrowed type in that deeper context, so did that uglier workaround.
I pulled out the value into a separate variable, and that seems to have allowed TypeScript to apply the narrowing correctly, so we can go with this version!

Choose a reason for hiding this comment

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

Let's goooo

return <DiffRenderer impactedFile={comparisonData.impactedFile} path={path} />
// since above we've handled when segments is of one of the other union types,
// we can safely assert that it's of type SegmentComparisons now
const impactedFile = comparisonData.impactedFile as ImpactedFileType

Choose a reason for hiding this comment

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

Same thing down here, TS narrowing should make it so we don't need to cast types

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks yeah same as above ^

!comparisonData?.impactedFile ||
!path ||
hadErrorFetchingFileFromProvider
) {
return <ErrorDisplayMessage />

Choose a reason for hiding this comment

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

Are we able to display a more helpful error message for these new errors that we're detecting? To better inform the user what's going on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah sure good call. The existing one was appropriate for the ProviderError and I added one for the UnknownPath error

@suejung-sentry suejung-sentry added this pull request to the merge queue Apr 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 28, 2025
@suejung-sentry suejung-sentry added this pull request to the merge queue Apr 28, 2025
Merged via the queue into main with commit ebeb86f Apr 28, 2025
64 checks passed
@suejung-sentry suejung-sentry deleted the sshin/1317 branch April 28, 2025 17:06
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.

Git Provider failures within GraphQL queries are silently swallowed
4 participants