Skip to content

Stabilize non-fast-forward fallback tests in push_to_pull_request_branch (CJS shard 4)#35689

Merged
pelikhan merged 2 commits into
mainfrom
copilot/aw-fix-js-tests-shard-4
May 29, 2026
Merged

Stabilize non-fast-forward fallback tests in push_to_pull_request_branch (CJS shard 4)#35689
pelikhan merged 2 commits into
mainfrom
copilot/aw-fix-js-tests-shard-4

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 29, 2026

JS Tests (shard 4/4) was red on every push/PR due to two regressions in push_to_pull_request_branch.test.cjs around non-fast-forward handling. The failures came from brittle ordered mocks that no longer matched the expanded git call sequence in pushSignedCommits.

  • ### Root cause captured in tests

    • The two fallback-path tests assumed a strict mockResolvedValueOnce order for exec.getExecOutput.
    • Recent signed-push flow changes added intermediate git calls (rev-parse, rev-list --parents, diff-tree), shifting those assumptions and invalidating assertions.
  • ### Test harness updated (minimal scope)

    • Replaced ordered mockResolvedValueOnce chains in the two failing cases with command-shape-based mockImplementation.
    • Kept scenario intent unchanged:
      • default behavior creates fallback PR on non-fast-forward
      • fallback_as_pull_request: false returns push_failed and does not create fallback PR
  • ### Behavior preserved

    • No production code changes; only test setup logic was made resilient to internal call-sequence evolution.
mockExec.getExecOutput = vi.fn().mockImplementation(async (_cmd, args) => {
  const a = Array.isArray(args) ? args : [];
  if (a[0] === "rev-list" && a[1] === "--parents") {
    return { exitCode: 0, stdout: "2222... 1111...\n", stderr: "" };
  }
  if (a[0] === "ls-remote" && a[2] === "refs/heads/feature-branch") {
    return { exitCode: 0, stdout: "1111...\trefs/heads/feature-branch\n", stderr: "" };
  }
  return originalGetExecOutput(_cmd, args);
});

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix JS Tests shard 4 failing on every push Stabilize non-fast-forward fallback tests in push_to_pull_request_branch (CJS shard 4) May 29, 2026
Copilot AI requested a review from gh-aw-bot May 29, 2026 12:23
@pelikhan pelikhan marked this pull request as ready for review May 29, 2026 13:51
Copilot AI review requested due to automatic review settings May 29, 2026 13:51
@pelikhan pelikhan merged commit 9cc97dc into main May 29, 2026
@pelikhan pelikhan deleted the copilot/aw-fix-js-tests-shard-4 branch May 29, 2026 13:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

[aw] CJS: JS Tests shard 4 failing on every push — push_to_pull_request_branch.test.cjs regression

4 participants