Skip to content

Filter time expenses from workspaces with disabled time tracking#84655

Merged
justinpersaud merged 5 commits intomainfrom
claude-filterTimeExpensesByTimeTrackingEnabled
Mar 13, 2026
Merged

Filter time expenses from workspaces with disabled time tracking#84655
justinpersaud merged 5 commits intomainfrom
claude-filterTimeExpensesByTimeTrackingEnabled

Conversation

@MelvinBot
Copy link
Contributor

@MelvinBot MelvinBot commented Mar 9, 2026

Explanation of Change

Time expenses can currently be submitted to workspaces that have time tracking disabled. This mirrors the existing per diem filtering pattern to prevent time expenses from being submitted to workspaces with disabled time tracking.

Scenario 1 (Report Selection): When selecting a report for a time expense, IOURequestEditReportCommon now checks isTimeTrackingEnabled(policy) and filters out reports from workspaces where time tracking is disabled.

Scenario 2 (Recipient/Participant Selection): When selecting a recipient/workspace for a time expense, OptionsListUtils and MoneyRequestParticipantsSelector now filter out workspaces without time tracking enabled and exclude P2P recipients (since time tracking is a workspace-level feature).

Fixed Issues

$ #81563
PROPOSAL: #81563 (comment)

Tests

Setup:

  1. Create two workspaces — A (time tracking enabled) and B (time tracking disabled)
  2. Create an empty report in workspace A and B

Scenario 1 — Multiple eligible workspaces (workspace selector):

  1. Make sure at least two workspaces have time tracking enabled (e.g., workspace A and another workspace C)
  2. Open FAB > Create expense > Time tab
  3. Verify a workspace list is shown (not the hours field) — only workspaces with time tracking enabled should appear
  4. Workspace B (time tracking disabled) should NOT appear in the list
  5. Select workspace A from the list
  6. Verify the hours field is shown — enter hours > Next
  7. On the confirmation page, verify the participant/To row is not interactive (tapping it does nothing — you cannot change the workspace)

Scenario 2 — Single eligible workspace (direct hours field):

  1. Ensure only one workspace has time tracking enabled (workspace A)
  2. Open FAB > Create expense > Time tab
  3. Verify the hours field is shown directly (no workspace selector)
  4. Enter hours > Next
  5. Verify you are taken directly to the confirmation page with workspace A auto-selected

Scenario 3 — Report selection filtering:

  1. From the confirmation page, tap the Report field (if editable)
  2. Verify that only reports from workspaces with time tracking enabled are shown
  3. Reports from workspace B should NOT appear

Scenario 4 — P2P excluded for time requests:

  1. Open FAB > Create expense > Time tab
  2. If workspace list is shown, select a workspace and enter hours. If hours field is shown directly, enter hours
  3. Verify that personal contacts do NOT appear in the participant selector (P2P is excluded for time requests)
  • Verify that no errors appear in the JS console

Offline tests

N/A — this change only affects client-side filtering of reports and participants. No network calls are involved in the filtering logic.

QA Steps

Scenario 1 — Multiple eligible workspaces:

  1. Log in with an account that has two workspaces with time tracking enabled and one with it disabled
  2. Open FAB > Create expense > Time tab
  3. Verify a workspace list is shown with only time-tracking-enabled workspaces
  4. Select a workspace, enter hours, proceed to confirmation
  5. Verify the participant/To section is NOT interactive on the confirmation page

Scenario 2 — Single eligible workspace:

  1. Log in with an account that has exactly one workspace with time tracking enabled
  2. Open FAB > Create expense > Time tab
  3. Verify the hours field is shown directly (no workspace selector)
  4. Enter hours > Next
  5. Verify you go directly to the confirmation page with the workspace auto-selected

Scenario 3 — Report filtering:

  1. From the confirmation page, tap the Report field (if editable)
  2. Verify only reports from time-tracking-enabled workspaces are shown
  • 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 shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • 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.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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

Mirrors the existing per diem filtering pattern to prevent time expenses
from being submitted to workspaces that have time tracking disabled.
This addresses both the report selection flow and the recipient/participant
selection flow.

Co-authored-by: Krishna <Krishna2323@users.noreply.github.com>
@MelvinBot MelvinBot requested a review from a team March 9, 2026 23:50
@MelvinBot
Copy link
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-filterTimeExpensesByTimeTrackingEnabled
git checkout -b claude-filterTimeExpensesByTimeTrackingEnabled upstream/claude-filterTimeExpensesByTimeTrackingEnabled
git push -u origin claude-filterTimeExpensesByTimeTrackingEnabled

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

Co-authored-by: Krishna <Krishna2323@users.noreply.github.com>
@MelvinBot
Copy link
Contributor Author

Fixed the failing Prettier check: ran Prettier on MoneyRequestParticipantsSelector.tsx which collapsed a multi-line ternary into a single line.

@MelvinBot
Copy link
Contributor Author

The failing check build (Debug, true) is unrelated to this PR's changes.

Analysis: The Rock remote build itself completed successfully and downloaded the cached APK. The failure occurs in the subsequent CI step that tries to locate the APK at $ANDROID_SOURCE_DIR/$APP_NAME/build/outputs — the APP_NAME env variable is empty, producing the invalid path /home/runner/_work/App/App/Mobile-Expensify/Android//build/outputs. This is a CI infrastructure issue with how the build artifact path is resolved after a remote cached build.

Evidence:

  • All 6 files changed in this PR are TypeScript/JS (src/libs/OptionsListUtils/index.ts, MoneyRequestParticipantsSelector.tsx, etc.) — no Android build config changes
  • The same build (Debug, true) check passed on a prior run of this branch (28m48s), confirming intermittent failure
  • All other build variants (developmentDebug, New Expensify Dev, Expensify Dev) passed on this same commit
  • Typecheck, ESLint, and all tests passed

Re-running the failed check should resolve this.

@MelvinBot
Copy link
Contributor Author

The failing checks are unrelated to this PR's changes.

ESLint check: All 339 warnings are in files not modified by this PR — WorkspaceTravelInvoicingExportPage.tsx, WorkspaceUpgradePage.tsx, WorkspaceWorkflowsApprovalsEditPage.tsx, and WorkspaceWorkflowsApprovalsExpensesFromPage.tsx. These are pre-existing react-hooks/set-state-in-effect and react-hooks/preserve-manual-memoization warnings on main.

build (Debug, true): The Android build failed because the APP_NAME environment variable was empty, causing the path /home/runner/_work/App/App/Mobile-Expensify/Android//build/outputs to not exist. This is a build infrastructure issue unrelated to the code changes in this PR.

Evidence: This PR only modifies files in src/libs/OptionsListUtils/ and src/pages/iou/request/ — none of which appear in either failure.

@codecov
Copy link

codecov bot commented Mar 10, 2026

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/hooks/usePolicyForMovingExpenses.ts 90.90% <100.00%> (+0.28%) ⬆️
...rc/pages/Search/SearchTransactionsChangeReport.tsx 0.00% <ø> (ø)
...es/iou/request/step/IOURequestEditReportCommon.tsx 88.40% <100.00%> (+0.34%) ⬆️
...rc/pages/iou/request/step/IOURequestStepReport.tsx 72.30% <100.00%> (+1.33%) ⬆️
...es/iou/request/step/IOURequestStepParticipants.tsx 0.00% <0.00%> (ø)
src/libs/OptionsListUtils/index.ts 81.77% <66.66%> (-0.07%) ⬇️
...s/iou/request/MoneyRequestParticipantsSelector.tsx 0.00% <0.00%> (ø)
... and 28 files with indirect coverage changes

@Krishna2323
Copy link
Contributor

@codex review

Copy link

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

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: af4ea06623

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

const isAndroidNative = getPlatform() === CONST.PLATFORM.ANDROID;
const isMobileSafari = isMobileSafariBrowser();
const isPerDiem = isPerDiemRequest(initialTransaction);
const isTime = isTimeRequestUtil(initialTransaction);

Choose a reason for hiding this comment

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

P2 Badge Enforce time-only filtering before transaction hydration

The new isTimeRequest flag is derived from initialTransaction, but this screen is still usable before that object is loaded (the handler explicitly falls back to initialTransactionID when transactions.length === 0). In that loading window isTime is false, so the participant list is built without the new time-request restrictions, which lets users on slow hydration paths pick personal contacts or workspaces with disabled time tracking before the filter turns on.

Useful? React with 👍 / 👎.

Copy link
Contributor

Choose a reason for hiding this comment

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

@MelvinBot please check this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I looked into this. The concern about a hydration race window is not a new issue introduced by this PR — it's a pre-existing architectural characteristic that applies equally to all transaction-derived flags.

Key findings:

  1. Identical pattern to isPerDiemRequest: The new isTime flag is derived from initialTransaction in exactly the same way as the existing isPerDiem and isCorporateCard flags (IOURequestStepParticipants.tsx:127-130). All three return false when initialTransaction is undefined.

  2. Pre-existing HOC behavior: withFullTransactionOrNotFound wraps this component with shouldShowLoadingIndicator = false (the default), meaning it renders immediately during Onyx loading. This affects ALL step screens using this HOC and ALL transaction-derived values — not just isTimeRequest.

  3. Practically unreachable: The transaction draft is written to Onyx via Onyx.set() in initMoneyRequest (with iouRequestType: TIME) before the first step of the expense flow. The user must navigate through the time entry screen(s) before reaching the participants screen, giving Onyx ample time to hydrate.

  4. Consistent with the codebase: The PR adds isTimeRequest alongside every existing isPerDiemRequest check — this is a straightforward "mirror the existing pattern" implementation.

If the hydration window were a real concern, it would need to be addressed as a separate issue for isPerDiemRequest, isCorporateCardTransaction, iouRequestType, and isWorkspacesOnly equally — not as a blocker for this PR specifically.

@MelvinBot
Copy link
Contributor Author

The failing checks are unrelated to this PR's changes.

1. ESLint check — The full ESLint check is failing due to pre-existing react-hooks/preserve-manual-memoization and react-hooks/set-state-in-effect warnings in files not modified by this PR:

  • src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx
  • src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsEditPage.tsx
  • src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsExpensesFromPage.tsx

None of these files are in this PR's diff. The Changed files ESLint check (which lints only PR files) passed. This same ESLint failure also reproduces on main.

2. build (Debug, true) — This is a CI infrastructure issue. The cached build was successfully downloaded from S3, but the subsequent step failed looking for the APK at a local path (Mobile-Expensify/Android//build/outputs) that doesn't exist when using cached builds. This is unrelated to any code change in this PR.

3. checklist — This is the PR Author/Reviewer Checklist check, which is not a code issue.

No code fix is needed from this PR's side.

@MelvinBot
Copy link
Contributor Author

The failing checks are unrelated to this PR's changes.

1. ESLint check — All 339 warnings are in files not modified by this PR:

  • src/pages/workspace/upgrade/WorkspaceUpgradePage.tsxreact-hooks/preserve-manual-memoization
  • src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsEditPage.tsxreact-hooks/set-state-in-effect
  • src/pages/workspace/workflows/approvals/WorkspaceWorkflowsApprovalsExpensesFromPage.tsxreact-hooks/set-state-in-effect

The Changed files ESLint check (which only lints files in this PR) passed successfully, confirming these are pre-existing warnings.

2. build (Debug, true) — CI infrastructure issue. The build downloaded a cached APK from S3 successfully, but the subsequent step failed with:

find: '/home/runner/_work/App/App/Mobile-Expensify/Android//build/outputs': No such file or directory

This is a build pipeline path resolution issue, not related to any code changes in this PR.

Evidence: This PR only modifies these files, none of which overlap with the failures:

  • src/libs/OptionsListUtils/index.ts
  • src/libs/OptionsListUtils/types.ts
  • src/pages/iou/request/MoneyRequestParticipantsSelector.tsx
  • src/pages/iou/request/step/IOURequestEditReportCommon.tsx
  • src/pages/iou/request/step/IOURequestStepParticipants.tsx
  • src/pages/iou/request/step/IOURequestStepReport.tsx

@MelvinBot
Copy link
Contributor Author

I have failed to help you. I let you down and for that I am sorry. Please try again later. This may be due to a Claude outage (check here).

Failure details: https://github.com/Expensify/Expensify/actions/runs/22996647905

@Krishna2323
Copy link
Contributor

@MelvinBot resolve conflicts and mark it as ready.

…nsesByTimeTrackingEnabled

Co-authored-by: Krishna <Krishna2323@users.noreply.github.com>

# Conflicts:
#	src/pages/iou/request/step/IOURequestEditReportCommon.tsx
@MelvinBot MelvinBot marked this pull request as ready for review March 13, 2026 12:27
@MelvinBot MelvinBot requested a review from a team as a code owner March 13, 2026 12:27
@melvin-bot melvin-bot bot requested review from Krishna2323 and removed request for a team March 13, 2026 12:27
@melvin-bot
Copy link

melvin-bot bot commented Mar 13, 2026

@Krishna2323 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 requested review from heyjennahay and removed request for a team March 13, 2026 12:27
@MelvinBot
Copy link
Contributor Author

Resolved merge conflicts and marked the PR as ready for review.

Conflict resolution: IOURequestEditReportCommon.tsx had two conflicts from main branch changes that added canSubmitPerDiemExpenseFromWorkspace for per diem filtering. Resolved by keeping both the new time tracking filter (isTimeTrackingEnabled) and the updated per diem filter (canSubmitPerDiemExpenseFromWorkspace).

Copy link

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

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: 7419245089

ℹ️ 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 on lines +134 to +136
if (isTimeRequest && !isTimeTrackingEnabled(policy)) {
return false;
}

Choose a reason for hiding this comment

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

P2 Badge Enforce time-tracking check on create-report path

This new filter only removes existing reports from the picker, but it does not guard the Create report path, which still gets its destination from usePolicyForMovingExpenses (that hook only validates per-diem constraints). In a time request flow where no valid report is selected yet (for example, moving an unreported/self-DM time expense), users can still create a new report in a workspace with time tracking disabled, so the restriction added here can be bypassed.

Useful? React with 👍 / 👎.

Copy link
Contributor

Choose a reason for hiding this comment

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

This also seems pre-existing issue, @MelvinBot could you please confirm?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one is not a pre-existing issue — it's a genuine gap in the PR, unlike the previous hydration concern.

Key difference from per diem: The usePolicyForMovingExpenses hook (src/hooks/usePolicyForMovingExpenses.ts:23-30) already guards the "Create report" path for per diem by checking canSubmitPerDiemExpenseFromWorkspace(policy). For time requests, no equivalent guard exists:

// Current check in isPolicyValidForMovingExpenses:
(!isPerDiemRequest || canSubmitPerDiemExpenseFromWorkspace(policy))
// No equivalent: (!isTimeRequest || isTimeTrackingEnabled(policy))

The hook is called at IOURequestStepReport.tsx:83 with only isPerDiemRequest(transaction) — no time request flag is passed. So for a time expense, the "Create report" button could point to a workspace with time tracking disabled.

To make this fully equivalent to per diem, usePolicyForMovingExpenses would need:

  1. An isTimeRequest parameter
  2. An (!isTimeRequest || isTimeTrackingEnabled(policy)) check in isPolicyValidForMovingExpenses
  3. The caller at IOURequestStepReport.tsx:83 would need to pass the time request flag

Copy link
Contributor

Choose a reason for hiding this comment

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

@MelvinBot fix that please

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 5cbf8e3. Added isTimeRequest parameter to usePolicyForMovingExpenses so the "Create report" path now filters out workspaces with time tracking disabled, mirroring the existing per diem guard.

Changes:

  • usePolicyForMovingExpenses now accepts isTimeRequest?: boolean and checks (!isTimeRequest || isTimeTrackingEnabled(policy)) in isPolicyValidForMovingExpenses and the active policy check
  • Updated callers in IOURequestStepReport, IOURequestEditReportCommon, and SearchTransactionsChangeReport to pass the new parameter

Add isTimeRequest parameter to usePolicyForMovingExpenses so the
Create report button filters out workspaces that have time tracking
disabled, mirroring the existing per diem guard.

Co-authored-by: Krishna <Krishna2323@users.noreply.github.com>
@MelvinBot MelvinBot requested a review from a team as a code owner March 13, 2026 13:33
@melvin-bot melvin-bot bot requested review from justinpersaud and removed request for a team March 13, 2026 13:33
@melvin-bot
Copy link

melvin-bot bot commented Mar 13, 2026

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

Co-authored-by: Krishna <Krishna2323@users.noreply.github.com>
@MelvinBot
Copy link
Contributor Author

Fixed the failing Prettier check: reformatted a long line in IOURequestStepReport.tsx (the usePolicyForMovingExpenses call arguments are now split across multiple lines).

@MelvinBot
Copy link
Contributor Author

The failing Prettier check is unrelated to this PR's code changes — it's a transient GitHub Actions infrastructure failure.

Analysis: The CI runner failed during the git fetch step with a TLS/network error:

error: RPC failed; curl 56 GnuTLS recv error (-24): Decryption has failed.
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

It retried 3 times and failed each time. Prettier never actually ran — the failure occurred before the code was even checked out.

Evidence: The error is in the Checkout step, not in any prettier formatting step. No files from this PR are involved.

Next step: Please re-run the failed Prettier check. This should resolve on retry since it's a transient network issue.

@Krishna2323
Copy link
Contributor

Krishna2323 commented Mar 13, 2026

@MelvinBot prettier is still failing (fix if related) and could you also update the test steps? The flow has changed a bit:

  1. Now we show workspace list on the time tab instead of hours field
  2. If there's only one eligible workspace, we directly show hours field
  3. We can't change workspace from the confirmation page

Please verify this and update.

@MelvinBot
Copy link
Contributor Author

Here's what I found and did:

Prettier: The prettier fix was already committed (ee67899). The most recent prettier CI failure was a GitHub infrastructure issue (RPC connection error during git checkout), not an actual code formatting problem. The checks should pass on a re-run.

Test steps updated. I verified the flow by tracing the code and updated the PR description with accurate test steps covering:

  1. Multiple eligible workspaces — workspace selector is shown on the Time tab when isFromGlobalCreate && policiesWithTimeEnabled.length > 1 (IOURequestStartPage.tsx:389). After selecting a workspace, the hours field is shown.
  2. Single eligible workspace — hours field is shown directly with explicitPolicyID set to the single eligible workspace (IOURequestStartPage.tsx:398). After entering hours, the workspace is auto-selected and the user goes directly to confirmation.
  3. Confirmation page — the participant/To row is NOT interactive for time requests (MoneyRequestConfirmationList.tsx:345: isFromGlobalCreateAndCanEditParticipant excludes isTimeRequest). Note: the Report field may still be editable if there are multiple outstanding reports, but the report selection list filters by isTimeTrackingEnabled (IOURequestEditReportCommon.tsx:134).
  4. P2P exclusion — personal contacts are excluded from the participant selector for time requests.

@MelvinBot
Copy link
Contributor Author

I analyzed the two failing checks on this PR. Both are unrelated to the PR's code changes.

1. Prettier check — Infrastructure failure (not code-related)

The Prettier check failed during git checkout due to a GitHub Actions network error:

error: RPC failed; curl 56 GnuTLS recv error (-24): Decryption has failed.
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

This is a transient GitHub infrastructure issue. The check never reached the actual Prettier formatting step.

2. test (job 6) — Flaky test in NewChatPageTest.tsx (not caused by this PR)

The failing test (should not display "Add to group" button on expensify emails) was introduced in PR #83380 and fails for bills@expensify.com and chronos@expensify.com at line 112 of tests/ui/NewChatPageTest.tsx.

Why this is NOT caused by the PR changes:

  • The isTimeRequest parameter added to OptionsListUtils defaults to false
  • NewChatPage never passes isTimeRequest to any OptionsListUtils function
  • The new filtering code (isTimeRequest && isPolicyExpenseChat && !isTimeTrackingEnabled(policy)) is double-gated and never activates for NewChatPage
  • The test only creates personal details (not reports), so the report-level filtering cannot apply

Likely cause: The test has tight timing margins — it relies on a 300ms animation transition + 300ms search debounce before options appear, with waitFor's default 1000ms timeout leaving only ~400ms margin. This same test passes on other recent PRs (#85231, #85225).

Recommendation: Re-run the failing checks. Both failures should resolve on retry.

@Krishna2323
Copy link
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
    • MacOS: Desktop
  • 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 there are no new alerts related to the canBeMissing param for useOnyx
  • 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 shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • 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.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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_native.mp4
Android: mWeb Chrome
android_chrome.mp4
iOS: HybridApp
ios_native.mp4
iOS: mWeb Safari
ios_safari.mp4
MacOS: Chrome / Safari
web_chrome.mp4

Copy link
Contributor

@Krishna2323 Krishna2323 left a comment

Choose a reason for hiding this comment

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

LGTM and works well! 🚀

@justinpersaud please re-run the tests, it should pass.

@justinpersaud justinpersaud merged commit 6e6eeb2 into main Mar 13, 2026
47 of 49 checks passed
@justinpersaud justinpersaud deleted the claude-filterTimeExpensesByTimeTrackingEnabled branch March 13, 2026 17:07
@github-actions
Copy link
Contributor

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

@OSBotify
Copy link
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.

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.

4 participants