Skip to content

[Due for payment 2026-06-26] Investigate workflow job failing on main: test / test (job 8) #93787

Closed

Description

@github-actions

🚨 Failure Summary 🚨:

  • 📋 Job Name: test / test (job 8)
  • 🔧 Failure in Workflow: Process new code merged to main
  • 🔗 Triggered by PR: PR Link
  • 👤 PR Author: @mukhrr
  • 🤝 Merged by: @MariaHCD
  • 🐛 Error Message:
    warning: [git-mirror] Skipping cache commit: Found 2 failed/cancelled steps
    warning: [git-mirror] - Step: unknown (failed)
    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 8).
🔍 This issue has been automatically created and labeled with Workflow Failure for investigation.

👀 Please look into the following:

  1. Why the PR caused the job to fail?
  2. Address any underlying issues.

For detailed instructions, check this SO.

🐛 We appreciate your help in squashing this bug!

Activity

  1. MariaHCD commented on Jun 17, 2026

    @MariaHCD
    Contributor
     ● ConciergeDraftContext › does not apply completed final HTML until the paced Pusher target is fully visible
    
        expect(received).toBe(expected) // Object.is equality
    
        Expected: "He"
        Received: "Hel"
    
          182 |
          183 |         // Then final HTML waits until the banked text is visible
        > 184 |         expect(getFirstMessageText(result.current.draftReportAction)).toBe('He');
              |                                                                       ^
          185 |         expect(getFirstMessageText(result.current.draftReportAction)).not.toBe('Server final response');
          186 |         expect(result.current.isDraftPendingCompletion).toBe(true);
          187 |
    
          at Object.toBe (tests/unit/pages/inbox/ConciergeDraftContext.test.tsx:184:71)
          at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:17)
          at _next (node_modules/@babel/runtime/helpers/asyncToGenerator.js:17:9)
    

    @MelvinBot investigate

  2. MelvinBot commented on Jun 17, 2026

    @MelvinBot
    Contributor

    Issue Analysis

    Root Cause: Flaky test, not a product bug. The test ConciergeDraftContext.test.tsx › does not apply completed final HTML until the paced Pusher target is fully visible relies on real wall-clock time to control how many characters the pacer reveals, so it fails on a slow/loaded CI runner.

    The pacer reveals one character per PUSHER_DRAFT_PACE_INTERVAL_MS (10ms) of elapsed real time — usePusherDraftPacing.ts:236-239:

    const now = Date.now();
    const elapsed = lastPaceTickTimeRef.current ? Math.max(0, now - lastPaceTickTimeRef.current) : PUSHER_DRAFT_PACE_INTERVAL_MS;
    const elapsedIntervals = Math.floor(elapsed / PUSHER_DRAFT_PACE_INTERVAL_MS);
    const unitsToReveal = Math.max(1, elapsedIntervals);

    The first emitPusherEvent (CONCIERGE_DRAFT_UPDATED) calls startPusherDraftPace, stamping lastPaceTickTimeRef = Date.now() (line 329). The second emitPusherEvent (CONCIERGE_DRAFT_COMPLETED) synchronously runs tickPacing once. If < 10ms of real time passed between the two act() blocks, unitsToReveal = 1 and exactly one extra char is revealed → 'He' (the expectation). On a slow runner ≥ 20ms passes → unitsToReveal ≥ 2 → 'Hel' — the observed Expected "He" / Received "Hel".

    The two sibling tests that exercise the same elapsed-time path are deterministic precisely because they mock Date.now (e.g. line 193). This one doesn't.

    Recommended Fix: Make the test deterministic by mocking Date.now and advancing it by exactly one pace interval between the two events (mirroring the sibling tests). Production code is correct and needs no change.

    Suggested patch
    it('does not apply completed final HTML until the paced Pusher target is fully visible', async () => {
        let now = 1000;
        jest.spyOn(Date, 'now').mockImplementation(() => now);
        const wrapper = ({children}: PropsWithChildren) => <ConciergeDraftProvider reportID={REPORT_ID}>{children}</ConciergeDraftProvider>;
        const {result, unmount} = renderHook(() => useConciergeDraft(), {wrapper});
    
        await waitFor(() => {
            expect(Pusher.subscribe).toHaveBeenCalledTimes(6);
        });
    
        // Given an active paced Pusher target
        act(() => {
            emitPusherEvent(Pusher.TYPE.CONCIERGE_DRAFT_UPDATED, createDraftEvent(TARGET_BODY_MARKDOWN));
        });
        expect(getFirstMessageText(result.current.draftReportAction)).toBe('H');
    
        // When completion arrives one pace tick later, before the visible body reaches the target
        now += PUSHER_DRAFT_PACE_INTERVAL_MS;
        act(() => {
            emitPusherEvent(
                Pusher.TYPE.CONCIERGE_DRAFT_COMPLETED,
                createDraftEvent('', {
                    sequence: 2,
                    status: 'completed',
                    bodyMarkdown: undefined,
                    finalRenderedHTML: FINAL_RENDERED_HTML,
                }),
            );
        });
    
        // Then final HTML waits until the banked text is visible
        expect(getFirstMessageText(result.current.draftReportAction)).toBe('He');
        expect(getFirstMessageText(result.current.draftReportAction)).not.toBe('Server final response');
        expect(result.current.isDraftPendingCompletion).toBe(true);
    
        unmount();
    });

    With Date.now fixed and advanced by exactly PUSHER_DRAFT_PACE_INTERVAL_MS, elapsedIntervals === 1 → unitsToReveal === 1 → exactly one extra char is revealed ('He'), regardless of how loaded the CI runner is. jest.restoreAllMocks() in the existing afterEach already cleans up the spy.

    Why it's the test and not the feature
    • The production reveal rate is intentionally time-driven (a typing animation), so on real machines drift of a few ms is invisible. The bug only manifests because the test asserts an exact character count tied to real elapsed time.
    • No production code path changed behavior; the failure is purely a function of CI scheduling jitter between two synchronous act() calls.
    • The test was introduced with the paced-Pusher-draft feature in PR [NoQA] Fix false broken connection banner on Company Cards page for non-direct card feeds #93459.

    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/93787) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  3. MariaHCD commented on Jun 17, 2026

    @MariaHCD
    Contributor

    Okay, rerunning led to this job passing so it is a flakey test indeed: https://github.com/Expensify/App/actions/runs/27680952560

    @inimaga I believe you introduced this test? Could you please look into and resolve it's flakiness?

  4. added and removed on Jun 17, 2026
  5. changed the title [-]Investigate workflow job failing on main: test / test (job 8)[/-] [+][Due for payment 2026-06-26] Investigate workflow job failing on main: test / test (job 8)[/+] on Jun 19, 2026
  6. melvin-bot commented on Jun 19, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  7. melvin-bot commented on Jun 19, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.15-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-06-26. 🎊

  8. inimaga commented on Jun 19, 2026

    @inimaga
    Contributor

    No checklist due.

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions