Skip to content

fix(file-explorer): Filter null rows to prevent TypeError in coverage subtotal - #4126

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/coverage-subtotal-type-error
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/coverage-subtotal-type-error

Conversation

@sentry

@sentry sentry Bot commented Sep 13, 2026

Copy link
Copy Markdown

Description

This PR addresses a TypeError: can't access property "lines", M is null occurring in the coverage File Explorer's subtotal calculation.

Root Cause:
The useRepoBranchContentsTable hook, specifically in src/pages/RepoPage/CoverageTab/OverviewTab/subroute/FileExplorer/hooks/useRepoBranchContentsTable.tsx, maps over API results. If a result is null, it explicitly returns null (line 136). However, the resulting rawTableRows array is then cast as Row[] (line 185) without filtering out these null entries. This allows null values to propagate into the CodeTreeTable component.

When CodeTreeTable attempts to calculate column totals using data.reduce((sum, row) => { const value = row[columnId] ... }) in calculateColumnTotal (line 156-157), it tries to access properties like lines on these null row entries, leading to the TypeError.

Solution:
The fix involves adding .filter(Boolean) to the rawTableRows array in src/pages/RepoPage/CoverageTab/OverviewTab/subroute/FileExplorer/hooks/useRepoBranchContentsTable.tsx before it is cast to Row[]. This ensures that any null entries are removed from the array, preventing them from reaching CodeTreeTable and causing the TypeError during subtotal calculation.

Code Example

// Before:
const rawTableRows = data?.map((item) => {
  // ... logic that might return null ...
  return null; // Example of returning null
}) as Row[];

// After:
const rawTableRows = data?.map((item) => {
  // ... logic that might return null ...
  return null; // Example of returning null
}).filter(Boolean) as Row[];

Notable Changes

  • Fix TypeError: can't access property "lines", M is null in Coverage File Explorer.
  • Modified useRepoBranchContentsTable hook in src/pages/RepoPage/CoverageTab/OverviewTab/subroute/FileExplorer/hooks/useRepoBranchContentsTable.tsx.
  • Added .filter(Boolean) to rawTableRows array to remove null entries before casting to Row[], preventing null values from reaching CodeTreeTable and causing errors during subtotal calculation.

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-16AG

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

@sentry

sentry Bot commented Sep 13, 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 13, 2026

Copy link
Copy Markdown

Bundle Report

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

Detailed changes
Bundle name Size Change
gazebo-production-system 5.82MB 16 bytes (0.0%) ⬆️
gazebo-production-esm 5.89MB 16 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: gazebo-production-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index.*.js 16 bytes 89.98kB 0.02%

Files in assets/index.*.js:

  • ./src/pages/RepoPage/CoverageTab/OverviewTab/subroute/FileExplorer/hooks/useRepoBranchContentsTable.tsx → Total Size: 4.54kB
view changes for bundle: gazebo-production-system

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-legacy.*.js 16 bytes 84.73kB 0.02%

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

  • ./src/pages/RepoPage/CoverageTab/OverviewTab/subroute/FileExplorer/hooks/useRepoBranchContentsTable.tsx → Total Size: 4.54kB

@codecov

codecov Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.77%. Comparing base (b8fbfc0) to head (d6bf728).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4126   +/-   ##
=======================================
  Coverage   98.77%   98.77%           
=======================================
  Files         823      823           
  Lines       15147    15147           
  Branches     4387     4387           
=======================================
  Hits        14961    14961           
  Misses        179      179           
  Partials        7        7           
Files with missing lines Coverage Δ
.../FileExplorer/hooks/useRepoBranchContentsTable.tsx 100.00% <ø> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.72% <ø> (ø)
Pages 98.43% <ø> (ø)
Services 99.32% <ø> (ø)
Shared 98.94% <ø> (ø)
UI 99.02% <ø> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b8fbfc0...d6bf728. Read the comment docs.

@codecov-notifications

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main    #4126   +/-   ##
=======================================
  Coverage   98.77%   98.77%           
=======================================
  Files         823      823           
  Lines       15147    15147           
  Branches     4387     4379    -8     
=======================================
  Hits        14961    14961           
  Misses        179      179           
  Partials        7        7           
Files with missing lines Coverage Δ
.../FileExplorer/hooks/useRepoBranchContentsTable.tsx 100.00% <ø> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.72% <ø> (ø)
Pages 98.43% <ø> (ø)
Services 99.32% <ø> (ø)
Shared 98.94% <ø> (ø)
UI 99.02% <ø> (ø)

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 b8fbfc0...d6bf728. Read the comment docs.

@codecov-public-qa

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.77%. Comparing base (b8fbfc0) to head (d6bf728).

✅ All tests successful. No failed tests found.

@@           Coverage Diff           @@
##             main    #4126   +/-   ##
=======================================
  Coverage   98.77%   98.77%           
=======================================
  Files         823      823           
  Lines       15147    15147           
  Branches     4379     4379           
=======================================
  Hits        14961    14961           
  Misses        179      179           
  Partials        7        7           
Files with missing lines Coverage Δ
.../FileExplorer/hooks/useRepoBranchContentsTable.tsx 100.00% <ø> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.72% <ø> (ø)
Pages 98.43% <ø> (ø)
Services 99.32% <ø> (ø)
Shared 98.94% <ø> (ø)
UI 99.02% <ø> (ø)

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 b8fbfc0...d6bf728. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codecov-releaser

Copy link
Copy Markdown
Collaborator

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
d6bf728 Sun, 13 Sep 2026 22:51:28 GMT Cloud Enterprise

@codecov-qa

codecov-qa Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.77%. Comparing base (b8fbfc0) to head (d6bf728).

@@           Coverage Diff           @@
##             main    #4126   +/-   ##
=======================================
  Coverage   98.77%   98.77%           
=======================================
  Files         823      823           
  Lines       15147    15147           
  Branches     4387     4387           
=======================================
  Hits        14961    14961           
  Misses        179      179           
  Partials        7        7           
Files with missing lines Coverage Δ
.../FileExplorer/hooks/useRepoBranchContentsTable.tsx 100.00% <ø> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.72% <ø> (ø)
Pages 98.43% <ø> (ø)
Services 99.32% <ø> (ø)
Shared 98.94% <ø> (ø)
UI 99.02% <ø> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b8fbfc0...d6bf728. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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