Skip to content

fix(bundle-analysis): Handle UnauthorizedError in bundle cache mutation - #4120

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/bundle-cache-unauthorized-error
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/bundle-cache-unauthorized-error

Conversation

@sentry

@sentry sentry Bot commented Sep 11, 2026

Copy link
Copy Markdown

Description

This PR resolves a ZodError that occurred when the updateBundleCacheConfig GraphQL mutation returned an UnauthorizedError.

The root cause was that the frontend's MutationErrorSchema (Zod schema) and the GraphQL query fragment in useUpdateBundleCache.tsx did not account for the UnauthorizedError type, which is part of the backend's UpdateBundleCacheConfigError union.

Code Example

// Example of schema modification
const MutationErrorSchema = z.discriminatedUnion("__typename", [
  // ... existing errors
  z.object({
    __typename: z.literal("UnauthorizedError"),
    message: z.string(),
  }),
]);

// Example of GraphQL fragment addition
fragment UpdateBundleCacheConfigErrorFragment on UpdateBundleCacheConfigError {
  __typename
  ... on UnauthorizedError {
    message
  }
  // ... other error types
}

// Example of handling in mutation response
if (error.__typename === "UnauthorizedError") {
  // handle UnauthorizedError
}

Notable Changes

  • Added UnauthorizedError to the MutationErrorSchema discriminated union in src/services/bundleAnalysis/useUpdateBundleCache.tsx.
  • Included ... on UnauthorizedError { message } in the GraphQL query fragment to fetch the error message.
  • Added an if condition to handle UnauthorizedError in the mutation response, allowing it to be properly rejected and handled by the caller.

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-17XP

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@sentry

sentry Bot commented Sep 11, 2026

Copy link
Copy Markdown
Author

⚠️ Seer needs additional GitHub permissions

Seer wants to keep iterating on this pull request to get CI passing, but the Sentry GitHub App installation is missing permissions it needs to read the failing checks and push a fix.

Review and accept the updated permissions to let Seer continue: https://github.com/organizations/codecov/settings/installations/86101127/permissions/update

@codecov

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Bundle Report

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

Detailed changes
Bundle name Size Change
gazebo-production-system 5.82MB 246 bytes (0.0%) ⬆️
gazebo-production-esm 5.9MB 316 bytes (0.01%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: gazebo-production-system

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/ConfigureCachedBundleModal-legacy.*.js 246 bytes 8.17kB 3.1%

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

  • ./src/services/bundleAnalysis/useUpdateBundleCache.tsx → Total Size: 3.1kB
view changes for bundle: gazebo-production-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/ConfigureCachedBundleModal.*.js 316 bytes 8.68kB 3.78%

Files in assets/ConfigureCachedBundleModal.*.js:

  • ./src/services/bundleAnalysis/useUpdateBundleCache.tsx → Total Size: 3.1kB

@codecov-releaser

Copy link
Copy Markdown
Collaborator

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
6ad4264 Fri, 11 Sep 2026 10:58:59 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