You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-09-17] Expense - Second expense is highlighted when opening the duplicated report #100761
Version Number: 9.4.75-0 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from BrowserStack:#98744 Email or phone of affected tester (no customers):sjdojsndonsjoisnjio@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.5 / Chrome App Component: Money Requests
Action Performed:
Go to staging.new.expensify.com
Go to workspace chat.
Create two expenses.
Click View to open the report.
Click More > Duplicate report.
Open the duplicated report.
Expected Result:
Second expense will not highlight when opening the duplicated report.
Actual Result:
Second expense is highlighted when opening the duplicated report.
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Classification: Frontend bug Causing PR: #98744 - "refactor: the new-transaction highlight rail and the wide RHP width model" by @TaduJR (High confidence) Related Issues: #100757 (also a v9.4.75-0 staging-only highlight-rail regression, also attributed to #98744)
Recommendation: ROLL FORWARD
duplicateReport never opens the expense report it creates, so it should pass the existing shouldSkipReportHighlightRail: true escape hatch — a one-line change in Duplicate.ts, exactly the way SplitTransactionUpdate.ts already does it. Reverting #98744 means unwinding 49 files / +2414/-477 across two unrelated subsystems (the highlight rail and the wide-RHP width model), which is far riskier than this fix.
Assigned: @TaduJR (PR author), @blimpich and @abzokhattab (approving reviewers) — already assigned Labels: No changes. DeployBlockerCash is kept (App-side regression, fix is in Expensify/App); DeployBlocker was not present.
The specific regression landed in commit 35ac48d3 ("fix: reveal a row whose play was dropped, and narrow three over-broad gates"), which rewrote the addMakesReportMultiTransaction gate that decides whether a newly created expense gets flagged on the highlight rail.
duplicateReport is precisely the flow this breaks: it creates the duplicated expenses in a synchronousfor loop, one createExpenseByType call per source transaction, and it never navigates to the new report.
gh pr view 98744 --json files confirms #98744 modifies MoneyRequestBuilder.ts, useNewTransactions.ts, PendingNewTransactionFlags.ts, PendingNewTransactions.ts, selectors/ReportMetaData.ts and MoneyRequestReportActionsList.tsx. Merged 2026-09-09T00:07:42Z, which is in the 9.4.75-0 checklist (#100739) and ~20h before this bug was filed.
Root Cause
buildOnyxDataForMoneyRequest only flags a new expense on the highlight rail when the add makes the report multi-transaction. #98744 changed how that is computed.
duplicateReport loops synchronously over the source transactions, calling createExpenseByType → requestMoney for each, threading the optimistic new report through currentIOUReport. MoneyRequestBuilder pre-increments that object: iouReport.transactionCount = (iouReport.transactionCount ?? 0) + 1 (L1527).
Iteration 1 (t1'): transactionCount becomes 1, so serverTransactionCountBeforeAdd = 0. Cache is empty, 0 >= 0 is true → transactionCountAfterAdd = 1 → no flag. Correct.
Iteration 2 (t2'): transactionCount becomes 2, so serverTransactionCountBeforeAdd = 1. But getReportTransactions() reads a module-level cache populated by an asyncOnyx.merge, and iteration 1's optimistic write has not landed yet in the same tick — so the cache still reports 0 transactions for the brand-new report. 0 >= 1 is false, so the code falls back to the pre-incremented optimistic count: transactionCountAfterAdd = 2 → 2 >= 2 → a rail flag is written for t2' on reportMetadata_<duplicatedReportID>.
Production's .some(...) form reads the same empty cache and correctly yields false, so no flag is ever written. That is the entire staging/production divergence.
When the user opens the duplicated report, pendingNewTransactionIDsSelector still sees that flag as active (60s freshness window), useNewTransactions returns [t2'] from the rail, and MoneyRequestReportTransactionList highlights the second row — matching the report exactly.
Two independent things went wrong, and either one alone would have prevented the bug:
The new existingReportTransactions.length >= serverTransactionCountBeforeAdd fallback trusts optimistic state whenever the synchronous cache looks "partial", which is indistinguishable from "the cache simply hasn't caught up with a write we just made".
duplicateReport never passes shouldSkipReportHighlightRail, even though the flag's own JSDoc says it exists "for flows that never open the expense report" — which is exactly what this flow is.
Suggested fix (smallest safe change): set shouldSkipReportHighlightRail: true on the transactionParams that duplicateReport builds, as updateSplitTransactions already does. Optionally also harden the gate so the transactionCount fallback is not taken when existingReportTransactions is empty for a report that was created in this same tick.
💡 Suggested AI code review rule
This bug looks like a recurring, mechanically detectable pattern, so it may be worth a coding-standards rule so the AI reviewer catches the next one. Proposed for Expensify/App:
Rule:CONSISTENCY-18 Don't read Onyx-backed sync caches for writes made earlier in the same loop
Condition: Flag any loop body that calls an optimistic action creator (API.write, requestMoney, createExpenseByType, …) and reads a synchronous Onyx snapshot helper (getReportTransactions(, getReport(, or any deprecated* module cache) to decide something about state the loop itself just wrote. Onyx.merge resolves asynchronously, so iteration N sees the cache as it was before iteration 1. Thread the accumulated state explicitly through the loop (as currentIOUReport already is) or pass the collection in as a parameter instead.
Search pattern:rg -U 'for\s*\(|\.forEach\(|while\s*\(' -A 40 src/libs/actions | rg 'getReportTransactions\(|deprecated[A-Z]' — then check whether the same loop body also calls an action creator or API.write.
// Only a cache holding every transaction the server counted can be trusted to subtract pending deletes. A partial one would count too few and drop the flag.
The full rule file, with the ❌/✅ code inline in Expensify/App's coding-standards format, would go in Expensify/App itself (.claude/skills/coding-standards/rules/consistency-18-*.md). If it's worth adding, a maintainer can open it there as a draft PR.
changed the title [-]Expense - Second expense is highlighted when opening the duplicated report[/-][+][Due for payment 2026-09-17] Expense - Second expense is highlighted when opening the duplicated report[/+]on Sep 10, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.75-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-09-17. 🎊
The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]
Activity
applause-bot commentedon Sep 9, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/368e4abd77f6ed24cfb3b5925d38dad4a7077ecbf320d0f5a4d9159f343f6040
melvin-bot commentedon Sep 9, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #98744
github-actions commentedon Sep 9, 2026
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
melvin-bot commentedon Sep 9, 2026
@blimpich @abzokhattab you have been assigned to this deploy blocker because you reviewed the offending PR: #98744
melvin-bot commentedon Sep 9, 2026
@TaduJR you have been assigned to this deploy blocker because you authored the offending PR: #98744
melvin-bot commentedon Sep 9, 2026
💬 A slack conversation has been started in #expensify-open-source
MelvinBot commentedon Sep 9, 2026
🔍 Investigation Summary
Classification: Frontend bug
Causing PR: #98744 - "refactor: the new-transaction highlight rail and the wide RHP width model" by @TaduJR (High confidence)
Related Issues: #100757 (also a
v9.4.75-0staging-only highlight-rail regression, also attributed to #98744)Recommendation: ROLL FORWARD
duplicateReportnever opens the expense report it creates, so it should pass the existingshouldSkipReportHighlightRail: trueescape hatch — a one-line change inDuplicate.ts, exactly the waySplitTransactionUpdate.tsalready does it. Reverting #98744 means unwinding 49 files / +2414/-477 across two unrelated subsystems (the highlight rail and the wide-RHP width model), which is far riskier than this fix.Assigned: @TaduJR (PR author), @blimpich and @abzokhattab (approving reviewers) — already assigned
Labels: No changes.
DeployBlockerCashis kept (App-side regression, fix is inExpensify/App);DeployBlockerwas not present.📋 Detailed Analysis
Evidence
productionandstagingcomes from refactor: the new-transaction highlight rail and the wide RHP width model #98744.gh api repos/Expensify/App/commits?path=src/hooks/useNewTransactions.ts&sha=stagingreturns 15 commits, and all 15 belong to refactor: the new-transaction highlight rail and the wide RHP width model #98744; no other PR on the 9.4.75 checklist touchesuseNewTransactions.ts,MoneyRequestBuilder.ts's rail block, orMoneyRequestReportTransactionList.tsx's highlight gate.35ac48d3("fix: reveal a row whose play was dropped, and narrow three over-broad gates"), which rewrote theaddMakesReportMultiTransactiongate that decides whether a newly created expense gets flagged on the highlight rail.duplicateReportis precisely the flow this breaks: it creates the duplicated expenses in a synchronousforloop, onecreateExpenseByTypecall per source transaction, and it never navigates to the new report.Verification
Affected files (permalinks at
2b613353, the 9.4.75-0 staging SHA):src/libs/actions/IOU/MoneyRequestBuilder.ts#L694-L718— writes thependingNewTransactionIDsrail flag; contains the regressed gate.src/libs/actions/IOU/Duplicate.ts#L1087-L1164— the synchronous per-transaction duplication loop.src/libs/ReportUtils.ts#L1309-L1315—getReportTransactions, the deprecated synchronous cache read the gate depends on.src/selectors/ReportMetaData.ts#L59-L99— classifies rail flags intoactiveFlagKeys/expiredFlagKeys(60s freshness window).src/hooks/useNewTransactions.ts#L87-L102— turns active rail flags intonewTransactions.src/components/MoneyRequestReportView/MoneyRequestReportTransactionList.tsx#L871— appliesshouldBeHighlightedto the row.gh pr view 98744 --json filesconfirms #98744 modifiesMoneyRequestBuilder.ts,useNewTransactions.ts,PendingNewTransactionFlags.ts,PendingNewTransactions.ts,selectors/ReportMetaData.tsandMoneyRequestReportActionsList.tsx. Merged2026-09-09T00:07:42Z, which is in the 9.4.75-0 checklist (#100739) and ~20h before this bug was filed.Root Cause
buildOnyxDataForMoneyRequestonly flags a new expense on the highlight rail when the add makes the report multi-transaction. #98744 changed how that is computed.Production (works):
Staging after #98744 (broken):
Walking the two-expense duplicate:
duplicateReportloops synchronously over the source transactions, callingcreateExpenseByType→requestMoneyfor each, threading the optimistic new report throughcurrentIOUReport.MoneyRequestBuilderpre-increments that object:iouReport.transactionCount = (iouReport.transactionCount ?? 0) + 1(L1527).t1'):transactionCountbecomes1, soserverTransactionCountBeforeAdd = 0. Cache is empty,0 >= 0is true →transactionCountAfterAdd = 1→ no flag. Correct.t2'):transactionCountbecomes2, soserverTransactionCountBeforeAdd = 1. ButgetReportTransactions()reads a module-level cache populated by an asyncOnyx.merge, and iteration 1's optimistic write has not landed yet in the same tick — so the cache still reports 0 transactions for the brand-new report.0 >= 1is false, so the code falls back to the pre-incremented optimistic count:transactionCountAfterAdd = 2→2 >= 2→ a rail flag is written fort2'onreportMetadata_<duplicatedReportID>..some(...)form reads the same empty cache and correctly yieldsfalse, so no flag is ever written. That is the entire staging/production divergence.pendingNewTransactionIDsSelectorstill sees that flag as active (60s freshness window),useNewTransactionsreturns[t2']from the rail, andMoneyRequestReportTransactionListhighlights the second row — matching the report exactly.Two independent things went wrong, and either one alone would have prevented the bug:
existingReportTransactions.length >= serverTransactionCountBeforeAddfallback trusts optimistic state whenever the synchronous cache looks "partial", which is indistinguishable from "the cache simply hasn't caught up with a write we just made".duplicateReportnever passesshouldSkipReportHighlightRail, even though the flag's own JSDoc says it exists "for flows that never open the expense report" — which is exactly what this flow is.Suggested fix (smallest safe change): set
shouldSkipReportHighlightRail: trueon thetransactionParamsthatduplicateReportbuilds, asupdateSplitTransactionsalready does. Optionally also harden the gate so thetransactionCountfallback is not taken whenexistingReportTransactionsis empty for a report that was created in this same tick.💡 Suggested AI code review rule
This bug looks like a recurring, mechanically detectable pattern, so it may be worth a coding-standards rule so the AI reviewer catches the next one. Proposed for
Expensify/App:CONSISTENCY-18Don't read Onyx-backed sync caches for writes made earlier in the same loopAPI.write,requestMoney,createExpenseByType, …) and reads a synchronous Onyx snapshot helper (getReportTransactions(,getReport(, or anydeprecated*module cache) to decide something about state the loop itself just wrote.Onyx.mergeresolves asynchronously, so iteration N sees the cache as it was before iteration 1. Thread the accumulated state explicitly through the loop (ascurrentIOUReportalready is) or pass the collection in as a parameter instead.rg -U 'for\s*\(|\.forEach\(|while\s*\(' -A 40 src/libs/actions | rg 'getReportTransactions\(|deprecated[A-Z]'— then check whether the same loop body also calls an action creator orAPI.write.App/src/libs/actions/IOU/MoneyRequestBuilder.ts
Lines 694 to 704 in 2b61335
App/src/libs/actions/IOU/Duplicate.ts
Lines 1087 to 1164 in 2b61335
shouldSkipReportHighlightRailas atApp/src/libs/actions/IOU/SplitTransactionUpdate.ts
Line 2088 in 2b61335
The full rule file, with the ❌/✅ code inline in
Expensify/App's coding-standards format, would go inExpensify/Appitself (.claude/skills/coding-standards/rules/consistency-18-*.md). If it's worth adding, a maintainer can open it there as a draft PR.blimpich commentedon Sep 9, 2026
consolidating conversation around this deploy blocker and it's related deploy blockers here: https://expensify.slack.com/archives/C01GTK53T8Q/p1788996794073959
melvin-bot commentedon Sep 10, 2026
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
IuliiaHerets commentedon Sep 10, 2026
This issue is not repro on Windows 10/Chrome Build v9.4.75-1
Recording.1579.mp4
[-]Expense - Second expense is highlighted when opening the duplicated report[/-][+][Due for payment 2026-09-17] Expense - Second expense is highlighted when opening the duplicated report[/+]melvin-bot commentedon Sep 10, 2026
@abzokhattab / @TaduJR
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.75-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-09-17. 🎊
The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]