Skip to content

Conversation

@ajay-sentry
Copy link
Contributor

@ajay-sentry ajay-sentry commented Oct 2, 2025

This PR includes a new Test Results Chart Component to show some data on the frontend

Link to Sample Entry

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry 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 Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@sentry

This comment has been minimized.

@codecov-notifications
Copy link

codecov-notifications bot commented Oct 2, 2025

Codecov Report

❌ Patch coverage is 0% with 88 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...e/components/TestResultsChart/TestResultsChart.tsx 0.00% 71 Missing and 17 partials ⚠️
@@            Coverage Diff             @@
##             main    #3942      +/-   ##
==========================================
- Coverage   98.62%   98.04%   -0.58%     
==========================================
  Files         828      829       +1     
  Lines       15099    15213     +114     
  Branches     4326     4382      +56     
==========================================
+ Hits        14891    14916      +25     
- Misses        200      272      +72     
- Partials        8       25      +17     
Files with missing lines Coverage Δ
...e/components/TestResultsChart/TestResultsChart.tsx 0.00% <0.00%> (ø)

... and 11 files with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 97.12% <0.00%> (-1.01%) ⬇️
Services 99.32% <ø> (ø)
Shared 99.06% <ø> (-0.07%) ⬇️
UI 99.01% <ø> (ø)

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 8816d1e...82f0927. Read the comment docs.

@codecov-public-qa
Copy link

codecov-public-qa bot commented Oct 2, 2025

Codecov Report

Attention: Patch coverage is 0% with 88 lines in your changes missing coverage. Please review.

Project coverage is 98.04%. Comparing base (8816d1e) to head (82f0927).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...e/components/TestResultsChart/TestResultsChart.tsx 0.00% 71 Missing and 17 partials ⚠️
@@            Coverage Diff             @@
##             main    #3942      +/-   ##
==========================================
- Coverage   98.62%   98.04%   -0.58%     
==========================================
  Files         828      829       +1     
  Lines       15099    15213     +114     
  Branches     4318     4382      +64     
==========================================
+ Hits        14891    14916      +25     
- Misses        200      272      +72     
- Partials        8       25      +17     
Files with missing lines Coverage Δ
...e/components/TestResultsChart/TestResultsChart.tsx 0.00% <0.00%> (ø)

... and 11 files with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 97.12% <0.00%> (-1.01%) ⬇️
Services 99.32% <ø> (ø)
Shared 99.06% <ø> (-0.07%) ⬇️
UI 99.01% <ø> (ø)

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 8816d1e...82f0927. 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-qa
Copy link

codecov-qa bot commented Oct 2, 2025

Codecov Report

❌ Patch coverage is 0% with 88 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.04%. Comparing base (8816d1e) to head (82f0927).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...e/components/TestResultsChart/TestResultsChart.tsx 0.00% 71 Missing and 17 partials ⚠️
@@            Coverage Diff             @@
##             main    #3942      +/-   ##
==========================================
+ Coverage   96.54%   98.04%   +1.49%     
==========================================
  Files         828      829       +1     
  Lines       15099    15213     +114     
  Branches     4318     4374      +56     
==========================================
+ Hits        14578    14916     +338     
+ Misses        466      272     -194     
+ Partials       55       25      -30     
Files with missing lines Coverage Δ
...e/components/TestResultsChart/TestResultsChart.tsx 0.00% <0.00%> (ø)

... and 53 files with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 97.12% <0.00%> (-1.01%) ⬇️
Services 99.32% <ø> (ø)
Shared 99.06% <ø> (+1.74%) ⬆️
UI 99.01% <ø> (+20.18%) ⬆️

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 8816d1e...82f0927. 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-staging
Copy link

codecov-staging bot commented Oct 2, 2025

Bundle Report

Changes will increase total bundle size by 4.24kB (0.03%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-staging-system 6.23MB 1.73kB (0.03%) ⬆️
gazebo-staging-esm 6.32MB 2.51kB (0.04%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: gazebo-staging-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index.*.js 31 bytes 639.37kB 0.0%
assets/index.*.js -1 bytes 12.42kB -0.01%
assets/index.*.js -2 bytes 49.15kB -0.0%
assets/index.*.js 34 bytes 31.11kB 0.11%
assets/index.*.js -1 bytes 22.37kB -0.0%
assets/index.*.js -2 bytes 7.45kB -0.03%
assets/index.*.js -4 bytes 90.02kB -0.0%
assets/index.*.js 3 bytes 5.86kB 0.05%
assets/index.*.js -1 bytes 17.22kB -0.01%
assets/index.*.js -2 bytes 53.59kB -0.0%
assets/index.*.js -2 bytes 125.68kB -0.0%
assets/index.*.js -2.2kB 31.21kB -6.59%
assets/index.*.js -2 bytes 7.75kB -0.03%
assets/index.*.js -2 bytes 36.99kB -0.01%
assets/index.*.js -1 bytes 4.6kB -0.02%
assets/index.*.js 229 bytes 12.43kB 1.88%
assets/index.*.js 55 bytes 2.54kB 2.22%
assets/index.*.js -2 bytes 14.24kB -0.01%
assets/index.*.js -1 bytes 13.62kB -0.01%
assets/index.*.js 7.14kB 33.41kB 27.19% ⚠️
assets/index.*.js 1 bytes 126.54kB 0.0%
assets/index.*.js -1 bytes 12.28kB -0.01%
assets/index.*.js 50 bytes 16.9kB 0.3%
assets/index.*.js -15.61kB 26.27kB -37.27%
assets/index.*.js -1 bytes 8.58kB -0.01%
assets/index.*.js -3 bytes 9.58kB -0.03%
assets/index.*.js -13.63kB 41.88kB -24.56%
assets/RawFileViewer.*.js -1 bytes 127.15kB -0.0%
assets/index.*.css 258 bytes 101.69kB 0.25%
assets/BillingDetails.*.js (New) 29.04kB 29.04kB 100.0% 🚀
assets/ConfigureCachedBundleModal.*.js -5 bytes 8.31kB -0.06%
assets/useInvoices.*.js -711 bytes 2.5kB -22.18%
assets/Alert.*.js 5 bytes 2.21kB 0.23%
assets/BenefitList.*.js -5 bytes 1.47kB -0.34%
assets/Checkbox.*.js 5 bytes 976 bytes 0.51%
assets/TotalsNumber.*.js 5 bytes 834 bytes 0.6%
assets/propTypes.*.js (New) 731 bytes 731 bytes 100.0% 🚀
assets/upgradeForm.*.js (Deleted) -2.88kB 0 bytes -100.0% 🗑️
view changes for bundle: gazebo-staging-system

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-legacy.*.js 35 bytes 28.5kB 0.12%
assets/index-legacy.*.js -2 bytes 113.07kB -0.0%
assets/index-legacy.*.js 51 bytes 16.62kB 0.31%
assets/index-legacy.*.js -2 bytes 45.41kB -0.0%
assets/index-legacy.*.js -1 bytes 12.28kB -0.01%
assets/index-legacy.*.js -2 bytes 7.4kB -0.03%
assets/index-legacy.*.js -2 bytes 7.81kB -0.03%
assets/index-legacy.*.js 51 bytes 2.7kB 1.92%
assets/index-legacy.*.js -2 bytes 26.31kB -0.01%
assets/index-legacy.*.js -2 bytes 35.44kB -0.01%
assets/index-legacy.*.js -3 bytes 9.46kB -0.03%
assets/index-legacy.*.js -2 bytes 12.78kB -0.02%
assets/index-legacy.*.js -1 bytes 12.66kB -0.01%
assets/index-legacy.*.js -1 bytes 16.8kB -0.01%
assets/index-legacy.*.js 310 bytes 717.09kB 0.04%
assets/index-legacy.*.js -1 bytes 21.1kB -0.0%
assets/index-legacy.*.js -2 bytes 49.41kB -0.0%
assets/index-legacy.*.js -4 bytes 84.77kB -0.0%
assets/index-legacy.*.js -1 bytes 41.39kB -0.0%
assets/index-legacy.*.js -1 bytes 11.39kB -0.01%
assets/index-legacy.*.js -1 bytes 4.41kB -0.02%
assets/index-legacy.*.js -3.51kB 29.48kB -10.64%
assets/index-legacy.*.js -1 bytes 8.57kB -0.01%
assets/index-legacy.*.js -4 bytes 115.08kB -0.0%
assets/index-legacy.*.js 116 bytes 11.79kB 0.99%
assets/index-legacy.*.js -19.37kB 32.99kB -36.99%
assets/index-legacy.*.js -2 bytes 5.63kB -0.04%
assets/RawFileViewer-legacy.*.js -1 bytes 127.36kB -0.0%
assets/BillingDetails-legacy.*.js (New) 26.7kB 26.7kB 100.0% 🚀
assets/ConfigureCachedBundleModal-legacy.*.js -5 bytes 7.87kB -0.06%
assets/useInvoices-legacy.*.js -723 bytes 2.53kB -22.25%
assets/propTypes-legacy.*.js (New) 819 bytes 819 bytes 100.0% 🚀
assets/upgradeForm-legacy.*.js (Deleted) -2.71kB 0 bytes -100.0% 🗑️

@sentry

This comment has been minimized.

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Oct 2, 2025

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
a199238 Thu, 02 Oct 2025 21:54:41 GMT Expired Expired
b2da1e8 Fri, 03 Oct 2025 20:43:58 GMT Expired Expired
a64b2ab Fri, 03 Oct 2025 22:17:18 GMT Expired Expired
43c40a1 Thu, 09 Oct 2025 17:48:50 GMT Expired Expired
82f0927 Thu, 09 Oct 2025 22:09:59 GMT Cloud Enterprise

@ajay-sentry ajay-sentry changed the title [test]: FE4 [FE4]: Test Results Chart Component Oct 3, 2025
Copy link
Contributor Author

@ajay-sentry ajay-sentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sentry review

@ajay-sentry ajay-sentry marked this pull request as ready for review October 6, 2025 17:33
Copy link
Contributor Author

@ajay-sentry ajay-sentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sentry review

@ajay-sentry
Copy link
Contributor Author

@sentry review

Comment on lines +23 to +24

export function TestResultsChart({ results }: TestResultsChartProps) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The component should use React.memo for performance optimization since it processes potentially large datasets. The data processing operations are expensive and should be memoized to prevent unnecessary recalculations on re-renders.

Did we get this right? 👍 / 👎 to inform future reviews.

Comment on lines 28 to 47

const chartData = results.reduce((acc: ChartDataPoint[], result) => {
const date = new Date(result.timestamp).toLocaleDateString()
const existing = acc.find((item) => item.date === date)

if (existing) {
existing[result.status]++
existing.totalDuration += result.duration
} else {
acc.push({
date,
passed: result.status === 'passed' ? 1 : 0,
failed: result.status === 'failed' ? 1 : 0,
skipped: result.status === 'skipped' ? 1 : 0,
totalDuration: result.duration,
})
}

return acc
}, [])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data processing operations should be wrapped in useMemo hooks to prevent expensive recalculations on every render. The chartData, slowestTests, branchStats, and flakinessScores calculations are all expensive operations that depend only on the results prop.

Did we get this right? 👍 / 👎 to inform future reviews.

Comment on lines 79 to 97

const flakinessScores = results.reduce(
(acc: Record<string, number>, result) => {
if (!acc[result.name]) {
acc[result.name] = 0
}
const testResults = results.filter((r) => r.name === result.name)
let statusChanges = 0
for (let i = 1; i < testResults.length; i++) {
const current = testResults.at(i)
const previous = testResults.at(i - 1)
if (current && previous && current.status !== previous.status) {
statusChanges++
}
}
acc[result.name] = (statusChanges / testResults.length) * 100
return acc
},
{}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flakiness calculation has a potential bug when accessing array elements. Using array.at() with negative indices or out-of-bounds indices can return undefined, which will cause the comparison to fail silently. Also, the algorithm assumes the test results are sorted by timestamp, but there's no guarantee of this ordering.

Did we get this right? 👍 / 👎 to inform future reviews.

Comment on lines 48 to 52

const slowestTests = results
.filter((result) => result.status !== 'skipped')
.sort((a, b) => b.duration - a.duration)
.slice(0, 10)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The slowestTests calculation should also be memoized for performance. Additionally, consider adding error handling for edge cases where duration might be undefined or null.

Did we get this right? 👍 / 👎 to inform future reviews.

Comment on lines 54 to 77
const branchStats = results.reduce(
(
acc: Record<
string,
{ total: number; failed: number; avgDuration: number }
>,
result
) => {
if (!acc[result.branch]) {
acc[result.branch] = { total: 0, failed: 0, avgDuration: 0 }
}
const branchData = acc[result.branch]
if (branchData) {
branchData.total++
if (result.status === 'failed') {
branchData.failed++
}
branchData.avgDuration =
(branchData.avgDuration * (branchData.total - 1) + result.duration) /
branchData.total
}
return acc
},
{}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The branchStats calculation should be memoized and has a redundant null check. The branchData variable is guaranteed to exist after the initialization check.

Did we get this right? 👍 / 👎 to inform future reviews.

Comment on lines +99 to +103

const flakyTests = Object.entries(flakinessScores)
.filter(([, score]) => score > 20)
.sort(([, a], [, b]) => b - a)
.slice(0, 5)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flakyTests calculation should be memoized and depends on flakinessScores, which should be calculated first.

Did we get this right? 👍 / 👎 to inform future reviews.

@@ -0,0 +1,203 @@
import { cn } from 'shared/utils/cn'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing import for React and useMemo hook that are needed for the performance optimizations.

Did we get this right? 👍 / 👎 to inform future reviews.

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.

3 participants