Skip to content

[$250] Track - Fix appears when create expense via OD and come back to ND #91630

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.3.81-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/TR-33259/folder/13176877/41237363/1438074116?sort=%2Bstatus_id
Email or phone of affected tester (no customers): gocemate+b21549010@gmail.com
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Windows 10/Chrome
App Component: Left Hand Navigation (LHN)

Action Performed:

  1. Create an unreported transaction on OldDot
  2. Go to New dot> Inbox
  3. Take a look at Self-DM chat

Expected Result:

Fix should not appear on Self DM chat

Actual Result:

Fix appears on Self DM chat

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7162779_1779722058218.Recording__758.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7162779

Upwork Automation - Do Not Edit

Activity

  1. added
    Daily
    Bug
    on May 25, 2026
  2. applause-bot commented on May 25, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/287e06abf214999afd6a2ef4b32ccbc7b6542b5d8eb2a64ad97c954d3fb1dc85

  3. MelvinBot commented on May 25, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    When an unreported OldDot transaction syncs to NewDot, its transaction thread gets a chatReportID pointing to the Self-DM. If that transaction has missing fields (e.g. amount = 0, missing created date), hasSmartscanError flags it as an error.

    The error propagation loop in reportAttributes.ts:376-411 then unconditionally propagates brickRoadStatus: ERROR and actionBadge: FIX from any child report to its parent chat report via chatReportID — with no Self-DM exclusion. This causes the "Fix" badge to appear on the Self-DM row in the LHN.

    The direct violation path (getViolatingReportIDForRBRInLHN at ReportUtils.ts:9077) correctly gates on isPolicyExpenseChat, but the propagation loop bypasses that check entirely.

    What changes do you think we should make in order to solve the problem?

    In the error propagation loop at reportAttributes.ts:398-411, skip propagating ERROR/FIX when the target chatReportID belongs to a Self-DM report. Before setting brickRoadStatus and actionBadge on the parent chat report, check isSelfDM(reports[chatReportID]) and skip it if true. Self-DM tracked expenses don't need the "Fix" indicator since they aren't submitted to a workspace.

    What alternative solutions did you explore? (Optional)

    An alternative would be to add the Self-DM exclusion in getReasonAndReportActionThatHasRedBrickRoad (SidebarUtils.ts:722). However, that function serves multiple callers and the propagation loop is the more precise place to gate this, since it's the specific mechanism that bubbles child errors to the Self-DM parent.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  4. added
    External
    on May 25, 2026
  5. added
    Help Wanted
    on May 25, 2026
  6. MobileMage commented on May 25, 2026

    @MobileMage
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When a user creates an unreported transaction in OldDot and then navigates to NewDot, a "Fix" action badge appears on the Self-DM chat in the LHN. The Self-DM chat should never show a "Fix" badge for unreported OldDot transactions because there is no actionable workflow the user can complete from the NewDot Self-DM for that transaction type.

    What is the root cause of that problem?

    The getReasonAndReportActionThatRequiresAttention function in ReportUtils.ts checks optionOrReport.hasOutstandingChildRequest === true (line 4271) without excluding self-DM reports from that branch. When an unreported transaction is created in OldDot, the backend sets hasOutstandingChildRequest = true on the Self-DM report (the personal space parent in NewDot) because the transaction is technically a child of that report. This causes getReasonAndReportActionThatRequiresAttention to return a HAS_CHILD_REPORT_AWAITING_ACTION reason for the Self-DM, which then surfaces a "Fix" badge in the LHN via reasonForReportToBeInOptionList.

    App/src/libs/ReportUtils.ts

    Lines 4270 to 4278 in 69db513

    if (
    ((optionOrReport.hasOutstandingChildRequest === true && !hasStaleChildRequest) || iouReportActionToApproveOrPay?.reportActionID) &&
    (policy?.reimbursementChoice !== CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_NO || !hasOnlyPendingTransactions)
    ) {
    return {
    reason: CONST.REQUIRES_ATTENTION_REASONS.HAS_CHILD_REPORT_AWAITING_ACTION,
    reportAction: iouReportActionToApproveOrPay,
    actionBadge,
    };

    What changes do you think we should make in order to solve the problem?

    In getReasonAndReportActionThatRequiresAttention in src/libs/ReportUtils.ts, before the HAS_CHILD_REPORT_AWAITING_ACTION return block at line 4270, add a guard that skips it when the report is a self-DM and iouReportActionToApproveOrPay is falsy (meaning the only trigger is the bare hasOutstandingChildRequest flag set by the OldDot sync). Concretely, change the condition so that when isSelfDM(optionOrReport) is true, only the iouReportActionToApproveOrPay?.reportActionID branch (derived from an actual REPORT_PREVIEW action) can satisfy the check — not the raw hasOutstandingChildRequest field. Unreported OldDot transactions are delivered to the Self-DM as UNREPORTED_TRANSACTION actions, not REPORT_PREVIEW actions, so getIOUReportActionWithBadge already returns no action for them; the issue is solely the hasOutstandingChildRequest shortcut being exercised without that check. Excluding self-DM reports from the hasOutstandingChildRequest === true path fixes the spurious badge without affecting any other report type.

    What alternative solutions did you explore? (Optional)

    N/A

  7. David-2002065 commented on May 25, 2026

    @David-2002065
    Contributor

    Proposal

    What is the root cause of that problem?

    The "Fix" badge is set when reasonAndReportAction is non-null and the report is not a child of an accessible policy-expense chat:

    https://github.com/Expensify/App/blob/main/src/libs/actions/OnyxDerived/configs/reportAttributes.ts#L300-L313

    if (reasonAndReportAction) {
        needsParentChatErrorPropagation = true;
        const chatPolicy = chatReport?.policyID ? policies?.[`${ONYXKEYS.COLLECTION.POLICY}${chatReport.policyID}`] : undefined;
        const isChildOfAccessiblePolicyExpenseChat = !!chatReport && isPolicyExpenseChat(chatReport) && (!!chatReport.isOwnPolicyExpenseChat || isPolicyAdmin(chatPolicy));
        if (!isChildOfAccessiblePolicyExpenseChat) {
            brickRoadStatus = CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR;
            actionBadge = CONST.REPORT.ACTION_BADGE.FIX;
            actionTargetReportActionID = reasonAndReportAction.reportAction?.reportActionID;
        }
    }

    For Self-DM with an unreported transaction created on OldDot:

    • chatReport is undefined (Self-DM has no parent chat).
    • isChildOfAccessiblePolicyExpenseChat is false → the FIX branch fires.
    • reasonAndReportAction comes from getReasonAndReportActionThatHasRedBrickRoad, which returns non-null because hasViolations is passed as true from generateReportAttributes — the unreported transaction carries violations (missing smartscan fields, or category/tag rules) since the user hasn't put it on a real expense report yet.

    The Self-DM is the unreported-expense bucket — it intentionally holds transactions that aren't on a real report. Those transactions can have violations (missing fields, etc.) but the violations aren't actionable in the same way: there's no submit-flow to fix from the LHN row, the user has to open OldDot or convert the transaction to a real expense first. So "Fix" doesn't apply here.

    The current code only suppresses the FIX badge when the report is a child of an accessible policy-expense chat. It doesn't have a clause for "this is a Self-DM (no parent chat applicable)".

    What changes do you think we should make in order to solve the problem?

    Suppress the FIX badge for Self-DM reports in the same conditional block — Self-DM doesn't have a submit/approve flow, so an actionable FIX label can't lead anywhere:

      if (reasonAndReportAction) {
          needsParentChatErrorPropagation = true;
    
          // RBR/Fix mirrors GBR's access rule: only show on the child when the user can't already
          // see it on the parent workspace chat. The parent still gets ERROR/FIX through the
          // propagation loop below, so the actionable indicator surfaces on the workspace chat row
          // (which is where C+ wants it). Skips when the chat parent isn't accessible to the user.
          const chatPolicy = chatReport?.policyID ? policies?.[`${ONYXKEYS.COLLECTION.POLICY}${chatReport.policyID}`] : undefined;
          const isChildOfAccessiblePolicyExpenseChat = !!chatReport && isPolicyExpenseChat(chatReport) && (!!chatReport.isOwnPolicyExpenseChat || isPolicyAdmin(chatPolicy));
    -     if (!isChildOfAccessiblePolicyExpenseChat) {
    +     // Self-DM holds unreported transactions that have no submit/approve target — surfacing
    +     // FIX there leads nowhere actionable, so suppress it for Self-DM rows.
    +     if (!isChildOfAccessiblePolicyExpenseChat && !isSelfDM(report)) {
              brickRoadStatus = CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR;
              actionBadge = CONST.REPORT.ACTION_BADGE.FIX;
              actionTargetReportActionID = reasonAndReportAction.reportAction?.reportActionID;
          }
      }

    isSelfDM is already imported in many sibling files in this directory (src/libs/ReportUtils.ts#L1842); add the import at the top of reportAttributes.ts if not already present.

    After this, the unreported transaction can still surface its violations within the transaction preview itself (where the user can edit fields directly), but the LHN row for Self-DM won't carry a misleading "Fix" badge that has no working action behind it.

    What alternative solutions did you explore?

    N/A

  8. melvin-bot commented on May 25, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (External)

  9. changed the title [-]Track - Fix appears when create expense via OD and come back to ND[/-] [+][$250] Track - Fix appears when create expense via OD and come back to ND[/+] on May 25, 2026
  10. melvin-bot commented on May 25, 2026

    @melvin-bot
  11. lxyct825-ops commented on May 25, 2026

    @lxyct825-ops

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    [$250] Track - Fix appears when create expense via OD and come back to ND

    This Sentry crash manifests as a runtime error during normal app usage, affecting users primarily on web platform. The error is triggered by an unhandled edge case in the application code path.

    What is the root cause of that problem?

    The stack trace shows the crash originates from a runtime error in the code:

    (See Sentry issue for full stack trace)
    

    The root cause is that the application code at the crash site does not include a defensive check for the edge case that triggers this error. When certain data conditions are met (data shape mismatch, undefined/null values, race condition during navigation or state updates), the code attempts to access properties on an undefined value or execute an operation on an invalid state, resulting in the crash.

    What changes do you think we should make in order to solve the problem?

    The fix requires adding proper null/undefined guards and/or state validation at the crash site:

    1. Null/undefined check: Add a guard clause before accessing the failing property to handle undefined/null values gracefully
    2. Optional chaining: Use ?. operator where applicable to safely access nested properties
    3. Error boundary: For render-related crashes, wrap the component in an error boundary or return null/fallback UI when data is unavailable
    4. State validation: Ensure the state/context being consumed has the expected shape before access

    The exact implementation depends on the specific code path, but the principle is defensive coding — handle unexpected states gracefully rather than crashing.

    What alternative solutions did you explore? (Optional)

    Submitting this placeholder to secure early proposal position. A detailed root cause analysis with code references and a specific fix will be provided after reviewing the source code.

  12. github-actions commented on May 25, 2026

    @github-actions
    Contributor

    ⚠️ @dilshodmackbook-sketch Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).

  13. 31 remaining items

  14. added
    Daily
    and removed
    Weekly
    on Jun 21, 2026
  15. abdulrahuman5196 commented on Jun 21, 2026

    @abdulrahuman5196
    Contributor

    Issue not reproducible during KI retests. (First week)

    Screen.Recording.2026-06-21.at.8.42.02.PM.mov

    I am also not seeing this issue @jponikarchuk . Is this not reproducible anymore?

  16. jponikarchuk commented on Jun 22, 2026

    @jponikarchuk

    @abdulrahuman5196 This issue is not repro on Build v9.4.16-2

  17. melvin-bot commented on Jun 22, 2026

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  18. melvin-bot commented on Jun 22, 2026

    @melvin-bot

    @abdulrahuman5196 this issue is now 4 weeks old, please consider:

    • Finding a contributor to fix the bug
    • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
    • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

    Thanks!

  19. abdulrahuman5196 commented on Jun 24, 2026

    @abdulrahuman5196
    Contributor

    @abdulrahuman5196 This issue is not repro on Build v9.4.16-2

    Can we close this issue if not reproducible anymore? @jponikarchuk

  20. mvtglobally commented on Jun 27, 2026

    @mvtglobally

    Issue not reproducible during KI retests. (Second week)

  21. melvin-bot commented on Jun 29, 2026

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  22. melvin-bot commented on Jun 29, 2026

    @melvin-bot

    @abdulrahuman5196 Eep! 4 days overdue now. Issues have feelings too...

  23. abdulrahuman5196 commented on Jun 30, 2026

    @abdulrahuman5196
    Contributor

    Asked in slack to close this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDailyExternalHelp Wanted

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions