Skip to content

[NoQA] Fix import/no-cycle - part 24 - #107381

Open
LukasMod wants to merge 4 commits into
Expensify:mainfrom
callstack-internal:refactor/no-cycle-part-24
Open

LukasMod wants to merge 4 commits into
Expensify:mainfrom
callstack-internal:refactor/no-cycle-part-24

Conversation

@LukasMod

@LukasMod LukasMod commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Part 24 of the import/no-cycle cleanup. Takes TransactionUtils/violations.ts out of the ReportUtils import cycle, which cuts 2 findings in src (25 to 23, measured with oxlint with the eslint-disable comments stripped). Two more findings in the same file and in TransactionUtils/index.ts stay until PolicyUtils leaves the loop in a later part.

  • New ReportTypeAndStatus.ts (type, state and status checks: isProcessingReport, isIOUReport, isInvoiceReport, isOpenExpenseReport, isSettled) and ReportRoles.ts (isCurrentUserSubmitter, isReportManager). ReportUtils keeps wrapper functions with the same names that delegate to them, so its importers do not change.
  • isMerchantMissing moves into TransactionUtils/fields.ts, and isCategoryBeingAnalyzed into its own TransactionUtils/isCategoryBeingAnalyzed.ts. hasPendingUI and isTransactionSubmittable move from violations.ts into TransactionUtils/index.ts. All of these still come from @libs/TransactionUtils.
  • shouldShowBrokenConnectionViolation and isMarkAsCashActionForTransaction take a required currentUserAccountID, because violations.ts can no longer fall back to the session account inside ReportUtils. The 5 component callers and ReportPrimaryActionUtils already had the ID and now pass it.

Fixed Issues

$ #99650
PROPOSAL:

Tests

  1. As a workspace admin, turn on Debug mode in Settings > Troubleshoot.
  2. In that workspace's chat, create a manual expense. It stays on an open report you submitted.
  3. Open the expense, then its Debug page, then Transaction > Violations, and tap Create.
  4. Paste {"type":"violation","name":"rter","data":{"rterType":"brokenCardConnection"}} and save.
  5. Go back to the expense and verify a green Mark as cash button shows in the expense header.
  6. Tap Mark as cash and verify the violation clears and the button goes away.
  7. In a 1:1 chat (not a workspace), request money manually with the Merchant left empty and the description "Team lunch", then open the new expense so its thread opens, and verify the header title reads " for Team lunch" and not " for Expense".
  • Verify that no errors appear in the JS console

Offline tests

No offline-specific behavior changes

QA Steps

No QA needed. This only moves code between modules and changes import paths.

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
android.mov
Android: mWeb Chrome
iOS: Native
ios.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
web.1-6.mov
web.7.mov

@LukasMod LukasMod changed the title [NoQA] refactor: cut import/no-cycle findings by taking TransactionUtils/violations.ts out of the ReportUtils cycle [NoQA] Fix import/no-cycle - part 24 Nov 19, 2026
@codecov

codecov Bot commented Nov 19, 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 Δ
...nents/ReportActionItem/MoneyRequestReceiptView.tsx 75.37% <100.00%> (ø)
...c/components/ReportActionItem/MoneyRequestView.tsx 79.68% <100.00%> (ø)
...m/TransactionPreview/TransactionPreviewContent.tsx 90.06% <100.00%> (ø)
...nents/TransactionItemRow/TransactionItemRowRBR.tsx 100.00% <100.00%> (ø)
src/libs/ReportPrimaryActionUtils.ts 95.39% <100.00%> (ø)
src/libs/ReportRoles.ts 100.00% <100.00%> (ø)
src/libs/ReportTypeAndStatus.ts 100.00% <100.00%> (ø)
src/libs/ReportUtils.ts 91.51% <100.00%> (-0.01%) ⬇️
src/libs/TransactionUtils/fields.ts 100.00% <100.00%> (ø)
src/libs/TransactionUtils/index.ts 95.43% <100.00%> (-0.16%) ⬇️
... and 3 more
... and 5 files with indirect coverage changes

@LukasMod

Copy link
Copy Markdown
Contributor Author

@MelvinBot review

@melvin-bot

melvin-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown

@LukasMod I sent you a Slack DM to connect GitHub. I will continue the original request once you are connected.

@MelvinBot

MelvinBot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Web test steps verification results: ⚠️ partial

Static review found no actionable code defects. Web verification remains incomplete: the expense reached SUBMITTED rather than OPEN, Mark as cash was not tested, and blank-merchant validation blocked the description-fallback check; no product regression was confirmed.

Blank merchant rejected despite Team lunch description

Step Status
1. Enable Debug modeEnabled in Account > Troubleshoot; debug actions became available.
Troubleshoot after enabling Debug mode
✅
2. Create a manual expense on an OPEN workspace reportCreated an expense through the global action, but its report was SUBMITTED/Outstanding, not OPEN.
⚠️
3. Open Transaction > Violations > CreateReached Debug - Report; transaction violations were not reached before the tester hit its step limit.
⚠️
4. Save the brokenCardConnection violationNot attempted because violation creation was not reached.
⚠️
5. Verify the green Mark as cash buttonUntested; the prerequisite violation was not created.
⚠️
6. Verify Mark as cash clears the violation and buttonUntested; prerequisite states were not established.
⚠️
7. Verify blank-merchant expense displays Team lunchThe form rejected a blank merchant with “Please enter a valid merchant,” preventing chat-text verification.
Blank merchant rejected despite Team lunch description
⚠️
8. Verify no JavaScript console errorsUnverified: console inspection was unavailable through the tester’s supported browser interface.
⚠️

view run · view recording

@LukasMod
LukasMod force-pushed the refactor/no-cycle-part-24 branch from b4bbe80 to db33d7c Compare November 23, 2026 08:58
@LukasMod
LukasMod marked this pull request as ready for review November 23, 2026 13:09
@LukasMod
LukasMod requested review from a team as code owners November 23, 2026 13:09
@expensify-chore-bot
expensify-chore-bot Bot requested review from thelullabyy and removed request for a team November 23, 2026 13:09
@expensify-chore-bot

Copy link
Copy Markdown

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

@expensify-chore-bot
expensify-chore-bot Bot requested review from garrettmknight and removed request for a team November 23, 2026 13:09
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T13:24:25.093591Z db33d7c 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.

@thelullabyy

thelullabyy commented Nov 24, 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 any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I 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 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
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-11-30.at.09.29.03.mov
Screen.Recording.2026-11-30.at.09.27.37.mov

@garrettmknight
garrettmknight removed their request for review November 24, 2026 11:40
@thelullabyy

Copy link
Copy Markdown
Contributor

On my plan today

…art-24

# Conflicts:
#	src/libs/TransactionUtils/index.ts
@LukasMod

Copy link
Copy Markdown
Contributor Author

new conflicts resolved

@melvin-bot
melvin-bot Bot requested a review from roryabraham November 30, 2026 01:31

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants