Skip to content

[Commuter Exclusion] Allow editing historical distance expenses - #98368

Draft
fedirjh wants to merge 2 commits into
Expensify:mainfrom
fedirjh:fix/98223-edit-existing-distance
Draft

[Commuter Exclusion] Allow editing historical distance expenses#98368
fedirjh wants to merge 2 commits into
Expensify:mainfrom
fedirjh:fix/98223-edit-existing-distance

Conversation

@fedirjh

@fedirjh fedirjh commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Manual and odometer distance expenses created before commuter exclusions were enabled were blocked from being edited because the guard only checked the workspace's current settings. This change lets existing distance expenses bypass that creation guard.

Commuter exclusions are still not applied retroactively: transaction recalculation only updates exclusion data when the expense already has an applied exclusion. Creating a new manual or odometer expense in a workspace with commuter exclusions remains blocked.

Fixed Issues

$ #98223
PROPOSAL: #98223 (comment)

Tests

  1. Create a manual distance expense in a workspace without commuter exclusions.
  2. Enable "Exclude a fixed distance per claim" in the workspace's distance settings.
  3. Open the existing expense, edit its distance, and save it.
  4. Verify the distance is updated without showing the map/GPS-required modal.
  5. Verify no commuter exclusion is applied to the edited expense.
  6. Start creating a new manual distance expense in the same workspace.
  7. Verify the map/GPS-required modal still blocks the unsupported new expense.
  8. Repeat steps 1–7 with an odometer distance expense.

Automated validation:

  • bun test -- --runInBand --watchman=false tests/unit/hooks/useCommuterExclusionGuard.test.ts tests/unit/TransactionUtilsTest.ts

  • bun x eslint on all changed files

  • bun run react-compiler-compliance-check check-changed

  • Verify that no errors appear in the JS console

Offline tests

  1. Disconnect from the network.
  2. Edit a manual or odometer distance expense created before commuter exclusions were enabled.
  3. Verify the edit is allowed and the updated distance is shown optimistically without a commuter exclusion.
  4. Reconnect and verify the expense remains updated.

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 tests section
    • I added steps for Staging and/or Production testing in the QA Steps section
    • I added steps to cover failure scenarios
    • I turned off my network connection and tested it while offline
    • I tested this PR with a High Traffic account against the staging or production API
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms and verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors
  • I followed proper code patterns
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments explain why
    • I verified any added copy is grammatically correct and approved where necessary
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the Review Guidelines
  • I tested other components that can be impacted by these changes
  • If a new CSS style is added, I verified an existing style or StyleUtils function cannot be used
  • If assets were modified, I verified they are optimized and load correctly
  • If message editing or sending code was modified, I tested supported markdown behavior
  • If a generic component was modified, I verified its other usages
  • If a component has Storybook stories, I verified they still work
  • If a modified page supports a direct deeplink, I verified logged-in and logged-out behavior
  • If UI or form styles were modified, I verified form alignment and requested Design review where needed
  • I added unit tests for this bug fix
  • If main was merged after review, I retested the expected behavior

Screenshots/Videos

Android: Native

Not tested yet.

Android: mWeb Chrome

Not tested yet.

iOS: Native

Not tested yet.

iOS: mWeb Safari

Not tested yet.

MacOS: Chrome / Safari

Not tested yet.

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.

1 participant