Fix flaky test MoneyRequestReportTransactionRowWrites.perf-test.tsx

Open
#106,049 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@mountiny is already working on this.

Since Nov 5, 2026.

Assessment

This issue has not been assessed yet.

Description

Engineering Reviewing Weekly

(Vit's agent)

Problem

The Reassure validate-perf-tests job fails on about 1 in 5 PRs, including PRs that do not touch this code (example run). The failing step is "Validate output.json", which fails when the mean render count of any scenario goes up (COUNT_DEVIATION: 0).

On Nov 4, 46 of the 60 most recent failed runs failed on a [MoneyRequestReportTransactionRows] scenario from tests/perf-test/MoneyRequestReportTransactionRowWrites.perf-test.tsx. All 8 scenarios fail at random, in both the narrow and the wide layout. Example:

wide layout [MoneyRequestReportTransactionRows] should re-render when the policy is renamed [render]: 1677.5 ms → 1241.9 ms | 29 → 29.70 (+0.70, +2.4%) 🔴
##[error]Render count difference exceeded the allowed deviation of 0. Current difference: 0.6999999999999993

The baseline on main also has fractional mean render counts (29.10, 30.10, 20.20). This means the render count changes from run to run with no code change.

Daily failure rate of the Reassure workflow:

Date Runs Failed
Oct 20 – 22 ~300/day 0 – 1%
Oct 26 – Nov 2 ~280/day 10 – 23% ([ReportActionsList] scenarios)
Nov 3 323 2% (after https://github.com/Expensify/App/pull/105470)
Nov 4 348 22% ([MoneyRequestReportTransactionRows] scenarios, after https://github.com/Expensify/App/pull/105016)

Cause

MoneyRequestReportTransactionRowWrites.perf-test.tsx and MoneyRequestReportActionsList.perf-test.tsx do not mock fetch. MoneyRequestReportActionsList uses useMarkAsRead, which calls readNewestAction and sends a real API request. The response arrives at a random time and adds renders to some runs but not others.

The same failure hit ReportActionsListRowWrites.perf-test.tsx from Oct 26 to Nov 2. https://github.com/Expensify/App/pull/105470 fixed it with a fetch mock, and the failure rate dropped to 2% the next day. https://github.com/Expensify/App/pull/105016 then expanded MoneyRequestReportTransactionRowWrites to 16 scenarios without a fetch mock.

A local run of both files on main reproduces it: 7 of 22 scenarios have a render count that changes between the 10 runs, for example [37, 32, 30, 31, 30, 31, 30, 30, 30, 30].

Solution

Add global.fetch = TestHelper.getGlobalFetchMock(); to the beforeEach of both test files, the same as https://github.com/Expensify/App/pull/105470.

Dominant language
TypeScript
Stars
5k
Forks
4k
Avg merge
3d 5h
Merged PRs (30d)
594

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Expensify/App

All issues in Expensify/App

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.