Skip to content

[Due for payment 2026-08-12] [$250] [Exploratory] Report details - Not found page opened when clicking admin report header #94977

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.4.25-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #93267
Email or phone of affected tester (no customers): ldaksjflkajdsflkjew@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: macOS chrome
App Component: Other

Action Performed:

  1. Open ND
  2. Login with new account without + iteration
  3. In onboarding steps, choose "Manage my team's expenses" > "1-4 employees" > "QuickBooks Online" > Click "Continue"
  4. Click on dropdown icon on admin room header

Expected Result:

Admin room details should open

Actual Result:

Not found page opened

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7195357_1782825895357.Screen_Recording_2026-06-30_at_4.23.05_in_the_afternoon.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Mita Rachim
Bug ID: 7195357

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. applause-bot commented on Jun 30, 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/e486ed5dc8ab8f993918c9f5750a8f593033bf3d3fd3898e6b703d9714cd58eb

  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 17, 2026
  3. MelvinBot commented on Jul 17, 2026

    @MelvinBot
    Contributor

    Issue Analysis

    Root cause: The report details page and the chat screen use different not-found guards, and only the details guard rejects the admin room. When you tap the #admins header dropdown, it opens report details via withReportOrNotFound, which shows the "Not found" page whenever canAccessReport returns false. canAccessReport returns false if the room carries a (transient/stale) errorFields.notFound, or if #admins is treated as a default room the brand-new account can't yet access. The chat itself opens fine because ReportNotFoundGuard (used by ReportScreen) never calls canAccessReport — this is the asymmetry. This matches the diagnosis in the closely-related, now-closed #90898.

    Proposal

    What is the root cause of that problem?

    Right after "Manage my team's expenses" onboarding, the account lands in the optimistically-created #admins room. Tapping the header dropdown navigates to report details, wrapped by withReportOrNotFound. That HOC computes shouldShowNotFoundPage = !isReportLoaded || !canAccessReport(report, betas, isReportArchived). Even though the room object is fully loaded, canAccessReport returns false because the freshly-created onboarding room briefly has errorFields.notFound set (this truthy value originates from the server response and is never cleared in time; the client only ever reads or clears it), and/or #admins is a default room the new account can't yet see. ReportScreen renders the same report without issue because its guard (ReportNotFoundGuard) checks only for an invalid path or a truly-absent report — it never consults canAccessReport or errorFields.notFound. The QuickBooks Online integration selection appears to matter only because the extra workspace/connection work lengthens the window before the room is fully persisted server-side, widening this transient race.

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

    Bring the report-details not-found guard in line with the chat guard so the two can't disagree for a report the user is actively viewing:

    • In withReportOrNotFound, do not treat a loaded report as "not found" purely because of a transient errorFields.notFound while the report is still being fetched/persisted (e.g. gate on the same loading/reportExists conditions ReportNotFoundGuard uses, rather than a raw canAccessReport check that fails on a stale flag).
    • And/or ensure the stale errorFields.notFound on the optimistically-created onboarding #admins room is cleared once the room is confirmed (the client already clears notFound to null in OpenReport success data — the gap is that details can render before that clear lands).

    What alternative solutions did you explore? (Optional)

    Clearing/ignoring errorFields.notFound specifically for onboarding-created rooms; or confirming (via backend/log investigation) whether the server should stop returning errorFields.notFound for a room it just created during onboarding.

    Investigation details & evidence

    Navigation path: header dropdown press → HeaderView.tsx:359-362 → navigateToDetailsPage (ReportUtils.ts:6364-6377) → DynamicReportDetailsPage, wrapped by withReportOrNotFound().

    The gate: withReportOrNotFound.tsx:116 — shouldShowNotFoundPage = !isReportLoaded || !canAccessReport(...), renders NotFoundPage when true.

    canAccessReport: ReportUtils.ts:9321-9332 returns false on report.errorFields.notFound or default-room-without-beta.

    Chat's different guard: ReportNotFoundGuard.tsx:52-73 gates only on invalid path / report-absent-after-load. Never calls canAccessReport.

    Optimistic creation: the #admins room is built fully-formed (real reportID, policyID, chatType: POLICY_ADMINS) in buildOptimisticWorkspaceChats and written in Policy.ts; no client code ever sets errorFields.notFound to a truthy value — it is only read or cleared to null (e.g. OpenReport success data). So the truthy value is server-originated and transient.

    Confidence: Medium-High. The client-side guard asymmetry is confirmed with file:line evidence. The exact server-side trigger and why QuickBooks Online specifically widens the race window would benefit from production log confirmation for a repro requestID (checking whether the OpenReport/reconnect response for the admins reportID returns errorFields.notFound, and its timing relative to workspace creation).

    Note on scope: the App-side guard fix above is fully actionable within Expensify/App. If the team prefers to stop the transient errorFields.notFound at the source, that part involves the backend and would need an internal engineer to confirm.

    Related issues


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/94977) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 17, 2026
  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jul 17, 2026
  6. melvin-bot commented on Jul 17, 2026

    @melvin-bot

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

  7. melvin-bot commented on Jul 17, 2026

    @melvin-bot
  8. changed the title [-][Exploratory] Report details - Not found page opened when clicking admin report header[/-] [+][$250] [Exploratory] Report details - Not found page opened when clicking admin report header[/+] on Jul 17, 2026
  9. wildan-m commented on Jul 17, 2026

    @wildan-m
    Contributor

    Proposal

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

    Clicking the dropdown icon on the admin room (#admins) header — for example right after completing the "Manage my team's expenses" onboarding flow — opens a Not found page instead of the report details page.

    What is the root cause of that problem?

    The header dropdown calls navigateToDetailsPage(report), which builds the details route from the currently active route rather than from the target report's own route:

    App/src/libs/ReportUtils.ts

    Lines 6104 to 6117 in 0d0e0d8

    const isOneOnOneChatReport = isOneOnOneChat(report);
    const participantAccountID = getParticipantsAccountIDsForDisplay(report);
    if (isSelfDMReport || isOneOnOneChatReport) {
    Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.PROFILE.getRoute(participantAccountID.at(0))));
    return;
    }
    if (report?.reportID) {
    Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.REPORT_DETAILS.path));
    }
    }
    /**

    The createDynamicRoute(DYNAMIC_ROUTES.REPORT_DETAILS.path) call is invoked without a base path, so createDynamicRoute falls back to Navigation.getActiveRoute() and appends details to whatever route is currently on top:

    const createDynamicRoute = (dynamicRouteSuffixWithParams: string, basePath?: string): Route => {
    const [suffixPath] = splitPathAndQuery(dynamicRouteSuffixWithParams);
    if (!suffixPath || !isDynamicRouteSuffix(suffixPath)) {
    throw new Error(`The route name ${suffixPath} is not supported in createDynamicRoute`);
    }
    const routePath = basePath ?? Navigation.getActiveRoute();
    return combinePathAndSuffix(routePath, dynamicRouteSuffixWithParams);
    };

    When the admin room is reached through the onboarding flow, the active route on top is not the report's own r/<reportID> route, so the resulting path does not carry a valid reportID. withReportOrNotFound then finds no loaded report for that route and renders the Not found page:

    const isReportLoaded = !isEmptyObject(report) && !!report?.reportID;
    const isReportArchived = useReportIsArchived(report?.reportID);
    // The `isLoadingInitialReportActions` value will become `false` only after the first OpenReport API call is finished (either succeeded or failed)
    const shouldFetchReport = isReportIdInRoute && reportLoadingState?.isLoadingInitialReportActions !== false;
    // When accessing certain report-dependant pages (e.g. Task Title) by deeplink, the OpenReport API is not called,
    // So we need to call OpenReport API here to make sure the report data is loaded if it exists on the Server
    useEffect(() => {
    if (isReportLoaded || !shouldFetchReport) {
    // If the report is not required or is already loaded, we don't need to call the API
    return;
    }
    openReport({reportID: props.route.params.reportID, introSelected, betas});
    // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [shouldFetchReport, isReportLoaded, props.route.params.reportID]);
    if (shouldRequireReportID || isReportIdInRoute) {
    const shouldShowFullScreenLoadingIndicator = !isReportLoaded && (isLoadingReportData !== false || shouldFetchReport);
    const shouldShowNotFoundPage = !isReportLoaded || !canAccessReport(report, betas, isReportArchived);
    // If the content was shown, but it's not anymore, that means the report was deleted, and we are probably navigating out of this screen.
    // Return null for this case to avoid rendering FullScreenLoadingIndicator or NotFoundPage when animating transition.
    if (shouldShowNotFoundPage && contentShown.current && !isFocused) {
    return null;
    }
    if (shouldShowFullScreenLoadingIndicator) {
    const reasonAttributes: SkeletonSpanReasonAttributes = {
    context: 'withReportOrNotFound',
    isLoadingReportData: isLoadingReportData !== false,
    shouldFetchReport,
    };
    return (
    <FullscreenLoadingIndicator
    shouldUseGoBackButton
    reasonAttributes={reasonAttributes}
    />
    );
    }
    if (shouldShowNotFoundPage) {
    return <NotFoundPage isReportRelatedPage />;
    }

    This is a regression from commit 4c77dd1cb2b ("fix: remove report_with_id"), which removed the explicit report base path from navigateToDetailsPage. The sibling function goBackToDetailsPage in the same file was left intact and still anchors the details route to the report's own reportID:

    App/src/libs/ReportUtils.ts

    Lines 6131 to 6137 in 0d0e0d8

    Navigation.goBack(backTo ?? createDynamicRoute(DYNAMIC_ROUTES.REPORT_DETAILS.path, ROUTES.REPORT_WITH_ID.getRoute(report.reportID)));
    } else {
    const reportDetailsPath = createDynamicRoute(DYNAMIC_ROUTES.REPORT_DETAILS.path, ROUTES.REPORT_WITH_ID.getRoute(report.reportID));
    Navigation.goBack(createDynamicRoute(DYNAMIC_ROUTES.REPORT_SETTINGS.path, reportDetailsPath));
    }
    } else {
    Log.warn('Missing reportID during navigation back to the details page');

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

    In navigateToDetailsPage, restore the explicit report base path so the details route is anchored to the target report rather than to whatever route happens to be active. Change the navigation call so it passes the report's own route as the base path — the same pattern the sibling goBackToDetailsPage already uses:

    Pass ROUTES.REPORT_WITH_ID.getRoute(report.reportID) as the second argument to createDynamicRoute(DYNAMIC_ROUTES.REPORT_DETAILS.path, ...) at line 6115. This makes the constructed path r/<reportID>/details regardless of the current active route, so the details page always receives the correct reportID and no longer falls back to the Not found page.

    ROUTES is already imported in the file and this mirrors the existing, working call at line 6135, keeping the two functions consistent.

    Compare branch: https://github.com/Expensify/App/compare/main...wildan-m:App:wildan/94977-details-page-report-base-path?expand=1

    Result

    Before

    Kapture.2026-07-21.at.07.53.04.mp4

    After

    Kapture.2026-07-21.at.07.56.51.mp4

    Note on reproducing: the backend assigns the onboarding experiment arm per account, so a fresh account may draw a Concierge variant (the Side Panel opens the Concierge DM instead of the #admins room). If that happens, run await Onyx.merge('nvp_onboardingRHPVariant', 'rhpAdminsRoom'); in the dev console after onboarding completes — the open Side Panel switches to the #admins room immediately and the repro proceeds identically.

    What alternative solutions did you explore? (Optional)

    Anchoring inside createDynamicRoute itself (e.g. deriving the report route when the suffix is details) was considered, but that helper is generic across many dynamic routes and should not special-case report details. Fixing it at the call site in navigateToDetailsPage is the minimal, targeted change and matches the established pattern used by the other details-navigation helpers in the same file.

  10. MelvinBot commented on Jul 17, 2026

    @MelvinBot
    Contributor

    Issue Analysis (updated — corrects my earlier comment)

    After verifying against the code and git history, the root cause wildan-m identified above is correct, and it supersedes the errorFields.notFound / canAccessReport hypothesis in my first comment. This is a deterministic route-construction regression, not a server-side race.

    Root cause: navigateToDetailsPage calls createDynamicRoute(DYNAMIC_ROUTES.REPORT_DETAILS.path) without a base path. createDynamicRoute then falls back to Navigation.getActiveRoute() and appends details to whatever route is on top of the stack. Right after onboarding the active route is not the room's r/<reportID> route, so the built path carries no valid reportID. In withReportOrNotFound the route param reportID is then empty/wrong, so report loads empty and the !isReportLoaded branch fires (not !canAccessReport) → Not found page.

    Regression: commit 4c77dd1cb2b ("fix: remove report_with_id") removed the ROUTES.REPORT_WITH_ID.getRoute(report.reportID) base-path argument from navigateToDetailsPage. The sibling goBackToDetailsPage was left intact and still anchors correctly — matching the asymmetry wildan-m describes.

    Recommended fix: As proposed, restore the explicit report base path in navigateToDetailsPage by passing ROUTES.REPORT_WITH_ID.getRoute(report.reportID) as the second argument to createDynamicRoute, mirroring goBackToDetailsPage. This makes the path r/<reportID>/details regardless of the active route.

    Verification evidence
    • Before the regression, navigateToDetailsPage passed the base path (diff of 4c77dd1cb2b):
      -   Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.REPORT_DETAILS.path, ROUTES.REPORT_WITH_ID.getRoute(report.reportID)));
      +   Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.REPORT_DETAILS.path));
      That commit's ReportUtils patch does not touch goBackToDetailsPage, confirming it was left anchored.
    • createDynamicRoute fallback: const routePath = basePath ?? Navigation.getActiveRoute();
    • withReportOrNotFound reads reportID purely as a route param (line 86) → useOnyx(REPORT + reportID) → isReportLoaded = !isEmptyObject(report) && !!report?.reportID (line 97) → shouldShowNotFoundPage = !isReportLoaded || !canAccessReport(...) (line 116). With no valid reportID in the path, the first operand short-circuits, so the not-found page is driven by !isReportLoaded.
    • The one runtime assumption not provable from code alone is that Navigation.getActiveRoute() is not r/<reportID> in this specific post-onboarding scenario — but the deterministic fallback mechanism and the exact repro (only reproducible when reaching the room via onboarding, not by opening details normally) both support it.

    Correction note: my first comment attributed the not-found to canAccessReport returning false on a stale errorFields.notFound. That path exists but is not what fires here — the reportID never reaches the guard in a valid form, so the failure is upstream of canAccessReport.


    Next Steps for Contributor+ team:
    To accept: the proposal from wildan-m above matches the verified root cause and fix — review and 👍 to assign, or reply @MelvinBot implement [this](https://github.com/Expensify/App/issues/94977) to have me open a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting this analysis.

  11. 34 remaining items

  12. marufsharifi commented on Aug 10, 2026

    @marufsharifi
    Contributor

    BugZero 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:
      Link to the comment on the Issue:

    • [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.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/671507

    Regression Test Proposal

    Precondition:

    Test:

    1. Log in with a new account without + iteration
    2. In onboarding steps, choose "Manage my team's expenses" > "1-4 employees" > "QuickBooks Online" > Click "Continue"
    3. Click on the dropdown icon on the admin room header
    4. Verify that the Admin room details should open

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-670d-a625-62d9-e01150ed8ff4
  13. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    on Aug 10, 2026
  14. melvin-bot commented on Aug 10, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  15. melvin-bot commented on Aug 11, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    Upwork Job

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
  16. mallenexpensify commented on Aug 13, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @lorretheboy paid $250 via Upwork
    Contributor+: @marufsharifi paid $250 via Upwork

    Both, can you please accept the job below? Please reply here and tag me once you have.
    https://www.upwork.com/jobs/~022078173635597120579

  17. lorretheboy commented on Aug 14, 2026

    @lorretheboy
    Contributor

    @mallenexpensify Thanks. I accepted the job

  18. marufsharifi commented on Aug 14, 2026

    @marufsharifi
    Contributor

    @mallenexpensify, I've accepted the offer. thanks.

  19. mallenexpensify commented on Aug 18, 2026

    @mallenexpensify
    Contributor

    @marufsharifi @lorretheboy paid, summary updated above. Thx.

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions