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

chore: Migrate useOwner to ts #3601

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

chore: Migrate useOwner to ts #3601

wants to merge 2 commits into from

Conversation

suejung-sentry
Copy link
Contributor

@suejung-sentry suejung-sentry commented Dec 20, 2024

Migrate useOwner hook to ts, including adding zod schema validation.

Note based on a spot-check, I assumed the api for the useOwner (DetailOwner) graphQL schema declared here to be unreliable, so marked all fields here as nullish (can be null or undefined).
In theory if the schema were correct, we would expect below:

const OwnerSchema = z
  .object({
    ownerid: z.number().nullable(),
    username: z.string().nullable(),
    avatarUrl: z.string(),
    isCurrentUserPartOfOrg: z.boolean(),
    isAdmin: z.boolean().nullable(),
  })

But going through the tests and also the implementation of the owner fields, avatarUrl and username were missing (only present on the User schema, not the Owner schema). Also some of the fields didn't look nullable based on the api implementation but were treated as nullable downstream in frontend code.

In general, since the owner related fields are sensitive (can be the difference between whole pages of the app rendering or not), I left it to be looser in what we consider a schema failure in this TS conversion ticket. I spun off this ticket for later to make any necessary logical changes in api to make this zod schema stricter.

Closes codecov/engineering-team#2858

@codecov-staging
Copy link

codecov-staging bot commented Dec 20, 2024

Bundle Report

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

Detailed changes
Bundle name Size Change
gazebo-staging-system-esm 6.05MB 356 bytes (0.01%) ⬆️
gazebo-staging-system 6.0MB 351 bytes (0.01%) ⬆️

Copy link

codecov bot commented Dec 20, 2024

Bundle Report

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

Detailed changes
Bundle name Size Change
gazebo-production-system 6.0MB 351 bytes (0.01%) ⬆️
gazebo-production-system-esm 6.05MB 356 bytes (0.01%) ⬆️

Copy link

codecov bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.00%. Comparing base (96d9efe) to head (6deb723).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3601   +/-   ##
=======================================
  Coverage   99.00%   99.00%           
=======================================
  Files         810      810           
  Lines       14557    14562    +5     
  Branches     4146     4140    -6     
=======================================
+ Hits        14412    14417    +5     
  Misses        138      138           
  Partials        7        7           
Files with missing lines Coverage Δ
src/services/user/useOwner.ts 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.75% <ø> (ø)
Services 99.36% <100.00%> (+<0.01%) ⬆️
Shared 99.31% <ø> (ø)
UI 99.14% <ø> (ø)

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 96d9efe...6deb723. Read the comment docs.

@codecov-qa
Copy link

codecov-qa bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.00%. Comparing base (96d9efe) to head (6deb723).

✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main    #3601   +/-   ##
=======================================
  Coverage   99.00%   99.00%           
=======================================
  Files         810      810           
  Lines       14557    14562    +5     
  Branches     4139     4140    +1     
=======================================
+ Hits        14412    14417    +5     
  Misses        138      138           
  Partials        7        7           
Files with missing lines Coverage Δ
src/services/user/useOwner.ts 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.75% <ø> (ø)
Services 99.36% <100.00%> (+<0.01%) ⬆️
Shared 99.31% <ø> (ø)
UI 99.14% <ø> (ø)

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 96d9efe...6deb723. Read the comment docs.

@codecov-notifications
Copy link

codecov-notifications bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main    #3601   +/-   ##
=======================================
  Coverage   99.00%   99.00%           
=======================================
  Files         810      810           
  Lines       14557    14562    +5     
  Branches     4146     4140    -6     
=======================================
+ Hits        14412    14417    +5     
  Misses        138      138           
  Partials        7        7           
Files with missing lines Coverage Δ
src/services/user/useOwner.ts 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.75% <ø> (ø)
Services 99.36% <100.00%> (+<0.01%) ⬆️
Shared 99.31% <ø> (ø)
UI 99.14% <ø> (ø)

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 96d9efe...6deb723. Read the comment docs.

Copy link

codecov-public-qa bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.00%. Comparing base (96d9efe) to head (6deb723).

✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main    #3601   +/-   ##
=======================================
  Coverage   99.00%   99.00%           
=======================================
  Files         810      810           
  Lines       14557    14562    +5     
  Branches     4139     4140    +1     
=======================================
+ Hits        14412    14417    +5     
  Misses        138      138           
  Partials        7        7           
Files with missing lines Coverage Δ
src/services/user/useOwner.ts 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.75% <ø> (ø)
Services 99.36% <100.00%> (+<0.01%) ⬆️
Shared 99.31% <ø> (ø)
UI 99.14% <ø> (ø)

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 96d9efe...6deb723. Read the comment docs.

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Dec 20, 2024

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
a4fa5a5 Fri, 20 Dec 2024 02:38:01 GMT Expired Expired
6deb723 Fri, 20 Dec 2024 03:41:45 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.

useOwner
2 participants