Skip to content

Align distance rates toggle switches with the page's right inset - #100143

Merged
Gonals merged 4 commits into
mainfrom
claude-distanceRatesToggleAlignment
Sep 4, 2026
Merged

Gonals merged 4 commits into
mainfrom
claude-distanceRatesToggleAlignment

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Minor style change

Fixed Issues

$ #99925
PROPOSAL: #99925 (comment)

Tests

  • Go to workspace settings > Distance rates.
  • Click Settings.
  • Confirm the two setting toggles are properly aligned:
Screenshot 2026-09-02 at 12 30 37
  • Verify that no errors appear in the JS console

Offline tests

None

QA Steps

Same as tests

  • 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

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

Remove styles.mr2 from the hand-rolled 'Auto-update government rate' and
'Track tax' switch rows so all three toggles on the Distance rates Settings
page sit at the same 20px right inset as the ToggleSettingOptionRow switch
and the menu item chevrons above them.

Co-authored-by: Alberto Gonzalez-Cela <Gonals@users.noreply.github.com>
@MelvinBot

MelvinBot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor Author

The failing check is unrelated to this PR, so I did not push a fix.

Analysis: test (job 3) fails on tests/unit/NextStepUtilsTest.ts › monthly on the 2nd. That test breaks on the 2nd of every month regardless of the diff — it's already tracked in #100134, filed today from another PR hitting the same wall. This PR touches one file, src/pages/workspace/distanceRates/PolicyDistanceRatesSettingsPage.tsx, and removes two styles.mr2 entries. It imports nothing from NextStepUtils and no NextStepUtils code path reads that page.

The only other failing check, Check independent approval, needs a human reviewer — nothing to fix in code.

Why the test fails today

The test derives its expected value from a different helper than production uses, and the two disagree about whether "the next Nth of the month" includes today:

They only diverge when today === nth, which is why this surfaces exactly one day per month. getNextNthOfMonth has no other caller in src/ — the test is its only consumer.

Per Expensify's flaky-test policy I'm leaving NextStepUtilsTest.ts alone rather than patching an unrelated file into this cosmetic PR. Two ways forward:

Tell me which and I'll do it — I can take #100134 as a separate PR if you want it closed out before the next 2nd.


view run · view recording

@MelvinBot

MelvinBot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor Author

I pushed the fix — but to a separate PR, #100145, not to this branch.

test (job 3) fails on tests/unit/NextStepUtilsTest.ts › monthly on the 2nd, which breaks on the 2nd of every month regardless of the diff. This PR changes one file, a styles-only edit to PolicyDistanceRatesSettingsPage.tsx, so patching an unrelated test file into it would be the wrong place for the fix. #100145 fixes it at its proper scope, against the tracking issue #100134.

Once #100145 merges, merge main into this branch and the check goes green. If you'd rather not wait, test (job 3) also passes on its own from 2026-09-03 onward.

What was wrong, and what #100145 changes

The test derived its expected value from a different helper than production uses, and the two disagreed about whether "the next Nth of the month" includes today:

They only diverge when today === nth, which is why it surfaced exactly one day per month.

The fix does three things: pins the clock in the test with jest.setSystemTime across three cases (before, on, and after the offset day, so the on-the-day case runs on every build instead of monthly); changes isPast(etaDateTime) to isPast(endOfDay(etaDateTime)) so the offset day stops being a sub-millisecond race against the current time of day; and removes getNextNthOfMonth, whose only caller in the whole repo was that one test.

Local checks on that branch all pass — NextStepUtilsTest (48 tests) and DateUtilsTest (93 tests), plus typecheck, lint-changed, spell-changed, fmt, and knip. The test run happened today, 2026-09-02, the exact day the old test fails.

The only other failing check here, Check independent approval, needs a human reviewer — there's nothing to fix in code.


view run · view recording

@MelvinBot

MelvinBot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Nothing new to fix here — the fix is already written and green, and it's now waiting on you.

test (job 3) still fails on tests/unit/NextStepUtilsTest.ts › monthly on the 2nd, the same date-dependent test I described in my earlier comment. It has nothing to do with this PR's one-file styles change. The fix lives in #100145, where test (job 3) passes — proof on today's date, the exact day the old test breaks. All 34 checks on that PR are green.

The chain is blocked on a human, not on code:

  1. Mark [No QA] Make the monthly automatic-submit eta deterministic on the offset day #100145 ready for review (it's a draft, assigned to you, no reviews yet).
  2. Review and merge it. main is at 3a621ed and does not have it yet.
  3. Merge main into this branch and test (job 3) goes green here.

If you'd rather not wait, this check also passes on its own from 2026-09-03 onward — the failure is confined to the 2nd of the month.

I'm deliberately not pushing the test fix into this branch. It touches NextStepUtils.ts, DateUtils.ts, and NextStepUtilsTest.ts, none of which this cosmetic PR should be carrying. If you'd rather take the shortcut anyway, say so and I'll merge claude-nextStepMonthlyEtaFlakyTest into this branch.

Check independent approval is the only other failure and needs a reviewer — nothing to fix in code.


view run · view recording

@Expensify Expensify deleted a comment from MelvinBot Sep 2, 2026
@Expensify Expensify deleted a comment from MelvinBot Sep 2, 2026
@Gonals
Gonals marked this pull request as ready for review September 2, 2026 11:55
@Gonals
Gonals requested a review from a team as a code owner September 2, 2026 11:55
@melvin-bot
melvin-bot Bot requested review from flaviadefaria and huult and removed request for a team and flaviadefaria September 2, 2026 11:55
@melvin-bot

melvin-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

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

@Gonals

Gonals commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Test error unrelated

@Gonals
Gonals requested a review from a team as a code owner September 2, 2026 12:29
@melvin-bot
melvin-bot Bot requested review from Gonals and lakchote and removed request for a team September 2, 2026 12:29
@melvin-bot

melvin-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

@Gonals @lakchote One of you needs to 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]

@MelvinBot

MelvinBot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Nothing to push here — but one thing from your last comment needs correcting.

test (job 3) fails on the same date-dependent test I described earlier: tests/unit/NextStepUtilsTest.ts › monthly on the 2nd. Unrelated to this PR's one-file styles change, and it stops failing on its own from 2026-09-03. You already called this correctly at "Test error unrelated", so there's no code change for me to make on this branch. Check independent approval is the only other red check and needs a reviewer.

The correction: you closed #100145 with "already fixed in a different PR" — it isn't. main still carries the original test: tests/unit/NextStepUtilsTest.ts:290 still derives its expectation from DateUtils.getNextNthOfMonth(2), and the file's last commit on main is dabe355c from 2026-08-27. No open PR touches it either. #100134 is still open and unfixed, so this will block every PR again on 2026-10-02.

If closing #100145 was based on that misreading, say the word and I'll reopen it — at the point you closed it, it was test-only (NextStepUtils.ts byte-identical to main), green on all checks, and the getNextNthOfMonth deletion you asked about was safe because that test was its only caller in the repo. If you closed it because you'd rather someone else own the fix, that's fine too — just leaving #100134 open and visible.


view run · view recording

@MelvinBot

MelvinBot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Nothing has changed since my last comment 3 minutes ago, so there's still nothing for me to push.

The re-run at 12:30 UTC failed on the same date-dependent test, tests/unit/NextStepUtilsTest.ts › monthly on the 2nd, with the same 2026-10-02 vs 2026-09-02 mismatch. main (d693503e) still carries the original test — its last commit there is dabe355c from 2026-08-27. #100145 is still closed. You already agreed this is unrelated, and it is: this PR is a one-file styles change.

Re-triggering me won't move this. There is no commit I can make to this branch that turns test (job 3) green — the fix has to land on main, and the only branch that had it is closed. The check clears on its own from 2026-09-03.

One decision, whenever you get to it: reopen #100145 (or say the word and I will), or leave #100134 open for someone else to own. Either is fine — but if neither happens, this blocks every open PR again on 2026-10-02.

Check independent approval is the only other red check and needs a reviewer.


view run · view recording

@huult

huult commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@Gonals could you sync with main?

@huult

huult commented Sep 3, 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 proper code patterns were followed (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 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
    • 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 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

Android: HybridApp Screenshot 2026-09-03 at 16 05 25
Android: mWeb Chrome Screenshot 2026-09-03 at 16 02 49
iOS: HybridApp Screenshot 2026-09-03 at 16 07 40
iOS: mWeb Safari Screenshot 2026-09-03 at 16 08 54
MacOS: Chrome / Safari Screenshot 2026-09-03 at 15 57 40

@huult huult 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.

LGTM.

…oggleAlignment

Co-authored-by: Alberto Gonzalez-Cela <Gonals@users.noreply.github.com>
@codecov

codecov Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
.../distanceRates/PolicyDistanceRatesSettingsPage.tsx 0.00% <0.00%> (ø)
... and 12 files with indirect coverage changes

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The failing check was unrelated to this PR, and it's now fixed — I merged main in and all checks pass.

What was failing: test (job 3) → NextStepUtilsTest.ts › monthly on the 2nd. It expected 2026-10-02 but got 2026-09-02.

Why: that test was date-dependent and failed on the 2nd of the month. It derived its expected value from a different helper than production uses, and the two disagreed about whether "the next Nth of the month" includes today. CI happened to run on 2026-09-02. This PR only removes styles.mr2 from two Views in PolicyDistanceRatesSettingsPage.tsx — nothing to do with next-step ETAs.

The fix: this was already tracked and fixed on main in #100134. The branch was 219 commits behind, so it never picked the fix up. I merged main (cbc927f) — the test now freezes the clock with jest.setSystemTime and is deterministic. test (job 3) passes, and every other check is green.

The only remaining red check is Check independent approval, which is a review-process gate, not a code failure.

Root cause detail
  • Production — src/libs/NextStepUtils.ts:212-215 — builds setDate(new Date(), autoReportingOffset) and only rolls forward a month when isPast(etaDateTime). On the 2nd, setDate(now, 2) is today at the current time of day, so it returned today.
  • The old test expectation used DateUtils.getNextNthOfMonth(2), whose day < nth check excludes today, so it returned next month.

The two only diverge when today === nth, which is why it surfaced exactly one day per month.


One thing I could not do: I tried to re-verify your test steps on web, since merging 219 commits could in principle disturb the layout. The browser session broke before I got anywhere — the dev server restarted mid-run and left the tab blank, so I never reached the Distance rates page. That's a test-harness failure, not a signal about this PR; the toggle alignment is unverified by me, so please eyeball it once before merging.


view run

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ✅ pass

On dev NewDot web, Workspace Settings > Distance rates > Settings opens correctly, and the two custom toggle rows ("Auto-update government rates" and "Track tax") have their right edges pixel-aligned with each other and with the third toggle row ("Require GPS or map entry"), matching the page's right inset.

Zoomed crop of the three toggle rows showing aligned right edges

Step Status
Navigate to workspace settings > Distance ratesDistance rates page loaded showing 'Default Rate' ($0.76/mile) with Add rate and Settings buttons in the header.
Workspace Distance rates list page
✅
Click Settings on the Distance rates pageClicking the Settings button opened the right-hand Settings panel showing Unit (Miles), Default category (Car), Auto-update government rates toggle, Require GPS or map entry toggle, and Track tax toggle.
Distance rates Settings panel
✅
The two setting toggles are properly aligned - right edges line up with the page's right inset and with each otherPixel analysis of the screenshot found the right edge of the 'Auto-update government rates' toggle, the 'Require GPS or map entry' toggle, and the 'Track tax' toggle all fall at the same x=1259 (viewport width 1280), i.e. a consistent ~21px right inset for all three toggle rows. This confirms the fix in PolicyDistanceRatesSettingsPage.tsx (removal of the stray styles.mr2 from the two custom toggle row Views for 'Auto-update government rates' and 'Track tax') produces alignment consistent with the third toggle row that uses the shared ToggleSettingOptionRow component.
Zoomed crop of the three toggle rows showing aligned right edges
✅

This closes the gap I flagged earlier — the alignment is now verified. No new code changes were needed: the NextStepUtilsTest failure was already fixed by the main merge (cbc927f) in my previous run, and every check is green except Check independent approval, which is a review gate rather than a code failure.


view run

@lakchote lakchote 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.

LGTM

@Gonals
Gonals merged commit 0584b57 into main Sep 4, 2026
42 of 43 checks passed
@Gonals
Gonals deleted the claude-distanceRatesToggleAlignment branch September 4, 2026 12:14
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

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

@OSBotify

OSBotify commented Sep 4, 2026

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.

@OSBotify

OSBotify commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/Gonals in version: 9.4.73-0 🚀

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

@MelvinBot

MelvinBot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor Author

No help site changes are required for this PR, so I didn't create a docs PR.

This PR removes styles.mr2 from two toggle rows in src/pages/workspace/distanceRates/PolicyDistanceRatesSettingsPage.tsx so the Automatically update rate and Track tax switches line up with the page's right inset. It is purely visual spacing — no setting was added, removed, renamed, or moved, and no behavior changed.

What I checked

The full diff is 2 additions and 2 deletions, both dropping styles.mr2 from a flexRow wrapper:

  • Line 219 — the Automatically update rate toggle row
  • Line 280 — the Track tax toggle row

I reviewed the help site articles that document this page:

Per HELP_AUTHORING_GUIDELINES.md, articles document steps, labels, and outcomes — not pixel spacing or component layout. Nothing in these articles describes the alignment this PR changes, so every existing step remains accurate.

@Gonals, no help site PR was needed here — please confirm you agree that this change is visual-only and doesn't affect any documented step. If you think an article should be updated anyway, reply with what you'd like changed and I'll open the draft PR.


view run · view recording

@OSBotify

OSBotify commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 9.4.73-3 🚀

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.

5 participants