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-08-19] [$250] Merge expenses prompts for attendee selection even when both expenses have the same attendee #94700
Version Number: 9.4.20-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@coleaeason Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
Create two expenses with the same attendee and same merchant.
Select one expense.
Initiate the Merge action.
Observe the Select the details you want to keep RHP
Expected Result:
If both expenses have the same attendee, the merge should proceed without prompting the user to choose an attendee.
The attendee should be retained automatically since there is no conflict.
Actual Result:
The merge flow prompts the user to select which attendee to keep, despite both expenses having the identical attendee.
This issue applies specifically to the Attendee field (not the Merchant field).
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
The merge flow detects an attendee "conflict" using a different attendee list than the one it shows the user, so two expenses that look identical can still be flagged as conflicting.
When comment.attendees is empty on a transaction (common for card-imported / SmartScanned expenses), the UI still displays an attendee — the report owner — because the display path injects a default "report owner as attendee". But the conflict-detection path does not inject that default, so it sees an empty list [] instead.
Concretely, both paths call getTransactionDetails, but only one passes reportOwnerAsAttendee:
The attendee comparison itself (MergeTransactionUtils.ts:290-303) then compares e.g. ["owner@email.com"] (the side that persisted the attendee) against [] (the side that relies on the injected default), deepEqual returns false, and attendees is pushed into conflictFields — even though the user sees the same attendee on both. This explains why merchant (a plain string compare) does not conflict but attendees does.
This is consistent with the call site in DetailsReviewPage.tsx:64-72, which computes targetReportOwnerAsAttendee / sourceReportOwnerAsAttendee and passes them to buildMergeFieldsData but not to getMergeableDataAndConflictFields.
Secondary (lower-probability) factor: the comparison maps attendee.login ?? attendee.emailwithout stripping the SMS domain, whereas the display string does (getAttendeesListDisplayString uses Str.removeSMSDomain, TransactionUtils/index.ts:1170-1182). For phone-login attendees, a suffixed login (...@expensify.sms) on one side vs a bare value on the other would also produce a false conflict.
Alternative explanations considered & ruled out: Two attendees added the same way via the selector store identical login/email values (MoneyRequestAttendeeSelector.tsx:113-126), so they would not conflict — the bug requires the asymmetric empty-vs-persisted case above, which is exactly what happens when merging a card/SmartScan expense (empty comment.attendees) with a manually created one.
What changes do you think we should make in order to solve the problem?
Make conflict detection use the same attendee data the user sees:
Add targetReportOwnerAsAttendee / sourceReportOwnerAsAttendee parameters to getMergeableDataAndConflictFields and pass them into the two internal getTransactionDetails calls at MergeTransactionUtils.ts:227-228, mirroring what buildMergeFieldsData already does at lines 592-593.
Update the call sites to pass them: DetailsReviewPage.tsx (already computes both via useReportOwnerAsAttendee), ReceiptReviewPage.tsx, and actions/MergeTransaction.ts.
For robustness, normalize the SMS domain in the attendee comparison (e.g. apply Str.removeSMSDomain to the mapped login ?? email values) so phone-login attendees compare consistently with how they are displayed.
This guarantees that when both expenses resolve to the same attendee (whether explicitly stored or via the report-owner default), no attendee conflict is raised.
What alternative solutions did you explore? (Optional)
Only stripping the SMS domain in the comparison — rejected as insufficient on its own, because it does not address the primary empty-vs-persisted asymmetry that drives the reported repro.
Related issues
Expensify/App#93151 — [Exploratory] Expense-Attendees section while merging expense in collect workspace (possibly related; touches the same merge-attendees area).
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/94700) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Please re-state the problem that we are trying to solve in this issue.
When merging two expenses that have the same attendee, the "Select the details you want to keep" step still lists Attendees as a conflicting field and forces the user to pick one, even though both options render the identical attendee. The Merchant field (and every other field) behaves correctly in the same scenario, so the bug is specific to how attendees are compared when deciding which fields conflict.
What is the root cause of that problem?
The merge flow decides which fields go on the "Select the details you want to keep" step in getMergeableDataAndConflictFields in MergeTransactionUtils.ts. Attendees have a dedicated comparison block that maps each attendee to attendee.login ?? attendee.email, sorts the logins, and only treats the field as resolved when the two login arrays are deepEqual; otherwise it pushes attendees into conflictFields.
The values fed into this block come from getTransactionDetails(targetTransaction) and getTransactionDetails(sourceTransaction), both called WITHOUT a reportOwnerAsAttendee argument (lines 227-228). So for an expense that has no explicit attendees stored, getAttendees returns []. The asymmetry is that the DISPLAY path does the opposite: buildMergeFieldsData calls getTransactionDetails(..., targetReportOwnerAsAttendee) / (..., sourceReportOwnerAsAttendee), where useReportOwnerAsAttendee resolves the report creator and getAttendees default-fills empty attendees with that creator. The net result: when one expense stores the creator in comment.attendees and the other has empty attendees (a very common state, e.g. one expense created through a flow that persisted the default attendee and the other that didn't), the comparison sees ["me@x.com"] vs [], while the UI default-fills both options to the same creator. The user sees two identical attendees but is still forced to choose.
I reproduced this with the exact normalize/compare logic from the codebase. ["me@x.com"] vs [] evaluates to equal: false, so attendees is pushed to conflictFields. The underlying gap is that the attendees block lacks the empty-tolerance that every other field gets. The generic branch resolves the field whenever one side is empty:
but the attendees block only checks deepEqual(targetAttendeeLogins, sourceAttendeeLogins) and ignores isTargetValueEmpty / isSourceValueEmpty, which are already computed in scope at lines 234-235.
What changes do you think we should make in order to solve the problem?
In the attendees block, mirror the generic branch's empty-tolerance so an empty-vs-populated pair auto-resolves to the populated side (which is exactly what the UI already default-fills and displays). The isTargetValueEmpty / isSourceValueEmpty flags are already available, so we only need to widen the condition at line 298:
This is safe and narrowly scoped. When both sides have real (and identical) attendees, the deepEqual path is unchanged. When attendees genuinely differ, the block still pushes to conflictFields. The only new behavior is the empty case, where we keep the non-empty attendee list — which already matches the creator the UI shows on both options, so nothing is silently dropped. It uses flags already computed for every other field, keeping attendees consistent with how merchant/category/etc. handle one-sided emptiness.
What alternative solutions did you explore? (Optional)
I considered making getMergeableDataAndConflictFields pass each transaction's reportOwnerAsAttendee into getTransactionDetails so the comparison default-fills the creator the same way the display does. That works conceptually but is heavier: it requires threading two personal-detail lookups (or the hook results) into a pure util used by both the action and the page, and it changes the comparison for every field rather than fixing the attendee-specific gap. The empty-tolerance fix is smaller and matches the existing pattern used by all other fields.
The merge flow computes the conflicting fields with getMergeableDataAndConflictFields, and the attendees field gets a dedicated branch that compares the two transactions' attendee logins:
The attendee values come from getTransactionDetails, which derives them through getAttendees. The key detail is in getAttendees: when a transaction's raw comment.attendees is empty, the attendee shown to the user is not stored on the transaction — it's the report owner (you), injected on the fly only when a reportOwnerAsAttendee argument is passed:
So a transaction whose attendee is the default (empty raw comment.attendees) yields [] in the conflict comparison, while the same transaction renders the self-attendee in the UI. The moment the two merged expenses don't store the attendee identically — one has the self-attendee persisted in comment.attendees and the other relies on the default — the conflict path compares ['you@x.com'] vs [], deepEqual returns false, and attendees is pushed into conflictFields, while the display (which injects the owner on both sides) shows the exact same attendee.
So: display injects reportOwnerAsAttendee and shows identical attendees → conflict detection omits it, so the default self-attendee is read as [] → deepEqual mismatch → attendees flagged as a conflict → user is wrongly prompted to choose. Merchant is unaffected because it's a plain stored string compared by === at line 306, with no owner-injection layer.
Note the .sort(localeCompare) on lines 293/296 is not the cause — localeCompare is (a, b) => number (LocaleContextProvider) and Array.prototype.sort invokes it as (a, b), so the sort is correct. The defect is the missing report-owner injection, and it exists at all three call sites of getMergeableDataAndConflictFields: DetailsReviewPage, ReceiptReviewPage, and the MergeTransaction action (the action is what runs first on "Merge" and decides whether to skip straight to confirmation).
What changes do you think we should make in order to solve the problem?
Make conflict detection inject the report owner exactly like the display path already does. Add targetReportOwnerAsAttendee / sourceReportOwnerAsAttendee params to getMergeableDataAndConflictFields and forward them to its two getTransactionDetails calls, mirroring buildMergeFieldsData lines 592-593:
With the owner injected on both sides, two expenses showing the same attendee produce identical login arrays, deepEqual returns true, attendees stays out of conflictFields, and the flow skips the prompt — keeping the conflict logic and the display perfectly in sync (which is also the correct fix for the inverse case where they currently disagree). Minor changes/improvements can be discussed in the PR phase.
What alternative solutions did you explore? (Optional)
Special-case the attendees branch alone: when both transactions have empty raw comment.attendees, treat them as equal without injecting the owner. This patches the most common path but leaves conflict detection and display reading attendees through two different code paths, so any case where only one side has an empty list (default vs explicitly-persisted self) would still diverge. Threading reportOwnerAsAttendee through getMergeableDataAndConflictFields is cleaner because it makes the two paths derive attendees identically by construction.
Please re-state the problem that we are trying to solve in this issue.
Merging two expenses that have the same attendee still shows the Attendees field on the "Select the details you want to keep" RHP, forcing the user to pick an attendee even though there is no conflict. The Merchant field behaves correctly in the same scenario.
What is the root cause of that problem?
Conflict detection and the RHP display resolve attendees differently, so the two paths disagree about whether the attendees match.
When a transaction has no explicit attendees stored, getAttendees falls back to the report owner as the default attendee — but only when a reportOwnerAsAttendee argument is provided:
So in getMergeableDataAndConflictFields the attendee comparison never applies the report-owner fallback. When one expense stores the attendee explicitly (e.g. [owner]) and the other relies on the implicit default ([]), the two login lists differ and the field is pushed into conflictFields:
The user sees the same attendee on both sides (because the display fills in the report owner) yet is still prompted to choose, since detection compared [owner] against [].
What changes do you think we should make in order to solve the problem?
Make conflict detection resolve attendees the same way the display does, by threading the report-owner fallback into getMergeableDataAndConflictFields.
Add the two attendees to the signature and forward them to the existing getTransactionDetails calls (src/libs/MergeTransactionUtils.ts):
Then pass the report-owner attendees at the two call sites:
In DetailsReviewPage the values are already computed (targetReportOwnerAsAttendee/sourceReportOwnerAsAttendee) and handed to buildMergeFieldsData; pass the same two into getMergeableDataAndConflictFields so detection and display agree:
In the setupMergeTransactionDataAndNavigate action (which uses the result to skip the RHP when there are no conflicts) derive each transaction's report owner via getReportOwnerAsAttendee(getReportOwnerAccountIDAsAttendee(...)) from personal details and pass them in too:
With both paths normalizing the implicit attendee to the report owner, the login lists match and attendees is no longer flagged as a conflict when the attendee is actually the same.
What specific scenarios should we cover in automated tests to prevent reintroducing this in the future?
In a getMergeableDataAndConflictFields unit test, assert that attendees is NOT in conflictFields when one transaction stores the attendee explicitly and the other has no attendees but resolves to the same report owner via reportOwnerAsAttendee, and that it IS flagged when the two resolve to genuinely different attendees.
What alternative solutions did you explore? (Optional)
Skip the attendee fallback entirely and compare only explicitly-stored attendees (treat empty as empty) in both detection and display. This also removes the false conflict, but it diverges from how attendees are shown everywhere else in the app (where the report owner is the implicit default), so an expense with an explicit self-attendee and one with the implicit self-attendee would still be treated as different — only hidden because both display empty. Aligning detection with the existing display fallback is more consistent.
That is not the canonical attendee identity. Other attendee-related logic prefers accountID when it is available, and only falls back to login/email when it is not. For example, missing-attendee validation filters by accountID when ownerAccountID is known:
So two attendee objects can represent the same person by accountID, but still be considered different by the merge conflict detector if their login/email shape differs. That makes getMergeableDataAndConflictFields() add attendees to conflictFields, so the details review RHP asks the user to choose an attendee even though there is no real attendee conflict.
History note: commit e16da652e5f638d89b059b636564b1b9db51a17c changed this merge attendee logic while removing personal-details hydration from attendees. It made the attendee check rely only on the derived login arrays, which is where this identity mismatch comes from: e16da65
What changes do you think we should make in order to solve the problem?
Normalize attendee identity before comparing attendees in getMergeableDataAndConflictFields().
Use accountID first, then fallback to normalized login/email, then display name only for name-only attendees. Prefix the key type so an account ID cannot collide with a numeric-looking login/display name.
To avoid regressions, keep the existing behavior that attendee order does not matter by sorting identities before comparison, keep login/email fallback for optimistic or unknown attendees, and add tests for:
Same accountID, different login/email shape: no attendee conflict.
Different accountID: attendee conflict.
Same login/email with no accountID: no attendee conflict.
Different name-only attendees: attendee conflict.
What alternative solutions did you explore? (Optional)
We could compare attendee display strings, but that would be weaker because display names are not unique and can change. We could deep-compare the full attendee objects, but that would create false conflicts from irrelevant fields like avatar, text, selected state, or hydrated personal-detail metadata. A normalized identity comparison matches the existing attendee patterns and keeps the change scoped to merge conflict detection.
🚨 Edited by proposal-police: This proposal was edited at 2026-06-26 13:59:33 UTC.
Proposal
What is the root cause of that problem?
The merge flow decides whether to show the details-selection page in getMergeableDataAndConflictFields(). For attendees, that function currently compares only each stored attendee's login ?? email, and it builds those values from getTransactionDetails() without the report-owner fallback attendee.
Other attendee display paths do not use that same shape. The expense row and merge details page can treat the report owner as the effective attendee when the stored attendee list is empty, and the details page formats attendees from display name/login. So two expenses can show the same attendee, but the conflict detector still sees different raw values, such as an empty attendee list on one expense and an explicit attendee object for the same person on the other. It then adds attendees to conflictFields, and the details page renders two identical attendee choices.
What changes do you think we should make in order to solve the problem?
Update the attendee branch in getMergeableDataAndConflictFields() to compare effective attendee identities instead of only raw login ?? email values.
I would add a small helper in MergeTransactionUtils that builds the attendee list the merge flow should compare, including the same report-owner fallback used by attendee display when a transaction has no stored attendees. Then compare stable normalized keys for each attendee:
prefer accountID when present;
otherwise use a normalized login/email value, including case/SMS-domain normalization;
otherwise fall back to a trimmed normalized display name for name-only attendees.
Sort those keys and compare the two arrays. If they match, keep attendees out of conflictFields and set mergeableData.attendees to the explicit target/source attendee value, or to the effective fallback value when needed so the merged expense still retains the attendee. If they differ, keep the current conflict behavior.
Thread the target/source report-owner attendee, or the data needed to build it, through every getMergeableDataAndConflictFields() caller in the merge flow: initial merge navigation, receipt review, details review, and source-selection confirmation. This stays in the App merge UI/data-normalization layer and does not change the backend request contract or unrelated merge fields like merchant, amount, category, or report.
Add regression coverage for:
one expense with an empty stored attendee list that displays the report owner and another expense with that same attendee stored explicitly;
two attendee objects with the same accountID but different login/email population;
genuinely different attendees still producing an attendees conflict;
the receipt-review/direct navigation paths continuing to skip details when attendee identities match.
What alternative solutions did you explore? (Optional)
I considered comparing only the rendered attendee display string, but two different people can share a display name. I also considered hiding duplicate-looking attendee rows in the details page, but that would leave mergeableData.attendees unresolved and would not fix the route decision. Comparing effective attendee identities in the merge detector fixes the data decision at the source.
changed the title [-]Merge expenses prompts for attendee selection even when both expenses have the same attendee[/-][+][$250] Merge expenses prompts for attendee selection even when both expenses have the same attendee[/+]on Jun 26, 2026
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Test:
Create a workspace with the Attendee Tracking feature enabled.
Create two expenses in that workspace with the same merchant and the same (default) attendee.
Select one expense and start the Merge action; pick the other expense and continue.
Verify the "Select the details you want to keep" page does NOT show an Attendee section (attendees are identical, so there is no conflict).
Verify the merge completes and the attendee is retained.
Repeat with two expenses that have DIFFERENT explicit attendees and verify the Attendee section is still shown so the user can choose.
Activity
MelvinBot commentedon Jun 26, 2026
Proposal
What is the root cause of that problem?
The merge flow detects an attendee "conflict" using a different attendee list than the one it shows the user, so two expenses that look identical can still be flagged as conflicting.
When
comment.attendeesis empty on a transaction (common for card-imported / SmartScanned expenses), the UI still displays an attendee — the report owner — because the display path injects a default "report owner as attendee". But the conflict-detection path does not inject that default, so it sees an empty list[]instead.Concretely, both paths call
getTransactionDetails, but only one passesreportOwnerAsAttendee:MergeTransactionUtils.ts:227-228callsgetTransactionDetails(targetTransaction)without the report owner.MergeTransactionUtils.ts:592-593calls it withtargetReportOwnerAsAttendee/sourceReportOwnerAsAttendee.The attendee comparison itself (
MergeTransactionUtils.ts:290-303) then compares e.g.["owner@email.com"](the side that persisted the attendee) against[](the side that relies on the injected default),deepEqualreturnsfalse, andattendeesis pushed intoconflictFields— even though the user sees the same attendee on both. This explains why merchant (a plain string compare) does not conflict but attendees does.This is consistent with the call site in
DetailsReviewPage.tsx:64-72, which computestargetReportOwnerAsAttendee/sourceReportOwnerAsAttendeeand passes them tobuildMergeFieldsDatabut not togetMergeableDataAndConflictFields.Investigation details & evidence
getAttendeesonly appends the report-owner default when areportOwnerAsAttendeeargument is provided (TransactionUtils/index.ts:1159-1166).getTransactionDetailsforwards that argument intogetAttendees(ReportUtils.ts:4805).getMergeableDataAndConflictFieldscall sites —DetailsReviewPage.tsxandReceiptReviewPage.tsx, plusactions/MergeTransaction.ts— never pass the report-owner attendee, so the function can never inject the default.attendee.login ?? attendee.emailwithout stripping the SMS domain, whereas the display string does (getAttendeesListDisplayStringusesStr.removeSMSDomain,TransactionUtils/index.ts:1170-1182). For phone-login attendees, a suffixed login (...@expensify.sms) on one side vs a bare value on the other would also produce a false conflict.Alternative explanations considered & ruled out: Two attendees added the same way via the selector store identical
login/emailvalues (MoneyRequestAttendeeSelector.tsx:113-126), so they would not conflict — the bug requires the asymmetric empty-vs-persisted case above, which is exactly what happens when merging a card/SmartScan expense (emptycomment.attendees) with a manually created one.What changes do you think we should make in order to solve the problem?
Make conflict detection use the same attendee data the user sees:
targetReportOwnerAsAttendee/sourceReportOwnerAsAttendeeparameters togetMergeableDataAndConflictFieldsand pass them into the two internalgetTransactionDetailscalls atMergeTransactionUtils.ts:227-228, mirroring whatbuildMergeFieldsDataalready does at lines 592-593.DetailsReviewPage.tsx(already computes both viauseReportOwnerAsAttendee),ReceiptReviewPage.tsx, andactions/MergeTransaction.ts.Str.removeSMSDomainto the mappedlogin ?? emailvalues) so phone-login attendees compare consistently with how they are displayed.This guarantees that when both expenses resolve to the same attendee (whether explicitly stored or via the report-owner default), no attendee conflict is raised.
What alternative solutions did you explore? (Optional)
Only stripping the SMS domain in the comparison — rejected as insufficient on its own, because it does not address the primary empty-vs-persisted asymmetry that drives the reported repro.
Related issues
Expensify/App#93151—[Exploratory] Expense-Attendees section while merging expense in collect workspace(possibly related; touches the same merge-attendees area).Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/94700)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
MobileMage commentedon Jun 26, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When merging two expenses that have the same attendee, the "Select the details you want to keep" step still lists Attendees as a conflicting field and forces the user to pick one, even though both options render the identical attendee. The Merchant field (and every other field) behaves correctly in the same scenario, so the bug is specific to how attendees are compared when deciding which fields conflict.
What is the root cause of that problem?
The merge flow decides which fields go on the "Select the details you want to keep" step in
getMergeableDataAndConflictFieldsinMergeTransactionUtils.ts. Attendees have a dedicated comparison block that maps each attendee toattendee.login ?? attendee.email, sorts the logins, and only treats the field as resolved when the two login arrays aredeepEqual; otherwise it pushesattendeesintoconflictFields.App/src/libs/MergeTransactionUtils.ts
Lines 290 to 304 in d6e921f
The values fed into this block come from
getTransactionDetails(targetTransaction)andgetTransactionDetails(sourceTransaction), both called WITHOUT areportOwnerAsAttendeeargument (lines 227-228). So for an expense that has no explicit attendees stored,getAttendeesreturns[]. The asymmetry is that the DISPLAY path does the opposite:buildMergeFieldsDatacallsgetTransactionDetails(..., targetReportOwnerAsAttendee)/(..., sourceReportOwnerAsAttendee), whereuseReportOwnerAsAttendeeresolves the report creator andgetAttendeesdefault-fills empty attendees with that creator. The net result: when one expense stores the creator incomment.attendeesand the other has empty attendees (a very common state, e.g. one expense created through a flow that persisted the default attendee and the other that didn't), the comparison sees["me@x.com"]vs[], while the UI default-fills both options to the same creator. The user sees two identical attendees but is still forced to choose.I reproduced this with the exact normalize/compare logic from the codebase.
["me@x.com"]vs[]evaluates toequal: false, soattendeesis pushed toconflictFields. The underlying gap is that the attendees block lacks the empty-tolerance that every other field gets. The generic branch resolves the field whenever one side is empty:but the attendees block only checks
deepEqual(targetAttendeeLogins, sourceAttendeeLogins)and ignoresisTargetValueEmpty/isSourceValueEmpty, which are already computed in scope at lines 234-235.What changes do you think we should make in order to solve the problem?
In the attendees block, mirror the generic branch's empty-tolerance so an empty-vs-populated pair auto-resolves to the populated side (which is exactly what the UI already default-fills and displays). The
isTargetValueEmpty/isSourceValueEmptyflags are already available, so we only need to widen the condition at line 298:App/src/libs/MergeTransactionUtils.ts
Lines 298 to 302 in d6e921f
This is safe and narrowly scoped. When both sides have real (and identical) attendees, the
deepEqualpath is unchanged. When attendees genuinely differ, the block still pushes toconflictFields. The only new behavior is the empty case, where we keep the non-empty attendee list — which already matches the creator the UI shows on both options, so nothing is silently dropped. It uses flags already computed for every other field, keeping attendees consistent with how merchant/category/etc. handle one-sided emptiness.What alternative solutions did you explore? (Optional)
I considered making
getMergeableDataAndConflictFieldspass each transaction'sreportOwnerAsAttendeeintogetTransactionDetailsso the comparison default-fills the creator the same way the display does. That works conceptually but is heavier: it requires threading two personal-detail lookups (or the hook results) into a pure util used by both the action and the page, and it changes the comparison for every field rather than fixing the attendee-specific gap. The empty-tolerance fix is smaller and matches the existing pattern used by all other fields.yusufdeveloper2903 commentedon Jun 26, 2026
Proposal
What is the root cause of that problem?
The merge flow computes the conflicting fields with
getMergeableDataAndConflictFields, and theattendeesfield gets a dedicated branch that compares the two transactions' attendee logins:App/src/libs/MergeTransactionUtils.ts
Lines 290 to 304 in b396890
The attendee values come from
getTransactionDetails, which derives them throughgetAttendees. The key detail is ingetAttendees: when a transaction's rawcomment.attendeesis empty, the attendee shown to the user is not stored on the transaction — it's the report owner (you), injected on the fly only when areportOwnerAsAttendeeargument is passed:App/src/libs/TransactionUtils/index.ts
Lines 1159 to 1167 in b396890
Now look at the asymmetry between the two consumers:
getTransactionDetails, so each row renders the injected self-attendee —buildMergeFieldsData:getTransactionDetailswith no report owner (its signature doesn't even accept one) — lines 227-228:So a transaction whose attendee is the default (empty raw
comment.attendees) yields[]in the conflict comparison, while the same transaction renders the self-attendee in the UI. The moment the two merged expenses don't store the attendee identically — one has the self-attendee persisted incomment.attendeesand the other relies on the default — the conflict path compares['you@x.com']vs[],deepEqualreturnsfalse, andattendeesis pushed intoconflictFields, while the display (which injects the owner on both sides) shows the exact same attendee.So: display injects
reportOwnerAsAttendeeand shows identical attendees → conflict detection omits it, so the default self-attendee is read as[]→deepEqualmismatch →attendeesflagged as a conflict → user is wrongly prompted to choose. Merchant is unaffected because it's a plain stored string compared by===at line 306, with no owner-injection layer.Note the
.sort(localeCompare)on lines 293/296 is not the cause —localeCompareis(a, b) => number(LocaleContextProvider) andArray.prototype.sortinvokes it as(a, b), so the sort is correct. The defect is the missing report-owner injection, and it exists at all three call sites ofgetMergeableDataAndConflictFields:DetailsReviewPage,ReceiptReviewPage, and theMergeTransactionaction (the action is what runs first on "Merge" and decides whether to skip straight to confirmation).What changes do you think we should make in order to solve the problem?
Make conflict detection inject the report owner exactly like the display path already does. Add
targetReportOwnerAsAttendee/sourceReportOwnerAsAttendeeparams togetMergeableDataAndConflictFieldsand forward them to its twogetTransactionDetailscalls, mirroringbuildMergeFieldsDatalines 592-593:Then thread the owner in at every call site, reusing the existing
useReportOwnerAsAttendeehook:DetailsReviewPagealready computestargetReportOwnerAsAttendee/sourceReportOwnerAsAttendee(already passed tobuildMergeFieldsData) — just pass them into the conflict call too.ReceiptReviewPageadds the same hook calls and passes them in.MergeTransactionaction resolves them via the same underlying utils the hook uses —getReportOwnerAccountIDAsAttendee+getReportOwnerAsAttendee— and passes them in.With the owner injected on both sides, two expenses showing the same attendee produce identical login arrays,
deepEqualreturnstrue,attendeesstays out ofconflictFields, and the flow skips the prompt — keeping the conflict logic and the display perfectly in sync (which is also the correct fix for the inverse case where they currently disagree). Minor changes/improvements can be discussed in the PR phase.What alternative solutions did you explore? (Optional)
Special-case the attendees branch alone: when both transactions have empty raw
comment.attendees, treat them as equal without injecting the owner. This patches the most common path but leaves conflict detection and display reading attendees through two different code paths, so any case where only one side has an empty list (default vs explicitly-persisted self) would still diverge. ThreadingreportOwnerAsAttendeethroughgetMergeableDataAndConflictFieldsis cleaner because it makes the two paths derive attendees identically by construction.David-2002065 commentedon Jun 26, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Merging two expenses that have the same attendee still shows the
Attendeesfield on the "Select the details you want to keep" RHP, forcing the user to pick an attendee even though there is no conflict. TheMerchantfield behaves correctly in the same scenario.What is the root cause of that problem?
Conflict detection and the RHP display resolve attendees differently, so the two paths disagree about whether the attendees match.
When a transaction has no explicit attendees stored,
getAttendeesfalls back to the report owner as the default attendee — but only when areportOwnerAsAttendeeargument is provided:App/src/libs/TransactionUtils/index.ts
Lines 1159 to 1167 in 7f3e84e
The merge display path passes that fallback through
getTransactionDetails, so both expenses render the report owner:App/src/libs/MergeTransactionUtils.ts
Lines 592 to 593 in 7f3e84e
But the conflict-detection path calls
getTransactionDetailswithout it:App/src/libs/MergeTransactionUtils.ts
Lines 227 to 228 in 7f3e84e
So in
getMergeableDataAndConflictFieldsthe attendee comparison never applies the report-owner fallback. When one expense stores the attendee explicitly (e.g.[owner]) and the other relies on the implicit default ([]), the two login lists differ and the field is pushed intoconflictFields:App/src/libs/MergeTransactionUtils.ts
Lines 290 to 304 in 7f3e84e
The user sees the same attendee on both sides (because the display fills in the report owner) yet is still prompted to choose, since detection compared
[owner]against[].What changes do you think we should make in order to solve the problem?
Make conflict detection resolve attendees the same way the display does, by threading the report-owner fallback into
getMergeableDataAndConflictFields.Add the two attendees to the signature and forward them to the existing
getTransactionDetailscalls (src/libs/MergeTransactionUtils.ts):Then pass the report-owner attendees at the two call sites:
DetailsReviewPagethe values are already computed (targetReportOwnerAsAttendee/sourceReportOwnerAsAttendee) and handed tobuildMergeFieldsData; pass the same two intogetMergeableDataAndConflictFieldsso detection and display agree:App/src/pages/TransactionMerge/DetailsReviewPage.tsx
Lines 64 to 72 in 7f3e84e
setupMergeTransactionDataAndNavigateaction (which uses the result to skip the RHP when there are no conflicts) derive each transaction's report owner viagetReportOwnerAsAttendee(getReportOwnerAccountIDAsAttendee(...))from personal details and pass them in too:App/src/libs/actions/MergeTransaction.ts
Lines 105 to 113 in 7f3e84e
With both paths normalizing the implicit attendee to the report owner, the login lists match and
attendeesis no longer flagged as a conflict when the attendee is actually the same.What specific scenarios should we cover in automated tests to prevent reintroducing this in the future?
In a
getMergeableDataAndConflictFieldsunit test, assert thatattendeesis NOT inconflictFieldswhen one transaction stores the attendee explicitly and the other has no attendees but resolves to the same report owner viareportOwnerAsAttendee, and that it IS flagged when the two resolve to genuinely different attendees.What alternative solutions did you explore? (Optional)
Skip the attendee fallback entirely and compare only explicitly-stored attendees (treat empty as empty) in both detection and display. This also removes the false conflict, but it diverges from how attendees are shown everywhere else in the app (where the report owner is the implicit default), so an expense with an explicit self-attendee and one with the implicit self-attendee would still be treated as different — only hidden because both display empty. Aligning detection with the existing display fallback is more consistent.
mukhrr commentedon Jun 26, 2026
Proposal
What is the root cause of that problem?
The merge flow determines attendee conflicts using only
attendee.login ?? attendee.email:App/src/libs/MergeTransactionUtils.ts
Lines 290 to 301 in 1e18e85
That is not the canonical attendee identity. Other attendee-related logic prefers
accountIDwhen it is available, and only falls back to login/email when it is not. For example, missing-attendee validation filters byaccountIDwhenownerAccountIDis known:App/src/libs/Violations/ViolationsUtils.ts
Lines 594 to 608 in 1e18e85
The attendee selector also treats
accountIDas the primary list identity:App/src/pages/iou/request/MoneyRequestAttendeeSelector.tsx
Lines 85 to 94 in 1e18e85
So two attendee objects can represent the same person by
accountID, but still be considered different by the merge conflict detector if their login/email shape differs. That makesgetMergeableDataAndConflictFields()addattendeestoconflictFields, so the details review RHP asks the user to choose an attendee even though there is no real attendee conflict.History note: commit
e16da652e5f638d89b059b636564b1b9db51a17cchanged this merge attendee logic while removing personal-details hydration from attendees. It made the attendee check rely only on the derived login arrays, which is where this identity mismatch comes from:e16da65
What changes do you think we should make in order to solve the problem?
Normalize attendee identity before comparing attendees in
getMergeableDataAndConflictFields().Use
accountIDfirst, then fallback to normalized login/email, then display name only for name-only attendees. Prefix the key type so an account ID cannot collide with a numeric-looking login/display name.Small diff sketch:
Then replace the current login-only comparison:
To avoid regressions, keep the existing behavior that attendee order does not matter by sorting identities before comparison, keep login/email fallback for optimistic or unknown attendees, and add tests for:
accountID, different login/email shape: no attendee conflict.accountID: attendee conflict.accountID: no attendee conflict.What alternative solutions did you explore? (Optional)
We could compare attendee display strings, but that would be weaker because display names are not unique and can change. We could deep-compare the full attendee objects, but that would create false conflicts from irrelevant fields like avatar, text, selected state, or hydrated personal-detail metadata. A normalized identity comparison matches the existing attendee patterns and keeps the change scoped to merge conflict detection.
KJ21-ENG commentedon Jun 26, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-06-26 13:59:33 UTC.
Proposal
What is the root cause of that problem?
The merge flow decides whether to show the details-selection page in
getMergeableDataAndConflictFields(). Forattendees, that function currently compares only each stored attendee'slogin ?? email, and it builds those values fromgetTransactionDetails()without the report-owner fallback attendee.Other attendee display paths do not use that same shape. The expense row and merge details page can treat the report owner as the effective attendee when the stored attendee list is empty, and the details page formats attendees from display name/login. So two expenses can show the same attendee, but the conflict detector still sees different raw values, such as an empty attendee list on one expense and an explicit attendee object for the same person on the other. It then adds
attendeestoconflictFields, and the details page renders two identical attendee choices.What changes do you think we should make in order to solve the problem?
Update the attendee branch in
getMergeableDataAndConflictFields()to compare effective attendee identities instead of only rawlogin ?? emailvalues.I would add a small helper in
MergeTransactionUtilsthat builds the attendee list the merge flow should compare, including the same report-owner fallback used by attendee display when a transaction has no stored attendees. Then compare stable normalized keys for each attendee:accountIDwhen present;Sort those keys and compare the two arrays. If they match, keep
attendeesout ofconflictFieldsand setmergeableData.attendeesto the explicit target/source attendee value, or to the effective fallback value when needed so the merged expense still retains the attendee. If they differ, keep the current conflict behavior.Thread the target/source report-owner attendee, or the data needed to build it, through every
getMergeableDataAndConflictFields()caller in the merge flow: initial merge navigation, receipt review, details review, and source-selection confirmation. This stays in the App merge UI/data-normalization layer and does not change the backend request contract or unrelated merge fields like merchant, amount, category, or report.Add regression coverage for:
accountIDbut different login/email population;attendeesconflict;What alternative solutions did you explore? (Optional)
I considered comparing only the rendered attendee display string, but two different people can share a display name. I also considered hiding duplicate-looking attendee rows in the details page, but that would leave
mergeableData.attendeesunresolved and would not fix the route decision. Comparing effective attendee identities in the merge detector fixes the data decision at the source.melvin-bot commentedon Jun 26, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ChavdaSachin (
External)kitvasyl commentedon Jun 26, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
[-]Merge expenses prompts for attendee selection even when both expenses have the same attendee[/-][+][$250] Merge expenses prompts for attendee selection even when both expenses have the same attendee[/+]66 remaining items
melvin-bot commentedon Aug 12, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Aug 18, 2026
Payment Summary
Resolving PRs:
Fix - Merge expenses prompts for attendee selection even when both expenses have the same attendee #96526
Reviewer: @sobitneupane owed $250 via NewDot
Reviewer: @FitseTLT owed $250 via NewDot
BugZero Checklist (@mallenexpensify)
melvin-bot commentedon Aug 18, 2026
@mallenexpensify Eep! 4 days overdue now. Issues have feelings too...
sobitneupane commentedon Aug 19, 2026
Contributor+ Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: Move
attendeesfrom transaction to transaction's comment #58120 (comment)[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Test:
Do we agree 👍 or 👎
mallenexpensify commentedon Aug 20, 2026
Payment Summary
Contributor: @FitseTLT due $250 via NewDot
Contributor+: @sobitneupane due $250 via NewDot
flaviadefaria commentedon Aug 21, 2026
Approved: @FitseTLT due $250 via NewDot
JmillsExpensify commentedon Sep 18, 2026
$250 approved for @sobitneupane