Skip to content

Fix flaky DownloadQueue interruption test - #23269

Merged
MikeMcQuaid merged 1 commit into
mainfrom
download-queue-flaky-interrupt
Jul 22, 2026
Merged

Fix flaky DownloadQueue interruption test#23269
MikeMcQuaid merged 1 commit into
mainfrom
download-queue-flaky-interrupt

Conversation

@MikeMcQuaid

Copy link
Copy Markdown
Member
  • Cancel staging when Interrupt arrives during fetch setup
  • Synchronise the regression test with the vulnerable setup window

  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • AI was used to generate or assist with generating this PR.

OpenAI Sol 5.6 xhigh with local review and testing.


- Cancel staging when `Interrupt` arrives during fetch setup
- Synchronise the regression test with the vulnerable setup window
Copilot AI review requested due to automatic review settings July 22, 2026 13:05

Copilot AI 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.

Pull request overview

This PR fixes a race window in Homebrew::DownloadQueue#fetch so that an Interrupt arriving during early fetch setup reliably cancels active worker threads, and updates the regression spec to synchronise precisely with that vulnerable window to eliminate flakiness.

Changes:

  • Add a top-level rescue Exception in DownloadQueue#fetch to ensure cancel runs even if Interrupt occurs before the parallel fetch loop is fully established.
  • Adjust the existing TTY-update rescue path to focus on restoring terminal state, relying on the new outer rescue for cancellation.
  • Stabilise the “interrupts queued staging” spec by gating the interrupt on both “fetch setup started” and “staging started”.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
Library/Homebrew/download_queue.rb Ensures cancellation runs on Interrupt even during early fetch setup, while keeping TTY restoration intact.
Library/Homebrew/test/download_queue_spec.rb Synchronises the interrupt regression test with the fetch-setup timing window to reduce flakiness.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MikeMcQuaid
MikeMcQuaid enabled auto-merge July 22, 2026 13:12
@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Jul 22, 2026
Merged via the queue into main with commit 38587c9 Jul 22, 2026
42 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the download-queue-flaky-interrupt branch July 22, 2026 15:49
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