Skip to content

Show nights and nightly rate under Category for multi-night reservation expenses - #104310

Draft
MelvinBot wants to merge 3 commits into
mainfrom
claude-reservationNightlyRateHint-thelullabyy
Draft

MelvinBot wants to merge 3 commits into
mainfrom
claude-reservationNightlyRateHint-thelullabyy

Conversation

@MelvinBot

Copy link
Copy Markdown
Contributor

Explanation of Change

When SmartScan finds hotel reservation dates on a receipt, category and workspace limits are checked against the per-night average instead of the total. Nothing in the expense view explained this, so a $2,800 hotel stay with a $500 category limit showed no violation and no reason why.

This PR adds a muted hint under the Category row of the expense view, for example 3 nights • $233.33 per night.

  • MoneyRequestView calls the same getReservationNights helper that the limit check in ViolationsUtils uses, so the hint and the limit always agree on the night count. The nightly rate is the displayed amount divided by the nights, formatted with convertToDisplayString. This follows the existing per-attendee amount pattern.
  • The hint renders as a non-error MenuItem.HelpText after any category error, the same way the Distance row shows its hint.
  • Single-night stays and expenses without reservation dates return 0 or 1 night, so they show nothing.
  • Adds one pluralized key, common.reservationNightsWithNightlyRate({count, nightlyRate}), in all 11 locales. The whole phrase is one key so each language can set its own word order (Japanese and Chinese put the amount after "per night"). Polish uses one, few, and many forms.
  • Adds UI tests in MoneyRequestViewTest.tsx: a 3-night stay shows the hint, and a 1-night stay doesn't.

AI Tests (run by MelvinBot on this branch):

  • npm run typecheck: passed
  • npm run lint on changed files: passed
  • oxfmt (npm run fmt): no changes
  • npm run spell-changed: 0 issues
  • npm run react-compiler-compliance-check check src/components/ReportActionItem/MoneyRequestView.tsx: passed
  • npm test -- tests/ui/MoneyRequestViewTest.tsx: 35 of 35 passed, including the 2 new tests
  • Not run: the full npm test suite and the Storybook smoke test. CI covers them.
  • Browser test: not completed. The automated web session loaded a blank page, and the browser tester can't inject reservation dates. Manual testing is needed.

To test in dev, open a workspace expense that has a category, then run this in the browser console and confirm the hint appears under Category:
Onyx.merge('transactions_<transactionID>', {receipt: {hotelReservationStartDate: '2026-10-01', hotelReservationEndDate: '2026-10-04'}})
Change the end date to 2026-10-02 and confirm the hint disappears.

Fixed Issues

$ #102558
PROPOSAL: #102558 (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: These must be filled out, or the issue title must include "[No QA]."
// 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 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 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 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.
  • 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).
  • 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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

@MelvinBot
MelvinBot requested a review from a team October 18, 2026 10:50
@melvin-bot melvin-bot Bot added Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web labels Oct 18, 2026
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I created this PR from an upstream branch since I don't have push access to your fork.

To take ownership of this branch and be able to push updates, run:

git remote add upstream https://github.com/Expensify/App.git
git fetch upstream claude-reservationNightlyRateHint-thelullabyy
git checkout -b claude-reservationNightlyRateHint-thelullabyy upstream/claude-reservationNightlyRateHint-thelullabyy
git push -u origin claude-reservationNightlyRateHint-thelullabyy

Then you can close this PR and open a new one from your fork.

@OSBotify

Copy link
Copy Markdown
Contributor

🦜 Polyglot Parrot! 🦜

Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues:

View the translation diff
diff --git a/src/languages/el.ts b/src/languages/el.ts
index 02768e9a..5688e78f 100644
--- a/src/languages/el.ts
+++ b/src/languages/el.ts
@@ -144,7 +144,7 @@ const translations: TranslationDeepObject<typeof en> = {
         perPerson: 'ανά άτομο',
         reservationNightsWithNightlyRate: ({count, nightlyRate}: {count: number; nightlyRate: string}) => ({
             one: `1 διανυκτέρευση • ${nightlyRate} ανά διανυκτέρευση`,
-            other: `${count} διανυκτερεύσεις • ${nightlyRate} ανά διανυκτέρευση`,
+            other: `${count} νύχτες • ${nightlyRate} ανά νύχτα`,
         }),
         phone: 'Τηλέφωνο',
         phoneNumber: 'Αριθμός τηλεφώνου',
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index 350acfc3..0e2e7035 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -140,7 +140,7 @@ const translations: TranslationDeepObject<typeof en> = {
         addCardTermsOfService: 'Conditions d’utilisation d’Expensify',
         perPerson: 'par personne',
         reservationNightsWithNightlyRate: ({count, nightlyRate}: {count: number; nightlyRate: string}) => ({
-            one: `${count} nuit • ${nightlyRate} par nuit`,
+            one: `1 nuit • ${nightlyRate} par nuit`,
             other: `${count} nuits • ${nightlyRate} par nuit`,
         }),
         phone: 'Téléphone',
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index f59993e8..ae410a8b 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -140,8 +140,8 @@ const translations: TranslationDeepObject<typeof en> = {
         addCardTermsOfService: 'Expensify 利用規約',
         perPerson: '1人あたり',
         reservationNightsWithNightlyRate: ({count, nightlyRate}: {count: number; nightlyRate: string}) => ({
-            one: `1 泊 • 1泊あたり ${nightlyRate}`,
-            other: `${count} 泊 • 1泊あたり ${nightlyRate}`,
+            one: `1泊 • 1泊あたり${nightlyRate}`,
+            other: `${count}泊・1泊あたり${nightlyRate}`,
         }),
         phone: '電話',
         phoneNumber: '電話番号',
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index f51a2345..9c619fe8 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -145,8 +145,6 @@ const translations: TranslationDeepObject<typeof en> = {
         perPerson: 'na osobę',
         reservationNightsWithNightlyRate: ({count, nightlyRate}: {count: number; nightlyRate: string}) => ({
             one: `1 noc • ${nightlyRate} za noc`,
-            few: `${count} noce • ${nightlyRate} za noc`,
-            many: `${count} nocy • ${nightlyRate} za noc`,
             other: `${count} nocy • ${nightlyRate} za noc`,
         }),
         phone: 'Telefon',
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index 45469451..b65a2e0c 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -140,7 +140,7 @@ const translations: TranslationDeepObject<typeof en> = {
         addCardTermsOfService: 'Termos de Serviço da Expensify',
         perPerson: 'por pessoa',
         reservationNightsWithNightlyRate: ({count, nightlyRate}: {count: number; nightlyRate: string}) => ({
-            one: `${count} noite • ${nightlyRate} por noite`,
+            one: `1 noite • ${nightlyRate} por noite`,
             other: `${count} noites • ${nightlyRate} por noite`,
         }),
         phone: 'Telefone',

Note

You can apply these changes to your branch by copying the patch to your clipboard, then running pbpaste | git apply 😉

View workflow run

@MelvinBot

MelvinBot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Android test steps verification results: ⚠️ partial

Step 1 passed: a workspace expense with a category shows the Category row. Steps 2 and 3 were not tested. The app froze before the tester could add the reservation dates, so these results say nothing about whether the hint works. Rerun these steps in a fresh session.
Expense More menu that stopped responding

Step Status
1. Open a workspace expense with a category. The expense view shows the Category row.Created a workspace with categories on, then a $300.00 cash expense, "Test Hotel", with category "Car". The expense view shows "Category / Car" with no hint under it, as expected before adding dates.
Expense view showing the Category row (Car) with no reservation hint
✅
2. Set reservation dates 2026-10-01 to 2026-10-04. "3 nights • $100.00 per night" appears under Category.Blocked, not tested. Android has no JS console, so the tester turned on in-app Debug mode to edit the transaction's receipt JSON. The expense's More menu then stopped responding to taps, swipes, and Back, even after a Metro restart. No reservation dates were set.
Troubleshoot page with Debug mode onExpense More menu that stopped responding
❌
3. Change the end date to 2026-10-02 (1 night). The hint disappears.Blocked, not tested. The same freeze stopped this step.
❌

view run · view recording

@MelvinBot

MelvinBot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ⚠️ partial

Step 1 passed: a workspace expense with a category shows the Category row with no hint. Steps 2 and 3 were not tested. The automated tester can't run JS in the page, so it couldn't add the reservation dates. These results say nothing about whether the hint works, so a person needs to run the Onyx.merge steps by hand.
Expense view Category row (Advertising) with no hint beneath it

Step Status
1. Open a workspace expense with a category. The Category row shows no hint.Created a $100.00 expense, merchant "Test Hotel", with category "Advertising", on a workspace with categories on. The expense view shows "Category / Advertising" with no hint under it.
Expense view Category row (Advertising) with no hint beneath it
✅
2. Run Onyx.merge with reservation dates 2026-10-01 to 2026-10-04. "3 nights • $33.33 per night" appears under Category.Blocked, not tested. The tester has no access to the browser console. The in-app Debug mode transaction editor has no receipt field, and its JSON view is read-only. A scanned receipt would need a file upload, which the tester also can't do. No reservation dates were set.
❌
3. Change the end date to 2026-10-02 (1 night). The hint disappears.Blocked, not tested. This step depends on step 2.
❌

view run · view recording

This branch has not been deployed

No deployments
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.

3 participants