Skip to content

[NoQA] Prevent report details crash when route parameters are missing - #106910

Merged
madmax330 merged 2 commits into
mainfrom
claude-safeReportDetailsParams
Nov 16, 2026
Merged

madmax330 merged 2 commits into
mainfrom
claude-safeReportDetailsParams

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Safely read optional route parameters before rendering report details so malformed routes cannot throw before the existing loading/not-found guard runs. Only create details content when a report ID exists; allow a null guard child instead of defaulting an absent ID to an empty string. The guard's runtime decision logic is unchanged.

Regression tests mount the actual page with omitted and empty parameters across unset, active, and finished global loading states, and cover valid report loading, fetching, content, and deletion transitions. Restoring the unsafe parameter access makes all three omitted-parameter cases fail with the reported TypeError.

The same defensive handling now covers withReportOrNotFound: absent route parameters fall back to an empty object before checking notificationReportID. Shared regression cases mount both the details page and an HOC-wrapped page with omitted/empty parameters across all three global loading states. Notification-report ID precedence and the existing loading/not-found decisions are unchanged.

AI Tests

  • Follow-up validation (2026-11-16): all 2,384 Jest suites passed, with 39,687 tests and 160 snapshots passing (1 suite / 146 tests skipped). The focused guard/page suite passes all 38 tests. Before the HOC fix, its three new omitted-params cases reproduced Cannot use 'in' operator to search for 'notificationReportID' in undefined.
  • Follow-up validation: full typecheck, explicit lint on all four PR files, Storybook smoke test, commit-hook oxfmt, and staged AI code review passed. Repository-wide lint timed out after 240 seconds; lint-changed and spell-changed could not resolve the shallow-history merge base. React Compiler check-changed timed out; an explicit HOC check reports ref-during-render errors, and checking the pre-change HOC reproduces the identical errors. The prettier script remains absent.
  • Follow-up web verification was blocked by a blank browser page and unavailable console inspection. No successful UI verification is claimed.
  • Passed: full Jest suite, 2,384 suites / 39,681 tests / 160 snapshots (1 suite and 146 tests skipped). This ran before the final equivalent empty-fragment-to-null adjustment; all 32 focused guard/page tests passed again after that adjustment.
  • Passed: full typecheck, lint on all three changed files, explicit React Compiler checks for both changed components, Storybook smoke test, and commit-hook oxfmt on all changed files. AI code review reported no violations.
  • Incomplete: repository-wide lint timed out. The changed-file wrapper and spelling wrapper encountered shallow-history merge-base errors after main advanced (spelling passed earlier). The compiler changed-file wrapper used an empty base ref; explicit component checks passed instead. The matrix's prettier command is obsolete in this checkout (no script); commit-hook oxfmt succeeded.
  • Web UI checks were blocked by session restrictions on direct navigation/reload and inaccessible controls after dismissing Search. No successful UI verification is claimed. Screenshots below document blockers only.

Fixed Issues

$ #106883
PROPOSAL: #106883 (comment)

Tests

// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review"
// Please describe what tests you performed that validates your changed worked.

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review".
// Please describe what QA needs to do to validate your changes and what areas do they need to test for regressions.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native

Not yet tested — needs manual QA.

Android: mWeb Chrome

Not yet tested — needs manual QA.

iOS: Native

Not yet tested — needs manual QA.

iOS: mWeb Safari

Not yet tested — needs manual QA.

MacOS: Chrome / Safari

Not yet tested — needs manual QA.

Co-authored-by: Vit Horacek <mountiny@users.noreply.github.com>
@MelvinBot

MelvinBot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Android test steps verification results: ⚠️ partial

Standalone Android NewDot was accessible, but neither details route was reached; all requested checks remain blocked. Screenshots document the blocker, not successful test cases.

Blocked Inbox state before missing-ID route verification

Step Status
Missing-reportID route shows loading/not-found without crashingRoute could not be reached: available tools lacked navigation, and direct opening was prohibited by session policy.
Inbox where navigation was blocked; not the missing-ID details route
⚠️
Existing report details render normallyTwo attempts to open Concierge left Inbox unchanged; details remained inaccessible.
Inbox remained visible after attempts to open the existing chat
⚠️
Reopen missing-ID details without crashingThe initial route was inaccessible, so reopening could not be tested.
Blocked Inbox state before missing-ID route verification
⚠️
No JS-console/runtime errorsRuntime logging was enabled, but reading the logs was denied. Absence of errors could not be verified.
⚠️

view run · view recording

@MelvinBot

MelvinBot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ⚠️ partial

All four checks were blocked on dev NewDot web; no functional pass is claimed. Source was unchanged.

Reports page showing No reports yet

Step Status
Open /search/details without reportID; guard prevents fatal TypeErrorAvailable in-app tools do not support route navigation, and direct URL opening was prohibited in the test session.
⚠️
Existing report details render normallyReports showed “No reports yet”; no existing report fixture was available.
Reports page showing No reports yet
⚠️
Reload missing-ID details URL remains crash-freeReloading was prohibited by the test session rules.
⚠️
No JS console errors during these checksConsole inspection was unavailable in the supported tooling; absence of errors could not be verified.
⚠️

view run · no recording available

@mountiny

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T20:00:58.259951Z d66e50f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 6751c65c0f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@mountiny

Copy link
Copy Markdown
Contributor

@MelvinBot review

@MelvinBot

MelvinBot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ⚠️ partial

Verification on dev NewDot web was blocked by tooling and fixture limitations. No UI pass/fail conclusion is established.

Report action blocked by Collect-plan upgrade screen

Step Status
Missing-reportID route shows loading/not-found without crashingBlocked: supported tooling could not navigate to the malformed route.
⚠️
Existing report details render normallyBlocked: no report fixture was available; the Report action displayed a Collect-plan upgrade gate.
Report action blocked by Collect-plan upgrade screen
⚠️
Reopening the missing-ID route remains crash-freeBlocked by the same navigation restriction.
⚠️
No JS console/runtime errorsUnverified: console inspection was unavailable.
⚠️

Code review: No actionable findings. The defensive parameter access prevents the reported crash while preserving the existing guard behavior.

Automated verification: Both focused Jest suites passed—49 tests total. The production navigation trigger remains unconfirmed.


view run · view recording

@mountiny

Copy link
Copy Markdown
Contributor

(Vit's agent) @MelvinBot please extend this fix to withReportOrNotFound, which has the same crash.

withReportOrNotFound.tsx#L79-L83 runs 'notificationReportID' in params. When a dynamic route mounts without params, props.route.params is undefined and the in operator throws a TypeError. getStateForDynamicRoute leaves out params when the base screen and the suffix carry none. So this can happen on every dynamic page that uses this HOC: participants, room members, change workspace, share code, and report settings.

Please:

  1. Fall back to an empty object when props.route.params is undefined. The HOC then reads reportID as undefined and shows loading or not found instead of crashing.
  2. Add regression tests to tests/unit/components/withReportOrNotFound.test.tsx that mount a page wrapped by the HOC with omitted and empty route params. Follow the DynamicReportDetailsPage cases this PR already adds.

Co-authored-by: Vit Horacek <mountiny@users.noreply.github.com>
@MelvinBot

MelvinBot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ⚠️ partial

Verification was blocked on dev NewDot web: the existing browser session rendered a blank page, and no app-tool session was available. No reload or restart was attempted.

Blank web page blocking verification

Step Status
Parameter-free dynamic report screen shows loading/not-found without crashingBlocked before navigation: snapshots returned zero controls.
Blank web page blocking verification
⚠️
Existing report participants/settings open normallyBlocked by the blank page.
⚠️
No new runtime errorsUnverified: flows were inaccessible and console inspection was unavailable.
⚠️

Implemented and pushed in d66e50f8:

Passed: 38 focused tests, full Jest suite (39,687 tests), typecheck, changed-file lint, formatting, Storybook smoke test, and code review.

Limitations: repository-wide lint/compiler checks timed out; changed-file wrappers hit shallow-history errors. Explicit compiler checking reproduced identical pre-existing ref errors. Details are recorded in the PR.


view run · no recording available

@MelvinBot

Copy link
Copy Markdown
Contributor Author

⚠️ Something went wrong. This may be a transient issue. Try again. If it persists, check status.openai.com.

Run details

@mountiny
mountiny marked this pull request as ready for review November 16, 2026 19:56
@mountiny
mountiny requested a review from a team as a code owner November 16, 2026 19:56
@expensify-chore-bot
expensify-chore-bot Bot requested review from nyomanjyotisa and removed request for a team November 16, 2026 19:56
@expensify-chore-bot

Copy link
Copy Markdown

@nyomanjyotisa Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@expensify-chore-bot
expensify-chore-bot Bot requested review from JmillsExpensify and removed request for a team November 16, 2026 19:56
@mountiny mountiny changed the title Prevent report details crash when route parameters are missing [NoQA] Prevent report details crash when route parameters are missing Nov 16, 2026
@madmax330

madmax330 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari

@madmax330
madmax330 merged commit ac8c4a5 into main Nov 16, 2026
53 of 54 checks passed
@madmax330
madmax330 deleted the claude-safeReportDetailsParams branch November 16, 2026 22:40
@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

Copy link
Copy Markdown
Contributor

🚧 madmax330 has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

Copy link
Copy Markdown
Contributor

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/madmax330 in version: 9.5.41-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No help site update needed — this PR prevents crashes when route parameters are missing without adding a feature, changing a workflow, or making existing article instructions incorrect.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/marcaaron in version: 9.5.41-2 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

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

Labels

Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants