Skip to content

Test version refactor : column config and rendering#1004

Open
kala-moz wants to merge 3 commits intomozilla:mainfrom
kala-moz:test-version-refactor
Open

Test version refactor : column config and rendering#1004
kala-moz wants to merge 3 commits intomozilla:mainfrom
kala-moz:test-version-refactor

Conversation

@kala-moz
Copy link
Contributor

@kala-moz kala-moz commented Feb 20, 2026

Fixes BUG 2016285

This PR addresses the scalability and maintenance weaknesses of the current test version implementation.

First, an overall test version interface is created in src/common/testVersions/index.ts:

export interface TestVersionStrategy {
  getColumns(isSubtestTable: boolean): TableConfig;
  getAvgValues(result: CombinedResultsItemType): {
    baseAvg: number | null;
    newAvg: number | null;
  };
  renderColumns(result: CombinedResultsItemType): ReactNode;
}

And each test version has their own file with their unique column configuration, for getting the average values, and rendering their specific columns in RevisionRow.tsx:

src/common/testVersions/mannWhitney
src/common/testVersions/studentT

Therefore, adding a new test version would only require creating a unique file for new test version.
example: /testVersions/welch

Now, to get the columns for each test version, we only have to call the registry:

// utils/rowTemplateColumn.ts

import { getColumnsForVersion } from '../common/testVersions';

export const getColumnsConfiguration = (
  isSubtestTable: boolean,
  testVersion: TestVersion,
): TableConfig => getColumnsForVersion(testVersion, isSubtestTable);

Rendering the columns in RevisionRow.tsx is also simplified, removing the conditionals (if (testVersion === MANN_WHITNEY_U))

import { getStrategy } from '../../common/testVersions';
...
 const strategy = getStrategy(testVersion);
 const { baseAvg: baseAvgValue, newAvg: newAvgValue } =
    strategy.getAvgValues(result);
...
return (
...
   {strategy.renderColumns(result)}
...
);
...

This PR is part one of completing the refactor as we still need to expand the test version strategy to handle the unique test version components in the expanded rows. This will be completed in a follow-up PR.

@netlify
Copy link

netlify bot commented Feb 20, 2026

Deploy Preview for mozilla-perfcompare ready!

Name Link
🔨 Latest commit 9e88c57
🔍 Latest deploy log https://app.netlify.com/projects/mozilla-perfcompare/deploys/6997b14178968f0008ab18ea
😎 Deploy Preview https://deploy-preview-1004--mozilla-perfcompare.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kala-moz kala-moz changed the title Draft: Test version refactor Test version refactor Feb 20, 2026
@kala-moz kala-moz requested a review from gmierz February 20, 2026 00:57
@kala-moz kala-moz changed the title Test version refactor Test version refactor : column config and rendering Feb 20, 2026
@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

❌ Patch coverage is 99.37500% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.45%. Comparing base (ba548b6) to head (9e88c57).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/utils/rowTemplateColumns.ts 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1004      +/-   ##
==========================================
- Coverage   96.46%   96.45%   -0.01%     
==========================================
  Files         104      108       +4     
  Lines        3028     3050      +22     
  Branches      694      689       -5     
==========================================
+ Hits         2921     2942      +21     
- Misses        106      107       +1     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

* These are generic, version-agnostic replacements for the version-specific
* column types above. To support a new test version,
* extend CombinedResultsItemType in state.ts —
* no changes are needed in this section.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add some additional comments about how these types work, and why they exist?

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.

2 participants