Skip to content
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

fix: Show tests tab for public repos without a user being logged in #3200

Merged
merged 5 commits into from
Sep 17, 2024

Conversation

RulaKhaled
Copy link
Contributor

Description

As long as

  • a repo is sending test failures
  • is public

Show the tab even if a user is not logged in (icognito mode etc).

Notable Changes

  • Update repo tabs
  • Update repo routes

Link to Sample Entry

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.

@codecov-staging
Copy link

codecov-staging bot commented Sep 16, 2024

Bundle Report

Changes will increase total bundle size by 3.13kB ⬆️

Bundle name Size Change
gazebo-staging-array-push 6.0MB 3.13kB ⬆️

@codecov-qa
Copy link

codecov-qa bot commented Sep 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.15%. Comparing base (1f8f915) to head (899f483).
Report is 3 commits behind head on main.

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3200   +/-   ##
=======================================
  Coverage   98.15%   98.15%           
=======================================
  Files         930      932    +2     
  Lines       14456    14478   +22     
  Branches     3950     3875   -75     
=======================================
+ Hits        14189    14211   +22     
  Misses        262      262           
  Partials        5        5           
Files with missing lines Coverage Δ
src/pages/RepoPage/RepoPage.tsx 100.00% <100.00%> (ø)
src/pages/RepoPage/RepoPageTabs.tsx 100.00% <100.00%> (ø)

... and 4 files with indirect coverage changes

Components Coverage Δ
Assets 53.48% <ø> (ø)
Layouts 98.87% <ø> (ø)
Pages 98.91% <100.00%> (+<0.01%) ⬆️
Services 99.44% <ø> (ø)
Shared 99.65% <ø> (+<0.01%) ⬆️
UI 94.56% <ø> (ø)

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 1f8f915...899f483. Read the comment docs.

Copy link

codecov-public-qa bot commented Sep 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.15%. Comparing base (1f8f915) to head (899f483).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3200   +/-   ##
=======================================
  Coverage   98.15%   98.15%           
=======================================
  Files         930      932    +2     
  Lines       14456    14478   +22     
  Branches     3923     3956   +33     
=======================================
+ Hits        14189    14211   +22     
  Misses        262      262           
  Partials        5        5           
Files Coverage Δ
src/pages/RepoPage/RepoPage.tsx 100.00% <100.00%> (ø)
src/pages/RepoPage/RepoPageTabs.tsx 100.00% <100.00%> (ø)

... and 4 files with indirect coverage changes

Components Coverage Δ
Assets 53.48% <ø> (ø)
Layouts 98.87% <ø> (ø)
Pages 98.91% <100.00%> (+<0.01%) ⬆️
Services 99.44% <ø> (ø)
Shared 99.65% <ø> (+<0.01%) ⬆️
UI 94.56% <ø> (ø)

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 1f8f915...899f483. Read the comment docs.

Copy link

codecov bot commented Sep 16, 2024

Bundle Report

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

Detailed changes
Bundle name Size Change
gazebo-production-array-push 6.0MB 3.13kB ⬆️

Copy link

codecov bot commented Sep 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.15%. Comparing base (1f8f915) to head (899f483).
Report is 3 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##               main      #3200   +/-   ##
===========================================
  Coverage   98.15000   98.15000           
===========================================
  Files           930        932    +2     
  Lines         14456      14478   +22     
  Branches       3955       3956    +1     
===========================================
+ Hits          14189      14211   +22     
  Misses          262        262           
  Partials          5          5           
Files with missing lines Coverage Δ
src/pages/RepoPage/RepoPage.tsx 100.00% <100.00%> (ø)
src/pages/RepoPage/RepoPageTabs.tsx 100.00% <100.00%> (ø)

... and 4 files with indirect coverage changes

Components Coverage Δ
Assets 53.48% <ø> (ø)
Layouts 98.87% <ø> (ø)
Pages 98.91% <100.00%> (+<0.01%) ⬆️
Services 99.44% <ø> (ø)
Shared 99.65% <ø> (+<0.01%) ⬆️
UI 94.56% <ø> (ø)

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 1f8f915...899f483. Read the comment docs.

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Sep 16, 2024

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
0a5678e Mon, 16 Sep 2024 10:26:13 GMT Expired Expired
c1fbb83 Mon, 16 Sep 2024 10:47:47 GMT Expired Expired
1706690 Mon, 16 Sep 2024 10:57:11 GMT Expired Expired
58f8d54 Tue, 17 Sep 2024 10:30:06 GMT Expired Expired
899f483 Tue, 17 Sep 2024 16:23:29 GMT Cloud Enterprise

@codecov-notifications
Copy link

codecov-notifications bot commented Sep 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3200   +/-   ##
=======================================
  Coverage   98.15%   98.15%           
=======================================
  Files         930      932    +2     
  Lines       14456    14478   +22     
  Branches     3869     3875    +6     
=======================================
+ Hits        14189    14211   +22     
  Misses        262      262           
  Partials        5        5           
Files Coverage Δ
src/pages/RepoPage/RepoPage.tsx 100.00% <100.00%> (ø)
src/pages/RepoPage/RepoPageTabs.tsx 100.00% <100.00%> (ø)

... and 4 files with indirect coverage changes

Components Coverage Δ
Assets 53.48% <ø> (ø)
Layouts 98.87% <ø> (ø)
Pages 98.91% <100.00%> (+<0.01%) ⬆️
Services 99.44% <ø> (ø)
Shared 99.65% <ø> (+<0.01%) ⬆️
UI 94.56% <ø> (ø)

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 1f8f915...899f483. Read the comment docs.

@@ -310,6 +316,7 @@ function RepoPage() {
isRepoPrivate={isRepoPrivate}
isCurrentUserActivated={isCurrentUserActivated}
testAnalyticsEnabled={repoOverview?.testAnalyticsEnabled}
isCurrentUserPartOfOrg={repoData?.isCurrentUserPartOfOrg || false}
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need the || false check here? if repoData?.isCurrentUserPartOfOrg is undefined it'll still be a falsey value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes if we want to explicitly set it to boolean, it's the pattern used in this component (see isRepoActivated, isRepoActive)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah okay makes sense! Only thing I'd say then if we're looking for a boolean is we can utilize the !! syntax to cast a variable to its boolean equivalent

But that's a nit if anything

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure thing!

@@ -98,11 +98,18 @@ export const useRepoTabs = ({ refetchEnabled }: UseRepoTabsArgs) => {
})
}

if (isCurrentUserPartOfOrg) {
if (repoOverview?.testAnalyticsEnabled) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch!

]

await waitFor(() =>
expect(result.current).not.toEqual(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we put what is expected here rather than .not() and have the variable name "expectedTab?" Would reduce cognitive burden here imo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure i will add that as part of the test.

I'm specifically checking for the tab's existence because if analytics isn't enabled, it shouldn't appear—unless it's the specific case being tested. It's a bit more unique to this scenario.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also nice catch for the variable name!

Copy link
Contributor

@ajay-sentry ajay-sentry left a comment

Choose a reason for hiding this comment

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

looks good!

@RulaKhaled RulaKhaled added this pull request to the merge queue Sep 17, 2024
Merged via the queue into main with commit 0865720 Sep 17, 2024
62 checks passed
@RulaKhaled RulaKhaled deleted the show-failed-tests-for-not-logged-in-users branch September 17, 2024 16:23
Copy link

sentry-io bot commented Sep 18, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ TypeError: Failed to fetch /:provider/:owner/:repo/pulls View Issue
  • ‼️ TypeError: Failed to fetch /:provider/:owner/:repo View Issue

Did you find this useful? React with a 👍 or 👎

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