Skip to content

chore: Add GraphQL type safety comment to FileComparisonWithBase fragment#4029

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/chore/graphql-type-safety-comment
Open

chore: Add GraphQL type safety comment to FileComparisonWithBase fragment#4029
sentry[bot] wants to merge 1 commit into
mainfrom
seer/chore/graphql-type-safety-comment

Conversation

@sentry

@sentry sentry Bot commented Jul 9, 2026

Copy link
Copy Markdown

Description

This PR adds a detailed comment to the FileComparisonWithBase GraphQL fragment in src/services/pull/fragments.ts.

The comment clarifies that any query utilizing this fragment, particularly when calling segments(filters: $filters), must declare the $filters variable as SegmentsFilters, not ImpactedFilesFilters.

This change addresses the root cause of a GraphQLError (API-EFP) where a variable of type ImpactedFilesFilters was used in a position expecting SegmentsFilters. While the specific problematic query (PullFile) has since been replaced in the codebase by ImpactedFileComparison (which correctly uses SegmentsFilters), the error was observed in production due to stale client bundles.

This comment serves as a preventative measure to ensure future development avoids reintroducing this type mismatch, improving GraphQL type safety and developer clarity.

Code Example

This PR adds a comment within the FileComparisonWithBase GraphQL fragment in src/services/pull/fragments.ts.

Notable Changes

  • Added a detailed comment to the FileComparisonWithBase GraphQL fragment in src/services/pull/fragments.ts.
  • The comment clarifies that queries using this fragment with segments(filters: $filters) must declare $filters as SegmentsFilters to prevent GraphQL type mismatches.
  • This change acts as a preventative measure against GraphQLError (API-EFP) related to incorrect variable types.

Screenshots

N/A

Link to Sample Entry

N/A

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 API-EFP

@codecov-public-qa

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
2877 1 2876 2
View the top 1 failed test(s) by shortest run time
src/pages/AccountSettings/tabs/OrgUploadToken/TokenlessSection/TokenlessSection.test.tsx > TokenlessSection > when "Required" option is selected > renders the "Cancel" button
Stack Traces | 1.11s run time
TestingLibraryElementError: Unable to find role="button" and name `/Cancel/`

Ignored nodes: comments, script, style
<body>
  <div>
    <div
      class="border border-ds-gray-secondary bg-ds-container"
    >
      <div
        class="border-b border-ds-gray-secondary p-5"
      >
        <div
          class="flex items-center gap-2"
        >
          <h2
            class="text-sm font-semibold"
          >
            Token authentication for public repositories
          </h2>
          <a
            class="
  font-sans cursor-pointer

  hover:underline

  focus:ring-2
 text-ds-blue-default inline-flex items-center gap-1"
            data-cy="tokenlessDocs"
            data-marketing="tokenlessDocs"
            href="https://docs.codecov.com/docs/codecov-tokens#uploading-without-a-token"
            target="_blank"
          >
            <span
              class="text-ds-primary"
            >
              learn more
            </span>
            <span
              class="text-ds-gray-quinary"
            >
              <svg
                class="w-4 h-4"
                data-icon=""
                data-testid=""
                fill="none"
                stroke="currentColor"
                viewBox="0 0 24 24"
                xmlns="http://www.w3.org/2000/svg"
              >
                <path
                  d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
                  stroke-linecap="round"
                  stroke-linejoin="round"
                  stroke-width="2"
                />
              </svg>
            </span>
          </a>
        </div>
      </div>
      <div
        class="m-5"
      >
        <p
          class="mb-3"
        >
          Select an authentication option
        </p>
        <div
          aria-required="false"
          class="flex gap-4 flex-row"
          dir="ltr"
          role="radiogroup"
          style="outline: none;"
          tabindex="0"
        >
          <button
            aria-checked="true"
            class="relative flex-1"
            data-radix-collection-item=""
            data-state="checked"
            data-testid="token-not-required-radio"
            id=":rk:"
            role="radio"
            tabindex="-1"
            type="button"
            value="not-required"
          >
            <div
              class="flex h-full flex-col justify-center gap-2 rounded-md border border-ds-gray-quaternary p-4"
            >
              <div
                class="relative flex items-center justify-between gap-4"
              >
                <label
                  class="text-left font-medium"
                  for=":rk:"
                >
                  Not required
                </label>
                <div
                  class="size-4 flex-none rounded-full border border-ds-gray-quaternary"
                  data-testid="radio-button-circle-unselected"
                />
                <span
                  class="absolute right-0"
                  data-state="checked"
                >
                  <div
                    class="flex size-4 items-center justify-center rounded-full bg-ds-blue-darker"
                  >
                    <div
                      class="size-1 rounded-full bg-ds-container"
                      data-testid="radio-button-circle-selected"
                    />
                  </div>
                </span>
              </div>
              <p
                class="text-left text-ds-gray-quinary"
              >
                When a token is not required, your team can upload coverage reports without one. Existing tokens will still work, and no action is needed for past uploads.
              </p>
            </div>
            <span
              class="absolute right-0 top-0 size-full rounded-md border-2 border-ds-blue-darker"
              data-state="checked"
            />
          </button>
          <button
            aria-checked="false"
            class="relative flex-1"
            data-radix-collection-item=""
            data-state="unchecked"
            data-testid="token-required-radio"
            id=":rm:"
            role="radio"
            tabindex="0"
            type="button"
            value="required"
          >
            <div
              class="flex h-full flex-col justify-center gap-2 rounded-md border border-ds-gray-quaternary p-4"
            >
              <div
                class="relative flex items-center justify-between gap-4"
              >
                <label
                  class="text-left font-medium"
                  for=":rm:"
                >
                  Required
                </label>
                <div
                  class="size-4 flex-none rounded-full border border-ds-gray-quaternary"
                  data-testid="radio-button-circle-unselected"
                />
              </div>
              <p
                class="text-left text-ds-gray-quinary"
              >
                When a token is required, your team must use a global or repo-specific token for uploads.
              </p>
            </div>
          </button>
        </div>
      </div>
    </div>
  </div>
</body>

Ignored nodes: comments, script, style
<body>
  <div>
    <div
      class="border border-ds-gray-secondary bg-ds-container"
    >
      <div
        class="border-b border-ds-gray-secondary p-5"
      >
        <div
          class="flex items-center gap-2"
        >
          <h2
            class="text-sm font-semibold"
          >
            Token authentication for public repositories
          </h2>
          <a
            class="
  font-sans cursor-pointer

  hover:underline

  focus:ring-2
 text-ds-blue-default inline-flex items-center gap-1"
            data-cy="tokenlessDocs"
            data-marketing="tokenlessDocs"
            href="https://docs.codecov.com/docs/codecov-tokens#uploading-without-a-token"
            target="_blank"
          >
            <span
              class="text-ds-primary"
            >
              learn more
            </span>
            <span
              class="text-ds-gray-quinary"
            >
              <svg
                class="w-4 h-4"
                data-icon=""
                data-testid=""
                fill="none"
                stroke="currentColor"
                viewBox="0 0 24 24"
                xmlns="http://www.w3.org/2000/svg"
              >
                <path
                  d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
                  stroke-linecap="round"
                  stroke-linejoin="round"
                  stroke-width="2"
                />
              </svg>
            </span>
          </a>
        </div>
      </div>
      <div
        class="m-5"
      >
        <p
          class="mb-3"
        >
          Select an authentication option
        </p>
        <div
          aria-required="false"
          class="flex gap-4 flex-row"
          dir="ltr"
          role="radiogroup"
          style="outline: none;"
          tabindex="0"
        >
          <button
            aria-checked="true"
            class="relative flex-1"
            data-radix-collection-item=""
            data-state="checked"
            data-testid="token-not-required-radio"
            id=":rk:"
            role="radio"
            tabindex="-1"
            type="button"
            value="not-required"
          >
            <div
              class="flex h-full flex-col justify-center gap-2 rounded-md border border-ds-gray-quaternary p-4"
            >
              <div
                class="relative flex items-center justify-between gap-4"
              >
                <label
                  class="text-left font-medium"
                  for=":rk:"
                >
                  Not required
                </label>
                <div
                  class="size-4 flex-none rounded-full border border-ds-gray-quaternary"
                  data-testid="radio-button-circle-unselected"
                />
                <span
                  class="absolute right-0"
                  data-state="checked"
                >
                  <div
                    class="flex size-4 items-center justify-center rounded-full bg-ds-blue-darker"
                  >
                    <div
                      class="size-1 rounded-full bg-ds-container"
                      data-testid="radio-button-circle-selected"
                    />
                  </div>
                </span>
              </div>
              <p
                class="text-left text-ds-gray-quinary"
              >
                When a token is not required, your team can upload coverage reports without one. Existing tokens will still work, and no action is needed for past uploads.
              </p>
            </div>
            <span
              class="absolute right-0 top-0 size-full rounded-md border-2 border-ds-blue-darker"
              data-state="checked"
            />
          </button>
          <button
            aria-checked="false"
            class="relative flex-1"
            data-radix-collection-item=""
            data-state="unchecked"
            data-testid="token-required-radio"
            id=":rm:"
            role="radio"
            tabindex="0"
            type="button"
            value="required"
          >
            <div
              class="flex h-full flex-col justify-center gap-2 rounded-md border border-ds-gray-quaternary p-4"
            >
              <div
                class="relative flex items-center justify-between gap-4"
              >
                <label
                  class="text-left font-medium"
                  for=":rm:"
                >
                  Required
                </label>
                <div
                  class="size-4 flex-none rounded-full border border-ds-gray-quaternary"
                  data-testid="radio-button-circle-unselected"
                />
              </div>
              <p
                class="text-left text-ds-gray-quinary"
              >
                When a token is required, your team must use a global or repo-specific token for uploads.
              </p>
            </div>
          </button>
        </div>
      </div>
    </div>
  </div>
</body>waitForWrapper node_modules/@.../dom/dist/wait-for.js:163:27node_modules/@.../dom/dist/query-helpers.js:86:33
 ❯ .../OrgUploadToken/TokenlessSection/TokenlessSection.test.tsx:165:41

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

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
2877 1 2876 2
View the top 1 failed test(s) by shortest run time
src/pages/AccountSettings/tabs/OrgUploadToken/TokenlessSection/TokenlessSection.test.tsx > TokenlessSection > when "Required" option is selected > renders the "Cancel" button
Stack Traces | 1.11s run time
TestingLibraryElementError: Unable to find role="button" and name `/Cancel/`

Ignored nodes: comments, script, style
<body>
  <div>
    <div
      class="border border-ds-gray-secondary bg-ds-container"
    >
      <div
        class="border-b border-ds-gray-secondary p-5"
      >
        <div
          class="flex items-center gap-2"
        >
          <h2
            class="text-sm font-semibold"
          >
            Token authentication for public repositories
          </h2>
          <a
            class="
  font-sans cursor-pointer

  hover:underline

  focus:ring-2
 text-ds-blue-default inline-flex items-center gap-1"
            data-cy="tokenlessDocs"
            data-marketing="tokenlessDocs"
            href="https://docs.codecov.com/docs/codecov-tokens#uploading-without-a-token"
            target="_blank"
          >
            <span
              class="text-ds-primary"
            >
              learn more
            </span>
            <span
              class="text-ds-gray-quinary"
            >
              <svg
                class="w-4 h-4"
                data-icon=""
                data-testid=""
                fill="none"
                stroke="currentColor"
                viewBox="0 0 24 24"
                xmlns="http://www.w3.org/2000/svg"
              >
                <path
                  d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
                  stroke-linecap="round"
                  stroke-linejoin="round"
                  stroke-width="2"
                />
              </svg>
            </span>
          </a>
        </div>
      </div>
      <div
        class="m-5"
      >
        <p
          class="mb-3"
        >
          Select an authentication option
        </p>
        <div
          aria-required="false"
          class="flex gap-4 flex-row"
          dir="ltr"
          role="radiogroup"
          style="outline: none;"
          tabindex="0"
        >
          <button
            aria-checked="true"
            class="relative flex-1"
            data-radix-collection-item=""
            data-state="checked"
            data-testid="token-not-required-radio"
            id=":rk:"
            role="radio"
            tabindex="-1"
            type="button"
            value="not-required"
          >
            <div
              class="flex h-full flex-col justify-center gap-2 rounded-md border border-ds-gray-quaternary p-4"
            >
              <div
                class="relative flex items-center justify-between gap-4"
              >
                <label
                  class="text-left font-medium"
                  for=":rk:"
                >
                  Not required
                </label>
                <div
                  class="size-4 flex-none rounded-full border border-ds-gray-quaternary"
                  data-testid="radio-button-circle-unselected"
                />
                <span
                  class="absolute right-0"
                  data-state="checked"
                >
                  <div
                    class="flex size-4 items-center justify-center rounded-full bg-ds-blue-darker"
                  >
                    <div
                      class="size-1 rounded-full bg-ds-container"
                      data-testid="radio-button-circle-selected"
                    />
                  </div>
                </span>
              </div>
              <p
                class="text-left text-ds-gray-quinary"
              >
                When a token is not required, your team can upload coverage reports without one. Existing tokens will still work, and no action is needed for past uploads.
              </p>
            </div>
            <span
              class="absolute right-0 top-0 size-full rounded-md border-2 border-ds-blue-darker"
              data-state="checked"
            />
          </button>
          <button
            aria-checked="false"
            class="relative flex-1"
            data-radix-collection-item=""
            data-state="unchecked"
            data-testid="token-required-radio"
            id=":rm:"
            role="radio"
            tabindex="0"
            type="button"
            value="required"
          >
            <div
              class="flex h-full flex-col justify-center gap-2 rounded-md border border-ds-gray-quaternary p-4"
            >
              <div
                class="relative flex items-center justify-between gap-4"
              >
                <label
                  class="text-left font-medium"
                  for=":rm:"
                >
                  Required
                </label>
                <div
                  class="size-4 flex-none rounded-full border border-ds-gray-quaternary"
                  data-testid="radio-button-circle-unselected"
                />
              </div>
              <p
                class="text-left text-ds-gray-quinary"
              >
                When a token is required, your team must use a global or repo-specific token for uploads.
              </p>
            </div>
          </button>
        </div>
      </div>
    </div>
  </div>
</body>

Ignored nodes: comments, script, style
<body>
  <div>
    <div
      class="border border-ds-gray-secondary bg-ds-container"
    >
      <div
        class="border-b border-ds-gray-secondary p-5"
      >
        <div
          class="flex items-center gap-2"
        >
          <h2
            class="text-sm font-semibold"
          >
            Token authentication for public repositories
          </h2>
          <a
            class="
  font-sans cursor-pointer

  hover:underline

  focus:ring-2
 text-ds-blue-default inline-flex items-center gap-1"
            data-cy="tokenlessDocs"
            data-marketing="tokenlessDocs"
            href="https://docs.codecov.com/docs/codecov-tokens#uploading-without-a-token"
            target="_blank"
          >
            <span
              class="text-ds-primary"
            >
              learn more
            </span>
            <span
              class="text-ds-gray-quinary"
            >
              <svg
                class="w-4 h-4"
                data-icon=""
                data-testid=""
                fill="none"
                stroke="currentColor"
                viewBox="0 0 24 24"
                xmlns="http://www.w3.org/2000/svg"
              >
                <path
                  d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
                  stroke-linecap="round"
                  stroke-linejoin="round"
                  stroke-width="2"
                />
              </svg>
            </span>
          </a>
        </div>
      </div>
      <div
        class="m-5"
      >
        <p
          class="mb-3"
        >
          Select an authentication option
        </p>
        <div
          aria-required="false"
          class="flex gap-4 flex-row"
          dir="ltr"
          role="radiogroup"
          style="outline: none;"
          tabindex="0"
        >
          <button
            aria-checked="true"
            class="relative flex-1"
            data-radix-collection-item=""
            data-state="checked"
            data-testid="token-not-required-radio"
            id=":rk:"
            role="radio"
            tabindex="-1"
            type="button"
            value="not-required"
          >
            <div
              class="flex h-full flex-col justify-center gap-2 rounded-md border border-ds-gray-quaternary p-4"
            >
              <div
                class="relative flex items-center justify-between gap-4"
              >
                <label
                  class="text-left font-medium"
                  for=":rk:"
                >
                  Not required
                </label>
                <div
                  class="size-4 flex-none rounded-full border border-ds-gray-quaternary"
                  data-testid="radio-button-circle-unselected"
                />
                <span
                  class="absolute right-0"
                  data-state="checked"
                >
                  <div
                    class="flex size-4 items-center justify-center rounded-full bg-ds-blue-darker"
                  >
                    <div
                      class="size-1 rounded-full bg-ds-container"
                      data-testid="radio-button-circle-selected"
                    />
                  </div>
                </span>
              </div>
              <p
                class="text-left text-ds-gray-quinary"
              >
                When a token is not required, your team can upload coverage reports without one. Existing tokens will still work, and no action is needed for past uploads.
              </p>
            </div>
            <span
              class="absolute right-0 top-0 size-full rounded-md border-2 border-ds-blue-darker"
              data-state="checked"
            />
          </button>
          <button
            aria-checked="false"
            class="relative flex-1"
            data-radix-collection-item=""
            data-state="unchecked"
            data-testid="token-required-radio"
            id=":rm:"
            role="radio"
            tabindex="0"
            type="button"
            value="required"
          >
            <div
              class="flex h-full flex-col justify-center gap-2 rounded-md border border-ds-gray-quaternary p-4"
            >
              <div
                class="relative flex items-center justify-between gap-4"
              >
                <label
                  class="text-left font-medium"
                  for=":rm:"
                >
                  Required
                </label>
                <div
                  class="size-4 flex-none rounded-full border border-ds-gray-quaternary"
                  data-testid="radio-button-circle-unselected"
                />
              </div>
              <p
                class="text-left text-ds-gray-quinary"
              >
                When a token is required, your team must use a global or repo-specific token for uploads.
              </p>
            </div>
          </button>
        </div>
      </div>
    </div>
  </div>
</body>
 ❯ waitForWrapper node_modules/@.../dom/dist/wait-for.js:163:27
 ❯ node_modules/@.../dom/dist/query-helpers.js:86:33
 ❯ .../OrgUploadToken/TokenlessSection/TokenlessSection.test.tsx:165:41

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
6b2cf4c Thu, 09 Jul 2026 14:51:33 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