You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Investigate workflow job failing on main: test / test (job 7) #85235
🐛 Error Message:
warning: Node.js 20 actions are deprecated. The following actions are running on Node.js 20 and may not work as expected: actions/checkout@8ade135, SimenB/github-actions-cpu-cores@31e91de. Actions will be forced to run with Node.js 24 by default starting June 2nd, 2026. Please check if updated versions of these actions are available that support Node.js 24. To opt into Node.js 24 now, set the FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true environment variable on the runner or in your workflow file. Once Node.js 24 becomes the default, you can temporarily opt out by setting ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/
failure: Process completed with exit code 1.
⚠️Action Required⚠️:
🛠️ A recent merge appears to have caused a failure in the job named test / test (job 7).
🔍 This issue has been automatically created and labeled with Workflow Failure for investigation.
Please re-state the problem that we are trying to solve in this issue.
The test IOURequestStepConfirmationPageTest › Unreported transaction tests › should route unreported distance expense to requestMoney and skip createDistanceRequest fails with TypeError: Cannot read properties of undefined (reading 'status') at src/libs/getCurrentPosition/index.ts:10, causing CI job 7 to fail on main.
What is the root cause of that problem?
The test file tests/ui/components/IOURequestStepConfirmationPageTest.tsx is missing a mock for @libs/getCurrentPosition.
PR #85147 ("[No QA] Fix jest tests - job7 and job8") was merged just before the triggering PR and added await waitForBatchedUpdatesWithAct() after the button press. This correctly allowed the async createTransaction flow to complete — but it also means the code now reaches getCurrentPosition() in the distance expense path (src/pages/iou/request/step/IOURequestStepConfirmation.tsx).
When getCurrentPosition runs, it calls requestForegroundPermissionsAsync() from expo-location. In the test environment, jest-expo mocks this as a plain jest.fn() (returns undefined) rather than a promise-returning function. So foregroundPermissionResponse.status throws TypeError: Cannot read properties of undefined.
The data flow is:
Test presses "Create expense" for a distance expense
createTransaction callback runs in IOURequestStepConfirmation.tsx
getCurrentPosition() is called at line ~1299
requestForegroundPermissionsAsync() resolves to undefined (bad jest-expo mock)
Accessing .status on undefined throws TypeError
IOU.requestMoney is never called, so the assertion at line 1271 fails
Other tests that deal with distance expenses (e.g., tests/actions/IOU/MoneyRequestTest.ts:48) avoid this by including jest.mock('@libs/getCurrentPosition').
What changes do you think we should make in order to solve the problem?
Add the missing mock to the test file tests/ui/components/IOURequestStepConfirmationPageTest.tsx:
jest.mock('@libs/getCurrentPosition');
This follows the established pattern from tests/actions/IOU/MoneyRequestTest.ts and prevents the unmocked expo-location code path from being reached during the test.
Note: The triggering PR (#85028, which changed src/pages/ReportChangeWorkspacePage.tsx) is unrelated to this failure. The root cause was introduced by PR #85147 which fixed test timing but didn't add the necessary getCurrentPosition mock.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
I ran out of time before I could finish helping you. This usually means the task was too complex or I got stuck exploring. Please try again with a more specific request or post in the #melvinbot-ai.
MelvinBot was asked to implement the fix proposed in its earlier analysis. The run hit the 30-minute workflow timeout-minutes limit and was cancelled.
Timeline
14:53 UTC — Run started (resuming session 44aad2d3)
14:55 UTC — MelvinBot added jest.mock('@libs/getCurrentPosition') to the test file, which fixed the original TypeError: Cannot read properties of undefined (reading 'status')
14:55–14:56 UTC — MelvinBot attempted to run the test 5 times but was blocked by Bash permission errors (This command requires approval), burning cycles on retries
14:56 UTC — Test eventually ran but still failed — different error. The mock fixed the TypeError, but IOU.requestMoney received 0 calls instead of the expected ≥1 call. This is a deeper issue in the unreported distance expense flow in IOURequestStepConfirmation.tsx
14:57–15:24 UTC — MelvinBot spawned a researcher subagent to investigate the createTransaction code path for unreported distance expenses, trying to understand why requestMoney is never called even after the mock fix. It ran out of time during this investigation.
Root Cause of Timeout
The task was more complex than expected. Adding the getCurrentPosition mock was only half the fix. The test "should route unreported distance expense to requestMoney and skip createDistanceRequest" has a deeper issue: the createTransaction callback in IOURequestStepConfirmation.tsx takes a different code path for distance requests that doesn't reach requestMoney as the test expects. This could be:
Issue #85142 tracked the same underlying test failure. PR #85147 (merged 13:46 UTC) fixed the RESULTS import in __mocks__/react-native-permissions.ts but did not address the getCurrentPosition mock or the deeper requestMoney assertion issue. The triggering PR #85028 (merged 14:06 UTC) ran against a commit that included the #85147 fix but still failed because the getCurrentPosition issue and the requestMoney code path issue persisted.
Recommendation
The fix requires both:
Adding jest.mock('@libs/getCurrentPosition') to the test file
Investigating why the createTransaction flow for unreported distance expenses doesn't call requestMoney — either fix the component code or correct the test expectation
A more targeted @MelvinBot request focusing specifically on tracing the createTransaction → requestMoney code path for unreported distance expenses would be more likely to succeed within the 30-minute window.
Activity
inimaga commentedon Mar 13, 2026
@MelvinBot Could you investigate the issue and propose a fix
MelvinBot commentedon Mar 13, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
The test
IOURequestStepConfirmationPageTest › Unreported transaction tests › should route unreported distance expense to requestMoney and skip createDistanceRequestfails withTypeError: Cannot read properties of undefined (reading 'status')atsrc/libs/getCurrentPosition/index.ts:10, causing CI job 7 to fail on main.What is the root cause of that problem?
The test file
tests/ui/components/IOURequestStepConfirmationPageTest.tsxis missing a mock for@libs/getCurrentPosition.PR #85147 ("[No QA] Fix jest tests - job7 and job8") was merged just before the triggering PR and added
await waitForBatchedUpdatesWithAct()after the button press. This correctly allowed the asynccreateTransactionflow to complete — but it also means the code now reachesgetCurrentPosition()in the distance expense path (src/pages/iou/request/step/IOURequestStepConfirmation.tsx).When
getCurrentPositionruns, it callsrequestForegroundPermissionsAsync()fromexpo-location. In the test environment,jest-expomocks this as a plainjest.fn()(returnsundefined) rather than a promise-returning function. SoforegroundPermissionResponse.statusthrowsTypeError: Cannot read properties of undefined.The data flow is:
createTransactioncallback runs inIOURequestStepConfirmation.tsxgetCurrentPosition()is called at line ~1299requestForegroundPermissionsAsync()resolves toundefined(bad jest-expo mock).statusonundefinedthrows TypeErrorIOU.requestMoneyis never called, so the assertion at line 1271 failsOther tests that deal with distance expenses (e.g.,
tests/actions/IOU/MoneyRequestTest.ts:48) avoid this by includingjest.mock('@libs/getCurrentPosition').What changes do you think we should make in order to solve the problem?
Add the missing mock to the test file
tests/ui/components/IOURequestStepConfirmationPageTest.tsx:This follows the established pattern from
tests/actions/IOU/MoneyRequestTest.tsand prevents the unmockedexpo-locationcode path from being reached during the test.Note: The triggering PR (#85028, which changed
src/pages/ReportChangeWorkspacePage.tsx) is unrelated to this failure. The root cause was introduced by PR #85147 which fixed test timing but didn't add the necessarygetCurrentPositionmock.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.inimaga commentedon Mar 13, 2026
@MelvinBot implement this
MelvinBot commentedon Mar 13, 2026
I ran out of time before I could finish helping you. This usually means the task was too complex or I got stuck exploring. Please try again with a more specific request or post in the #melvinbot-ai.
Run details: https://github.com/Expensify/Expensify/actions/runs/23056497163
MelvinBot commentedon Mar 13, 2026
MelvinBot Run Analysis — Cancelled (30-minute timeout)
Run: https://github.com/Expensify/Expensify/actions/runs/23056497163
What happened
MelvinBot was asked to implement the fix proposed in its earlier analysis. The run hit the 30-minute workflow
timeout-minuteslimit and was cancelled.Timeline
44aad2d3)jest.mock('@libs/getCurrentPosition')to the test file, which fixed the originalTypeError: Cannot read properties of undefined (reading 'status')This command requires approval), burning cycles on retriesIOU.requestMoneyreceived 0 calls instead of the expected ≥1 call. This is a deeper issue in the unreported distance expense flow inIOURequestStepConfirmation.tsxcreateTransactioncode path for unreported distance expenses, trying to understand whyrequestMoneyis never called even after the mock fix. It ran out of time during this investigation.Root Cause of Timeout
The task was more complex than expected. Adding the
getCurrentPositionmock was only half the fix. The test"should route unreported distance expense to requestMoney and skip createDistanceRequest"has a deeper issue: thecreateTransactioncallback inIOURequestStepConfirmation.tsxtakes a different code path for distance requests that doesn't reachrequestMoneyas the test expects. This could be:createDistanceRequestinstead ofrequestMoneyregardless of the unreported flagRelationship to #85142
Issue #85142 tracked the same underlying test failure. PR #85147 (merged 13:46 UTC) fixed the
RESULTSimport in__mocks__/react-native-permissions.tsbut did not address thegetCurrentPositionmock or the deeperrequestMoneyassertion issue. The triggering PR #85028 (merged 14:06 UTC) ran against a commit that included the #85147 fix but still failed because thegetCurrentPositionissue and therequestMoneycode path issue persisted.Recommendation
The fix requires both:
jest.mock('@libs/getCurrentPosition')to the test filecreateTransactionflow for unreported distance expenses doesn't callrequestMoney— either fix the component code or correct the test expectationA more targeted
@MelvinBotrequest focusing specifically on tracing thecreateTransaction→requestMoneycode path for unreported distance expenses would be more likely to succeed within the 30-minute window.inimaga commentedon Mar 16, 2026
Fixed by here. Thanks Robert!