Skip to content

[Phase 2] Part 4 - Migrate deprecatedGetReportName to getReportName in libs - #98047

Merged
marcochavezf merged 17 commits into
Expensify:mainfrom
hoangzinh:split/pr1b-remaining-narrowings-and-sweep
Sep 17, 2026
Merged

marcochavezf merged 17 commits into
Expensify:mainfrom
hoangzinh:split/pr1b-remaining-narrowings-and-sweep

Conversation

@hoangzinh

@hoangzinh hoangzinh commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Fixed Issues

$ #66427
PROPOSAL:

Tests

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

1. Report name displays correctly in LHN

  1. Sign in to ND
  2. Check chat list in LHN
  3. Verify report/chat names display correctly for all types: DM, group chat, policy expense chat, invoice room

2. Browser Notification (Web only)

  1. Open app in web browser, enable notification permission
  2. Switch to another tab (so app loses focus)
  3. Have another user send a message into a room/group chat
  4. Verify notification shows correct room name in title

3. Search displays correct report name

  1. Go to Search, use the in: filter (select a report)
  2. Verify report name displays correctly in filter chip
  3. Verify search results show correct report name

4. Task — Share Destination

  1. Create a new task (+ > Task)
  2. Select Share destination (report to send task to)
  3. Verify report name displays correctly at Share destination

5. Invoice Room

  1. Open an invoice room
  2. Verify name displays correctly
  • 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 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 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

Screen.Recording.2026-08-10.211333.mp4

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/libs/ModifiedExpenseMessage.ts 91.45% <100.00%> (ø)
src/libs/OptionsListUtils/index.ts 91.28% <100.00%> (ø)
src/libs/ReportAlternateTextUtils.ts 87.24% <100.00%> (+0.03%) ⬆️
src/libs/ReportNameUtils.ts 81.03% <ø> (-0.09%) ⬇️
src/libs/ReportUtils.ts 87.21% <100.00%> (ø)
src/libs/SearchQueryUtils.ts 88.17% <100.00%> (+<0.01%) ⬆️
src/libs/SearchUIUtils.ts 72.00% <100.00%> (+<0.01%) ⬆️
src/libs/SidebarUtils.ts 90.44% <100.00%> (ø)
src/libs/actions/Report/index.ts 71.68% <100.00%> (+0.09%) ⬆️
src/libs/actions/Task.ts 67.70% <ø> (ø)
... and 7 more
... and 8 files with indirect coverage changes

…e remaining callers

A2: narrow getChatListItemReportName and getReportPreviewMessageForCopy to
take a derivedReportName string; SearchActionHeader now sources it via
useDerivedReportNameByReportID.

Notifications: thread a derivedReportName string through
showReportActionNotification, the LocalNotification chain and
ModifiedExpenseMessage instead of the whole reportAttributes Record.

Task: narrow getShareDestination; DynamicNewTaskPage sources the name via
useDerivedReportNameByReportID.

Sweep: replace the remaining deprecatedGetReportName call sites in
OptionsListUtils, SidebarUtils, SearchQueryUtils and SearchUIUtils with
getReportName, extracting the single report name inline (no behavior change).

Part of Expensify#66427 Phase 2. Stacked on the transaction-message narrowing PR.
- Remove deprecated wrapper function and its export
- All callers already migrated to getReportName directly
@hoangzinh
hoangzinh force-pushed the split/pr1b-remaining-narrowings-and-sweep branch from 122f961 to 9091962 Compare September 1, 2026 12:19
@hoangzinh
hoangzinh marked this pull request as ready for review September 1, 2026 15:37
@hoangzinh
hoangzinh requested review from a team as code owners September 1, 2026 15:37
@melvin-bot
melvin-bot Bot requested review from DylanDylann and JmillsExpensify and removed request for a team September 1, 2026 15:37
@melvin-bot

melvin-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

@DylanDylann 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]

@melvin-bot
melvin-bot Bot removed the request for review from a team September 1, 2026 15:37

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 90919627d5

ℹ️ 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".

Comment thread src/libs/actions/User.ts Outdated
@JmillsExpensify
JmillsExpensify removed their request for review September 1, 2026 17:45

@JmillsExpensify JmillsExpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No product review required.

- Add derivedMovedFromReportName param to showReportActionNotification
- Look up report name by moved-from report ID instead of current report ID
- Fixes notification showing destination name instead of origin name
- Update tests to match new parameter signature
@hoangzinh
hoangzinh force-pushed the split/pr1b-remaining-narrowings-and-sweep branch from 5c32170 to 572ceff Compare September 2, 2026 14:06
Comment thread src/libs/actions/Report/index.ts Outdated
Comment thread src/libs/Notification/LocalNotification/index.ts Outdated
Comment thread src/libs/Notification/LocalNotification/types.ts Outdated
…ReportName

Extract reportName from reportAttributesDerived using lastActionReport.reportID
instead of passing the whole object. Remove unnecessary eslint-disable comment.
…eportName

More specific name for the moved-from report name passed through
the modified expense notification flow.
- Remove unused ReportAttributesDerivedValue import
- Reorder params so default param is last
- Replace ID default empty string with type assertion
…reportName

- Change reportName param from optional to string | undefined in getShareDestination
- Update test calls to pass explicit undefined for trailing argument
…nature changes

- Add explicit reportName: undefined to ModifiedExpenseMessage test fixtures
- Pass convertToDisplayString arg to getChatListItemReportName calls in ReportUtilsTest
- Add missing reportName property to getForReportAction call
- Fix indentation to satisfy oxfmt check
@DylanDylann

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 proper code patterns were followed (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 verified that this PR follows the guidelines as stated in the Review Guidelines
  • 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 and each prop has a /** comment above it */
    • The file is named correctly
    • 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
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • 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 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 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.
  • 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

Screen.Recording.2026-09-11.at.16.08.20.mov

Comment thread src/libs/ModifiedExpenseMessage.ts Outdated
currentUserAccountID: number | undefined;
currentUserLogin: string;
reportAttributes?: ReportAttributesDerivedValue['reports'];
reportName: string | undefined;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename getForReportAction({reportName}) → movedFromReportName

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated via aa3898a

@DylanDylann

Copy link
Copy Markdown
Contributor

@hoangzinh One NIT

getShareDestination now requires a reportName parameter.
Pass undefined for the 3 test call sites to fix typecheck.
Clarify intent of the parameter in getForReportAction — it
is only used for the "moved from" report message, not as a
general report name.
@hoangzinh
hoangzinh force-pushed the split/pr1b-remaining-narrowings-and-sweep branch from aa3898a to 9fc0fb0 Compare September 11, 2026 14:43
@hoangzinh

Copy link
Copy Markdown
Contributor Author

@DylanDylann this PR is ready for next review round

@melvin-bot
melvin-bot Bot requested a review from marcochavezf September 17, 2026 07:57
@marcochavezf
marcochavezf merged commit 3678d21 into Expensify:main Sep 17, 2026
35 of 37 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/marcochavezf in version: 9.4.82-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site changes are required for this PR, so I did not create a draft docs PR.

This is an internal refactor: it removes the deprecatedGetReportName wrapper and passes a single derived report name into getReportName instead of the whole ONYXKEYS.DERIVED.REPORT_ATTRIBUTES record. It's part of Remove Onyx.connect() for the key: ONYXKEYS.DERIVED.REPORT_ATTRIBUTES in src/libs/ReportUtils.ts.

Why no docs update

Help site articles in docs/articles document user-facing features, settings, and steps. This PR changes none of those:

  • No copy changes. No src/languages/*.ts file is touched, so no UI label, button, tab, or message text changed.
  • No behavior changes. Report names, browser notifications, Search in: chips, task share destinations, and invoice room names all render the same values — only the plumbing that supplies the name changed. The QA steps in the PR body are regression checks, not new behavior.
  • No new or removed features or settings. All 24 changed files are under src/libs, src/pages, and tests.

view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/marcochavezf in version: 9.4.86-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 No help site changes required — no draft PR created.

This PR is a mechanical internal refactor. It deletes the deprecatedGetReportName wrapper and migrates every call site to getReportName, changing what callers pass in (a single string | undefined name instead of the whole ReportAttributesDerivedValue['reports'] record). The name-computation logic itself is untouched, so nothing users see in the product changes.

Why nothing in docs/articles is affected

The change is a parameter-shape swap, not a behavior change. The removed wrapper was itself a one-line forward to getReportName, which still resolves names identically:

No user-facing copy moved. The diff touches 0 files under src/languages/ and adds no new translation keys. All 24 changed files are in src/libs, src/pages, or tests.

No feature, setting, tab, or button was added, removed, or renamed, so there is no UI label to verify against the live app and nothing for an article to describe differently. Chat and report names in the LHN, browser notifications, Search filter chips, task share destinations, and invoice rooms all render exactly as before — which is what this PR's own QA steps confirm.

Docs search came back empty. No article under docs/articles documents how a report's display name is resolved internally, and the diff touches 0 files under docs/. The naming articles that do exist — for example docs/articles/expensify-classic/reports/Set-Custom-Report-Names.md — cover Expensify Classic report title formulas, which this PR does not touch.

The linked issue confirms the intent. Remove Onyx.connect() for the key: ONYXKEYS.DERIVED.REPORT_ATTRIBUTES in src/libs/ReportUtils.ts is an Engineering / Improvement task to stop call sites subscribing to every report's attributes just to read one name. It is a re-render/performance cleanup with no documented user-facing behavior attached.

@hoangzinh — since no help site changes are required, I did not open a draft PR, so there is no linked help site PR to review or to mark Ready for review. If you expected a specific article to change here, reply with which one and what behavior you think shifted, and I'll take another look.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/marcochavezf in version: 9.4.89-0 🚀

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/luacmartins in version: 9.4.89-0 🚀

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

Bundle Size Analysis (Sentry):

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants