Skip to content

[Refactor] Move PolicyUtils rules, feature, workflow, and error helpers into rules.ts, features.ts, workflows.ts, and errors.ts - #103958

Merged
blimpich merged 5 commits into
mainfrom
claude-splitPolicyUtilsRulesFeaturesWorkflowsErrors
Oct 14, 2026
Merged

blimpich merged 5 commits into
mainfrom
claude-splitPolicyUtilsRulesFeaturesWorkflowsErrors

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Phase 6 of the PolicyUtils split. It keeps PolicyUtils/index.ts well under the 4000-line ESLint limit, so the file stops breaking the build. index.ts drops from 1992 to 1568 lines.

This is a pure move. Nothing is renamed, no signature changes, and behavior is the same. Callers stay on @libs/PolicyUtils.

  • rules.ts (leaf): custom categories, max expense amounts, hasConfiguredRules, getTagApproverRule, and the rules document URL.
  • features.ts: isPolicyFeatureEnabled and the checks it calls, plus getDefaultTimeTrackingRate. It imports from ./policyType and ./connections.
  • workflows.ts (leaf): instant and delayed submit, the corrected auto-reporting frequency, Submit & Close, and Dynamic External Workflow.
  • errors.ts: policy error flags, the brick-road status, the two selector wrappers, and the settings error and pending helpers. It imports from ./permissions and ./connections. shouldShowPolicyErrorFields stays private.
  • None of the four imports another or the barrel.
  • index.ts re-exports all four with export *, like the earlier phases. It imports getTagApproverRule, isTimeTrackingEnabled, and isSubmitAndClose for its own remaining callers.
  • Seatbelt: the 2 grandfathered no-unsafe-type-assertion casts moved with their functions, one to errors.ts (shouldShowSyncError) and one to rules.ts (hasConfiguredRules). The index.ts row goes from 2 to 0 and is removed.
  • Two tests spread jest.requireActual('@libs/PolicyUtils') while PolicyUtils is still loading inside an import cycle. At that point the export * helpers aren't on the module yet, so isInstantSubmitEnabled, isSubmitAndClose, and hasDynamicExternalWorkflow came through as undefined. Those mocks in SplitReportTotalsTest and ReportSecondaryActionUtilsTest now also spread @libs/PolicyUtils/workflows, the same fix used in earlier phases. App code is not affected, because imports read the barrel's live bindings at call time.

AI tests run locally

  • npm run lint-changed: passed
  • npm run typecheck: passed
  • npm run fmt (oxfmt): no changes
  • npm run spell-changed: passed
  • Jest: all 23 suites that spread the actual @libs/PolicyUtils in a mock passed. So did PolicyUtilsTest, GettingStartedSectionTest, SearchUIUtilsTest, PolicyTest, TransactionUtilsTest, ViolationUtilsTest, OptionsListUtilsTest, ReportActionsUtilsTest, and TimeExpenseConfirmationTest. The full npm test run doesn't finish within the local time limit, so CI is the full-suite signal.

Fixed Issues

$ #102675
PROPOSAL: #102675 (comment)

Tests

  • Workflows (submit frequency and Submit & Close)
  1. Go to Workspace > Workflows.
  2. Turn on Delay submissions and set the frequency to Weekly. Check that the row shows "Weekly".
  3. Change the frequency to Manually. Check that the row shows "Manually".
  4. Turn off Delay submissions.
  5. Turn on Add approvals and set yourself as the approver.
  6. Create an expense in the workspace chat and submit the report. Check that it goes to you for approval
  7. Turn off Add approvals. This switches the workspace to Submit & Close.
  8. Create and submit another expense report. Check that the report closes right away and doesn't wait for an approver.
  • More features (Rules, time tracking, attendees)

Prerequisite: a Control workspace where you're the admin.

  1. Go to Workspace > More features. Turn on Rules. Check that Rules appears in the workspace menu.
  2. Open Rules and set Max expense amount to 100. Go back to Rules and check that the limit shows 100.
  3. Create a $150 expense in the workspace. Check that the over-limit violation appears.
  4. Back in More features, turn on Time tracking. Open FAB > Create expense and pick the workspace. Check that the Time option is available.
  5. Turn off Time tracking and check that the Time option is gone.
  6. Create an expense in the workspace. Check that the Attendees field shows on the confirmation page; Control workspaces track attendees by default.
  7. Turn off attendee tracking and create another expense. Check that the Attendees field is gone.
  • Pending and error states on settings

Prerequisite: a workspace connected to QuickBooks Online or Xero.

  1. Go to Workspace > Accounting and open Advanced.
  2. Go offline.
  3. Turn Auto-sync off. Check that the row is greyed out as pending.
  4. Change one export setting, such as Export date. Check that its row on the Export page is also greyed out as pending.
  5. Go back online. Check that both rows go back to normal and keep the new values.
  6. Check that Workspaces in the left-hand navigation and the workspace row show no red dot for a healthy workspace.
  • Verify that no errors appear in the JS console

Offline tests

Same as test

QA Steps

Same as test

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.
  • 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
Screen.Recording.2026-10-14.at.15.57.35.mov
Android: mWeb Chrome
Screen.Recording.2026-10-14.at.14.47.13.mov
iOS: Native
Screen.Recording.2026-10-14.at.14.48.03.mov
iOS: mWeb Safari
Screen.Recording.2026-10-14.at.14.50.08.mov
MacOS: Chrome / Safari
Screen.Recording.2026-10-14.at.14.41.53.mov
Screen.Recording.2026-10-14.at.14.43.55.mov
Screen.Recording.2026-10-14.at.14.45.12.mov

MelvinBot and others added 3 commits October 14, 2026 04:34
…es.ts, features.ts, workflows.ts, and errors.ts

Co-authored-by: nkdengineer <nkdengineer@users.noreply.github.com>
Co-authored-by: nkdengineer <nkdengineer@users.noreply.github.com>
Co-authored-by: nkdengineer <nkdengineer@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team October 14, 2026 04:38
@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 14, 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-splitPolicyUtilsRulesFeaturesWorkflowsErrors
git checkout -b claude-splitPolicyUtilsRulesFeaturesWorkflowsErrors upstream/claude-splitPolicyUtilsRulesFeaturesWorkflowsErrors
git push -u origin claude-splitPolicyUtilsRulesFeaturesWorkflowsErrors

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

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The failing test (job 7) check is a flaky test that has nothing to do with this PR, so I didn't push a fix. A re-run should clear it.

Check independent approval is a review gate, not a code failure.

Evidence

@MelvinBot

MelvinBot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Android test steps verification results: ✅ pass

Verified on standalone Android NewDot: created a workspace, enabled Workflows and Rules, exercised Workflows (Submissions/Delay submissions, Approvals) and Rules pages, and confirmed the Inbox/workspace list render cleanly with no crashes, red error screens, or failed network calls — consistent with PR 103958 being a pure refactor.

Inbox LHN rendering normally

Step Status
Create/open a workspace and open its settings; page loads with no crash or red error screen.Created "Melvin Melvin's Workspace"; the workspace settings menu (Overview, Members, Rooms, Reports, MCP, Categories, Workflows, Company cards, More features) rendered immediately with no error overlay.
Workspace settings menu after creation
✅
Open More features; toggles render, Workflows and Rules turn on and appear in the workspace menu.Toggled both Workflows and Rules switches; both switched to the ON state and both "Workflows" and "Rules" items appeared in the workspace menu afterward.
More features page with Workflows toggle ONWorkspace menu showing Workflows and Rules items
✅
Open Workspace > Workflows; page renders with Submissions/Delay submissions and Approvals sections; toggle Delay submissions on/off without errors.Workflows page rendered 4 tabs (Submissions, Approvals, Payments, Advanced). Toggling Submissions (delay submissions) on revealed a "Frequency: Manually" sub-setting with no error; toggling off removed it cleanly. Approvals tab rendered its own toggle with no errors.
Workflows page, Submissions tab, toggle offDelay submissions toggled on showing Frequency: ManuallyApprovals tab rendered
✅
Open Workspace > Rules; page renders expense rule settings (e.g. max expense amount) without errors.Rules page rendered General/Card restrictions/Expense defaults tabs with the Basic rules list. Tapping "Flag expenses above amount" showed the expected Control-plan upsell (the workspace is on Collect) rather than a crash or error.
Rules General tab with expense rule settingsControl-plan upsell for max expense amount rule
✅
Return to Inbox/settings; workspace list and LHN render normally with no unexpected red brick-road error dots caused by the workspace.Workspace list showed the workspace (Collect, Owner: Melvin Melvin) with no error badge. Inbox LHN rendered #admins, a Concierge workflow notice, the workspace expense chat, and Concierge, with no red indicators on any avatar or tab.
Workspace list with no error indicatorInbox LHN rendering normally
✅
Verify that no errors appear in the JS console (documented step).No RedBox/LogBox overlay appeared in any screenshot across the flow, and session network traffic showed only 200 responses. A raw logcat text search was not available in this run, so this check relies on the absence of error overlays plus clean network traffic.
✅

view run · view recording

@MelvinBot

MelvinBot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ✅ pass

On dev NewDot web, the moved PolicyUtils workspace-rules/workflows/feature-toggle code works end-to-end: workspace creation and settings, More features toggles, Workflows (Submissions/Approvals), and Rules all render and operate without errors. Inbox and workspace navigation show no stray red error dots.

Inbox view, no red error dots

Step Status
Create/open a workspace and its settings load without crashChecking "Create a workspace" on the Home getting-started checklist created a workspace and opened its Overview settings page (name, description, currency, company address, plan type) with no crash or error screen.
Workspace Overview settings page
✅
More features toggles render; Workflows and Rules turn on and appear as workspace menu itemsMore features rendered all feature cards (Accounting, HR, Categories, Workflows, Rules, and others). Toggling Workflows and Rules switched both on and added "Workflows" and "Rules" entries to the workspace left nav.
More features with Workflows and Rules toggled on
✅
Workspace > Workflows renders Submissions/Approvals sections; Delay submissions toggle worksWorkflows rendered the Submissions, Approvals, Payments, and Advanced tabs. The Submissions toggle (Frequency: Manually) turned off and back on cleanly. Approvals showed the default workflow (Expenses from Everyone, Approver) with its toggle on.
Submissions toggled offSubmissions toggled back onApprovals section rendered
✅
Workspace > Rules renders expense rule settings (for example max expense amount) without errorsRules rendered the full General rule list (Flag expenses older than, Flag expenses above amount, Require receipts, Require fields, Cash/Billable expenses, eReceipts, and others). Clicking "Flag expenses above amount" showed the expected Control-plan upgrade screen (the workspace is on Collect), not a crash or error.
Rules page with expense rule settings listControl-plan upgrade paywall for max expense amount rule
✅
Inbox / workspace list render normally with no unexpected red brick-road error dotsInbox showed the #admins room, the expected "enabled workflows" and "enabled submissions" system messages, and the workspace chat, with no red error badges in the left rail or chat list.
Inbox view, no red error dots
✅
Verify that no errors appear in the JS console (documented step)The test browser session couldn't capture console logs, so this was checked indirectly. Every API call in the flows (OpenPolicyMoreFeaturesPage, EnablePolicyWorkflows, OpenPolicyWorkflowsPage, OpenPolicyRulesPage, SetPolicyRulesEnabled, SetWorkspaceAutoHarvesting, and others) returned 200, and no error toast, dialog, or crash screen appeared at any step.
✅

view run · view recording

@nkdengineer

Copy link
Copy Markdown
Contributor

@MelvinBot Please add unit test for areSettingsInErrorFields and settingsPendingAction and wrap the new moved functions in PolicyUtilsTest to new describe.

…and pending helpers

Wrap the tests for helpers moved into rules.ts, features.ts, workflows.ts, and errors.ts in matching describe blocks, and add tests for areSettingsInErrorFields and settingsPendingAction.

Co-authored-by: nkdengineer <nkdengineer@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Done in 7f23a3b. The tests for the moved helpers in PolicyUtilsTest are now grouped into four new describe blocks, and areSettingsInErrorFields and settingsPendingAction now have tests.

  • errors: getPolicyBrickRoadIndicatorStatus, hasPolicyRulesError, the two selectors, and the new tests:
    • areSettingsInErrorFields: undefined inputs, one matching setting, no matching setting.
    • settingsPendingAction: undefined inputs return null, a matching setting returns its pending action, no match returns undefined.
  • workflows: hasDynamicExternalWorkflow and shouldHideDynamicExternalWorkflowPeople.
  • features: getDefaultTimeTrackingRate, isInvoiceFieldsEnabled, isPolicyFeatureEnabled for invoice fields, and arePolicyRulesEnabled.
  • rules: getTagApproverRule, hasConfiguredRules, and isMaxExpenseAmountSet.

Some of these tests sat outside the main PolicyUtils describe. Two getTagApproverRule tests sat outside their own describe. All of them now live in their module's block. No test logic changed.

Checks

  • Jest PolicyUtilsTest: 631 passed.
  • npm run typecheck: passed.
  • ESLint on PolicyUtilsTest.ts: passed.
  • oxfmt: applied.

lint-changed and spell-changed couldn't run because git merge-base fails on this shallow clone. I ran ESLint on the file directly, but not cspell. CI runs cspell.


view run

@codecov

codecov Bot commented Oct 14, 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/PolicyUtils/errors.ts 100.00% <100.00%> (ø)
src/libs/PolicyUtils/index.ts 86.88% <ø> (-1.34%) ⬇️
src/libs/PolicyUtils/workflows.ts 100.00% <100.00%> (ø)
src/libs/PolicyUtils/features.ts 90.47% <90.47%> (ø)
src/libs/PolicyUtils/rules.ts 88.88% <88.88%> (ø)
... and 8 files with indirect coverage changes

@nkdengineer

Copy link
Copy Markdown
Contributor

@MelvinBot, fill out the Test section

  • Workflows (submit frequency and Submit & Close)
  1. Go to Workspace > Workflows.
  2. Turn on Delay submissions and set the frequency to Weekly. Check that the row shows "Weekly".
  3. Change the frequency to Manually. Check that the row shows "Manually".
  4. Turn off Delay submissions.
  5. Turn on Add approvals and set yourself as the approver.
  6. Create an expense in the workspace chat and submit the report. Check that it goes to you for approval
  7. Turn off Add approvals. This switches the workspace to Submit & Close.
  8. Create and submit another expense report. Check that the report closes right away and doesn't wait for an approver.
  • More features (Rules, time tracking, attendees)

Prerequisite: a Control workspace where you're the admin.

  1. Go to Workspace > More features. Turn on Rules. Check that Rules appears in the workspace menu.
  2. Open Rules and set Max expense amount to 100. Go back to Rules and check that the limit shows 100.
  3. Create a $150 expense in the workspace. Check that the over-limit violation appears.
  4. Back in More features, turn on Time tracking. Open FAB > Create expense and pick the workspace. Check that the Time option is available.
  5. Turn off Time tracking and check that the Time option is gone.
  6. Create an expense in the workspace. Check that the Attendees field shows on the confirmation page; Control workspaces track attendees by default.
  7. Turn off attendee tracking and create another expense. Check that the Attendees field is gone.
  • Pending and error states on settings

Prerequisite: a workspace connected to QuickBooks Online or Xero.

  1. Go to Workspace > Accounting and open Advanced.
  2. Go offline.
  3. Turn Auto-sync off. Check that the row is greyed out as pending.
  4. Change one export setting, such as Export date. Check that its row on the Export page is also greyed out as pending.
  5. Go back online. Check that both rows go back to normal and keep the new values.
  6. Check that Workspaces in the left-hand navigation and the workspace row show no red dot for a healthy workspace.

Then update Offline tests and QA Steps to Same as test text

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Updated the PR description:

  • Tests: added your three test groups (Workflows, More features, and pending/error states) and removed the TODO placeholder. The "Verify that no errors appear in the JS console" checkbox stays at the end.
  • Offline tests and QA Steps: set both to "Same as test".

In the More features group, your list skipped step 5, so I renumbered the last three steps to 5–7.


view run

@nkdengineer

Copy link
Copy Markdown
Contributor

@MelvinBot, fill the Screenshots/Videos

Screenshots/Videos

Android: Native
Screen.Recording.2026-10-14.at.15.57.35.mov
Android: mWeb Chrome
Screen.Recording.2026-10-14.at.14.47.13.mov
iOS: Native
Screen.Recording.2026-10-14.at.14.48.03.mov
iOS: mWeb Safari
Screen.Recording.2026-10-14.at.14.50.08.mov
MacOS: Chrome / Safari
Screen.Recording.2026-10-14.at.14.41.53.mov
Screen.Recording.2026-10-14.at.14.43.55.mov
Screen.Recording.2026-10-14.at.14.45.12.mov

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I filled in the Screenshots/Videos section of the PR description with your recordings for all 5 platforms: Android Native, Android mWeb Chrome, iOS Native, iOS mWeb Safari, and MacOS Chrome / Safari (3 videos). I left the rest of the description unchanged.


view run

@nkdengineer

Copy link
Copy Markdown
Contributor

@MelvinBot, Update the Author Checklist section. Also, I verified there's no console error; then let's check for Verify that no errors appear in the JS console.. After that mark the PR as ready.

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.
  • 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.

@MelvinBot
MelvinBot marked this pull request as ready for review October 14, 2026 09:14
@MelvinBot
MelvinBot requested a review from a team as a code owner October 14, 2026 09:14
@melvin-bot
melvin-bot Bot requested review from nkdengineer and removed request for a team October 14, 2026 09:14
@melvin-bot

melvin-bot Bot commented Oct 14, 2026

Copy link
Copy Markdown

@nkdengineer 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 a review from flaviadefaria October 14, 2026 09:14
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Done. I updated the PR description and marked the PR ready for review.

  • PR Author Checklist: replaced with the checklist from your comment, with every item checked.
  • Tests: checked "Verify that no errors appear in the JS console", based on your confirmation.

I didn't change any other section.


view run

@melvin-bot
melvin-bot Bot removed the request for review from a team October 14, 2026 09:14
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T09:19:19.108054Z 7f23a3b Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@nkdengineer

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.
  • 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).
  • 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
Screen.Recording.2026-10-14.at.15.57.35.mov
Android: mWeb Chrome
Screen.Recording.2026-10-14.at.14.47.13.mov
iOS: HybridApp
Screen.Recording.2026-10-14.at.14.48.03.mov
iOS: mWeb Safari
Screen.Recording.2026-10-14.at.14.50.08.mov
MacOS: Chrome / Safari
Screen.Recording.2026-10-14.at.14.41.53.mov
Screen.Recording.2026-10-14.at.14.43.55.mov
Screen.Recording.2026-10-14.at.14.45.12.mov

@nkdengineer nkdengineer 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!

@melvin-bot
melvin-bot Bot requested a review from blimpich October 14, 2026 09:19
@blimpich

Copy link
Copy Markdown
Contributor

merge conflicts 😢

@nkdengineer

Copy link
Copy Markdown
Contributor

@MelvinBot Resolve conflicts.

…lsRulesFeaturesWorkflowsErrors

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

# Conflicts:
#	src/libs/PolicyUtils/index.ts
#	tests/unit/PolicyUtilsTest.ts
@MelvinBot
MelvinBot requested a review from a team as a code owner October 14, 2026 19:27
@melvin-bot
melvin-bot Bot requested review from nkdengineer and removed request for a team October 14, 2026 19:27
@melvin-bot

melvin-bot Bot commented Oct 14, 2026

Copy link
Copy Markdown

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

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I merged main into this branch and resolved the conflicts. The PR is mergeable again.

main added 2 new helpers to PolicyUtils/index.ts: hasCompanyAddress and canCreateCategoryInSitu. I kept both in index.ts with their tests. Everything this PR moved stays in its new file.

Details
  • src/libs/PolicyUtils/index.ts: Kept this PR's imports and added hasAccountingConnections and canEditWorkspaceSettings, which canCreateCategoryInSitu needs. Dropped main's copies of the helpers this PR already moved.
  • tests/unit/PolicyUtilsTest.ts: Kept the canCreateCategoryInSitu and hasCompanyAddress tests from main. Dropped the old top-level shouldHideDynamicExternalWorkflowPeople tests, because this PR already has them in its workflows group.
  • Checks: npm run typecheck passed, and all 636 tests in PolicyUtilsTest passed. npm run lint-changed found 1 error, in swapBackgroundTabForRHPTarget.ts, which comes from main and is unchanged on this branch.

view run

@MelvinBot

Copy link
Copy Markdown
Contributor Author

⚠️ MelvinBot CI Fix Loop Detected

MelvinBot has made 5 consecutive commits trying to fix CI failures. Automatic CI fix dispatches are now paused for this PR.

Next steps: A human should review the recent commits and resolve the conflicting CI errors manually.

@nkdengineer

Copy link
Copy Markdown
Contributor

@blimpich Done

@blimpich
blimpich merged commit d64359d into main Oct 14, 2026
42 of 43 checks passed
@blimpich
blimpich deleted the claude-splitPolicyUtilsRulesFeaturesWorkflowsErrors branch October 14, 2026 20:06
@OSBotify

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.

@github-actions

Copy link
Copy Markdown
Contributor

🚧 blimpich 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/blimpich in version: 9.5.10-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No help site update needed: this PR only moves PolicyUtils helpers into new files with no renames or behavior changes, so nothing users see changed and no article sentence became incorrect.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/blimpich in version: 9.5.12-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No help site update needed. This PR only moves PolicyUtils helpers into new internal files, so nothing users see changes and no article sentence becomes wrong.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/cristipaval in version: 9.5.12-1 🚀

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.

4 participants