From 17f37acda1efc32ad886ddd984fd62e8dcfd8b21 Mon Sep 17 00:00:00 2001 From: Abhijeet Jha <74712637+iamAbhi-916@users.noreply.github.com> Date: Wed, 11 Mar 2026 11:01:14 +0530 Subject: [PATCH 1/4] fix(a11y): Wrap nested views in accessible containers --- .../e2e-test-app-fabric/test/__perf__/core/View.perf-test.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/e2e-test-app-fabric/test/__perf__/core/View.perf-test.tsx b/packages/e2e-test-app-fabric/test/__perf__/core/View.perf-test.tsx index 9597ed2fa42..ee4d4429881 100644 --- a/packages/e2e-test-app-fabric/test/__perf__/core/View.perf-test.tsx +++ b/packages/e2e-test-app-fabric/test/__perf__/core/View.perf-test.tsx @@ -58,7 +58,9 @@ class ViewPerfTest extends ComponentPerfTestBase { const NestedViews = () => ( {Array.from({length: count}, (_, i) => ( - + + + ))} ); From 6890c86eec5698ae7f9d6cdf216f56ffc0daf4c8 Mon Sep 17 00:00:00 2001 From: Abhijeet Jha <74712637+iamAbhi-916@users.noreply.github.com> Date: Wed, 11 Mar 2026 13:59:59 +0530 Subject: [PATCH 2/4] fix(ci): Add CI env to compare step for regression gating --- .github/workflows/perf-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/perf-tests.yml b/.github/workflows/perf-tests.yml index d29a71a3290..e856145e7a2 100644 --- a/.github/workflows/perf-tests.yml +++ b/.github/workflows/perf-tests.yml @@ -66,6 +66,8 @@ jobs: - name: Compare against baselines id: compare working-directory: packages/e2e-test-app-fabric + env: + CI: 'true' run: yarn perf:ci:compare continue-on-error: true From 9f84384cd3b1cbd94546b536785564d2baf018a1 Mon Sep 17 00:00:00 2001 From: Abhijeet Jha <74712637+iamAbhi-916@users.noreply.github.com> Date: Wed, 11 Mar 2026 14:55:21 +0530 Subject: [PATCH 3/4] fix: reporter writes current measured values via temp files instead of baselines --- .../perf-testing/src/ci/PerfJsonReporter.ts | 11 +++-- .../src/matchers/snapshotManager.ts | 46 +++++++++++++++++++ .../src/matchers/toMatchPerfSnapshot.ts | 7 +++ 3 files changed, 61 insertions(+), 3 deletions(-) diff --git a/packages/@react-native-windows/perf-testing/src/ci/PerfJsonReporter.ts b/packages/@react-native-windows/perf-testing/src/ci/PerfJsonReporter.ts index 9acb9250828..446832818c2 100644 --- a/packages/@react-native-windows/perf-testing/src/ci/PerfJsonReporter.ts +++ b/packages/@react-native-windows/perf-testing/src/ci/PerfJsonReporter.ts @@ -78,11 +78,11 @@ export class PerfJsonReporter { const suites: SuiteResult[] = []; for (const suite of results.testResults) { - // Load the snapshot file for this test suite (written by toMatchPerfSnapshot) - const {file: snapshotFilePath} = SnapshotManager.getSnapshotPath( + // Load the CURRENT measured values written by toMatchPerfSnapshot + // to a temp file (not the baselines — those are for comparison only) + const snapshots = SnapshotManager.loadCurrentRun( suite.testFilePath, ); - const snapshots = SnapshotManager.load(snapshotFilePath); const passed = suite.testResults.filter( t => t.status === 'passed', @@ -136,6 +136,11 @@ export class PerfJsonReporter { ); console.log(`\nšŸ“Š Perf results written to: ${this.outputFile}`); + + // Clean up temp files written by test workers + for (const suite of results.testResults) { + SnapshotManager.cleanCurrentRun(suite.testFilePath); + } } } diff --git a/packages/@react-native-windows/perf-testing/src/matchers/snapshotManager.ts b/packages/@react-native-windows/perf-testing/src/matchers/snapshotManager.ts index 3f9a3aa5d87..81daea5e241 100644 --- a/packages/@react-native-windows/perf-testing/src/matchers/snapshotManager.ts +++ b/packages/@react-native-windows/perf-testing/src/matchers/snapshotManager.ts @@ -72,4 +72,50 @@ export class SnapshotManager { static buildKey(testName: string): string { return `${testName} 1`; } + + /** + * Path to the temp file where the current run's measured values are stored. + * Written by toMatchPerfSnapshot (worker), read by PerfJsonReporter (main). + */ + static getCurrentRunPath(testFilePath: string): string { + const testDir = path.dirname(testFilePath); + const snapshotDir = path.join(testDir, '__perf_snapshots__'); + return path.join( + snapshotDir, + `${path.basename(testFilePath)}.perf-current.json`, + ); + } + + /** + * Record a single test's measured values to the current-run temp file. + * Called from the test worker process by toMatchPerfSnapshot. + */ + static recordCurrentRun( + testFilePath: string, + key: string, + entry: SnapshotEntry, + ): void { + const currentPath = this.getCurrentRunPath(testFilePath); + const existing = this.load(currentPath); + existing[key] = entry; + this.save(currentPath, existing); + } + + /** + * Load the current run's measured values from the temp file. + * Called from the main process by PerfJsonReporter. + */ + static loadCurrentRun(testFilePath: string): SnapshotFile { + return this.load(this.getCurrentRunPath(testFilePath)); + } + + /** + * Remove the current-run temp file (cleanup after reporting). + */ + static cleanCurrentRun(testFilePath: string): void { + const p = this.getCurrentRunPath(testFilePath); + if (fs.existsSync(p)) { + fs.unlinkSync(p); + } + } } diff --git a/packages/@react-native-windows/perf-testing/src/matchers/toMatchPerfSnapshot.ts b/packages/@react-native-windows/perf-testing/src/matchers/toMatchPerfSnapshot.ts index 12911e959cb..929e1462472 100644 --- a/packages/@react-native-windows/perf-testing/src/matchers/toMatchPerfSnapshot.ts +++ b/packages/@react-native-windows/perf-testing/src/matchers/toMatchPerfSnapshot.ts @@ -192,6 +192,13 @@ expect.extend({ }; } + // Record current measured values for the CI reporter + SnapshotManager.recordCurrentRun(testPath, snapshotKey, { + metrics: received, + threshold, + capturedAt: new Date().toISOString(), + }); + // COMPARE MODE const {errors, warnings} = compareAgainstBaseline( received, From a410dfd22682602e85a1ffbec97e66d97f9158d3 Mon Sep 17 00:00:00 2001 From: Abhijeet Jha <74712637+iamAbhi-916@users.noreply.github.com> Date: Wed, 11 Mar 2026 14:58:56 +0530 Subject: [PATCH 4/4] Change files --- ...-perf-testing-e9d62521-41b5-4afe-b3fa-fb4692af8369.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@react-native-windows-perf-testing-e9d62521-41b5-4afe-b3fa-fb4692af8369.json diff --git a/change/@react-native-windows-perf-testing-e9d62521-41b5-4afe-b3fa-fb4692af8369.json b/change/@react-native-windows-perf-testing-e9d62521-41b5-4afe-b3fa-fb4692af8369.json new file mode 100644 index 00000000000..f4c5c57e0ca --- /dev/null +++ b/change/@react-native-windows-perf-testing-e9d62521-41b5-4afe-b3fa-fb4692af8369.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "fix: reporter writes current measured values via temp files instead of baselines", + "packageName": "@react-native-windows/perf-testing", + "email": "74712637+iamAbhi-916@users.noreply.github.com", + "dependentChangeType": "patch" +}