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

Merged
merged 4 commits into from
Dec 23, 2024
Merged

chore: Migrate useOwner to ts #3601

merged 4 commits into from
Dec 23, 2024

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 decrease total bundle size by 6.14MB (-33.74%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-staging-system 6.0MB 354 bytes (0.01%) ⬆️
gazebo-staging-system-esm 6.05MB 359 bytes (0.01%) ⬆️
gazebo-staging-array-push (removed) 6.14MB (-100.0%) ⬇️

Copy link

codecov bot commented Dec 20, 2024

Bundle Report

Changes will decrease total bundle size by 12.14MB (-66.72%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system-esm 6.05MB 359 bytes (0.01%) ⬆️
gazebo-production-array-push (removed) 6.14MB (-100.0%) ⬇️
gazebo-production-system (removed) 6.0MB (-100.0%) ⬇️

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 (9ed135c) to head (f068ec5).
Report is 1 commits behind head on main.

✅ 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       14548    14554    +6     
  Branches     4143     4151    +8     
=======================================
+ Hits        14403    14409    +6     
  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.73% <ø> (ø)
Services 99.36% <100.00%> (+<0.01%) ⬆️
Shared 99.45% <ø> (ø)
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 9ed135c...f068ec5. 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 (9ed135c) to head (f068ec5).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main    #3601   +/-   ##
=======================================
  Coverage   99.00%   99.00%           
=======================================
  Files         810      810           
  Lines       14548    14554    +6     
  Branches     4143     4144    +1     
=======================================
+ Hits        14403    14409    +6     
  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.73% <ø> (ø)
Services 99.36% <100.00%> (+<0.01%) ⬆️
Shared 99.45% <ø> (ø)
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 9ed135c...f068ec5. 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       14548    14554    +6     
  Branches     4150     4144    -6     
=======================================
+ Hits        14403    14409    +6     
  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.73% <ø> (ø)
Services 99.36% <100.00%> (+<0.01%) ⬆️
Shared 99.45% <ø> (ø)
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 9ed135c...f068ec5. 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 (9ed135c) to head (f068ec5).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main    #3601   +/-   ##
=======================================
  Coverage   99.00%   99.00%           
=======================================
  Files         810      810           
  Lines       14548    14554    +6     
  Branches     4143     4151    +8     
=======================================
+ Hits        14403    14409    +6     
  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.73% <ø> (ø)
Services 99.36% <100.00%> (+<0.01%) ⬆️
Shared 99.45% <ø> (ø)
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 9ed135c...f068ec5. 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 Expired Expired
f068ec5 Mon, 23 Dec 2024 19:24:54 GMT Expired Expired
f068ec5 Mon, 23 Dec 2024 19:25:44 GMT Cloud Enterprise

@suejung-sentry suejung-sentry added this pull request to the merge queue Dec 23, 2024
Merged via the queue into main with commit aa4c740 Dec 23, 2024
62 checks passed
@suejung-sentry suejung-sentry deleted the sshin/2858 branch December 23, 2024 19:33
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
3 participants