Skip to content

fix: Adjust Zod schema for owner to handle undefined#4038

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/zod-owner-nullish
Open

fix: Adjust Zod schema for owner to handle undefined#4038
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/zod-owner-nullish

Conversation

@sentry

@sentry sentry Bot commented Jul 11, 2026

Copy link
Copy Markdown

Description

This PR fixes a ZodError occurring in useUploadTokenRequired when the GraphQL API returns a response where the owner field is undefined (i.e., completely missing) instead of null.

The original schema used .nullable() for the owner object, which accepts null but rejects undefined. By changing it to .nullish(), the schema now correctly handles cases where the owner field might be absent from the API response, preventing the parsing error.

Code Example

Notable Changes

Changed the owner field schema from .nullable() to .nullish() in useUploadTokenRequired to correctly handle undefined API responses.

Screenshots

Link to Sample Entry

Legal Boilerplate

Look, I get it. The entity doing business as "Codecov" is owned by Harness, Inc. In 2026 Harness acquired Codecov and as a result Harness 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 Harness can use, modify, copy, and redistribute my contributions, under Harness's choice of terms.

Fixes GAZEBO-182A

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Bundle Report

Changes will decrease total bundle size by 2 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system 5.81MB -1 bytes (-0.0%) ⬇️
gazebo-production-esm 5.89MB -1 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 -1 bytes 657.7kB -0.0%

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

  • ./src/services/uploadTokenRequired/useUploadTokenRequired.tsx → Total Size: 1.0kB
view changes for bundle: gazebo-production-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index.*.js -1 bytes 577.75kB -0.0%

Files in assets/index.*.js:

  • ./src/services/uploadTokenRequired/useUploadTokenRequired.tsx → Total Size: 987 bytes

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
4263 1 4262 2
View the top 1 failed test(s) by shortest run time
src/services/uploadTokenRequired/useUploadTokenRequired.test.tsx > useUploadTokenRequired > when useUploadTokenRequired is called > unsuccessful parse of zod schema > throws a 404
Stack Traces | 1.07s run time
AssertionError: expected Error: ["GetUploadTokenRequired","gh","co… to deeply equal ObjectContaining{…}

Ignored nodes: comments, script, style
<html>
  <head />
  <body>
    <div />
  </body>
</html>

- Expected
+ Received

- ObjectContaining {
-   "dev": "useUploadTokenRequired - Parsing Error",
-   "status": 400,
- }
+ [Error: ["GetUploadTokenRequired","gh","codecov"] data is undefined]

 ❯ .../services/uploadTokenRequired/useUploadTokenRequired.test.tsx:132:40
 ❯ runWithExpensiveErrorDiagnosticsDisabled node_modules/@.../dom/dist/config.js:47:12
 ❯ checkCallback node_modules/@.../dom/dist/wait-for.js:124:77
 ❯ Timeout.checkRealTimersCallback node_modules/@.../dom/dist/wait-for.js:118:16

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@codecov-public-qa

codecov-public-qa Bot commented Jul 11, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
4263 1 4262 2
View the top 1 failed test(s) by shortest run time
src/services/uploadTokenRequired/useUploadTokenRequired.test.tsx > useUploadTokenRequired > when useUploadTokenRequired is called > unsuccessful parse of zod schema > throws a 404
Stack Traces | 1.07s run time
AssertionError: expected Error: ["GetUploadTokenRequired","gh","coto deeply equal ObjectContaining{…}

Ignored nodes: comments, script, style
<html>
  <head />
  <body>
    <div />
  </body>
</html>

- Expected
+ Received

- ObjectContaining {
-   "dev": "useUploadTokenRequired - Parsing Error",
-   "status": 400,
- }
+ [Error: ["GetUploadTokenRequired","gh","codecov"] data is undefined]

 ❯ .../services/uploadTokenRequired/useUploadTokenRequired.test.tsx:132:40runWithExpensiveErrorDiagnosticsDisabled node_modules/@.../dom/dist/config.js:47:12checkCallback node_modules/@.../dom/dist/wait-for.js:124:77Timeout.checkRealTimersCallback node_modules/@.../dom/dist/wait-for.js:118:16

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@codecov-releaser

Copy link
Copy Markdown
Collaborator

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
40abf90 Sat, 11 Jul 2026 05:16:50 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.

1 participant