Skip to content

Fix cask_sparkle_min_os audit options handling - #24039

Merged
MikeMcQuaid merged 2 commits into
mainfrom
fix-cask_sparkle_min_os-options-handling
Sep 20, 2026
Merged

MikeMcQuaid merged 2 commits into
mainfrom
fix-cask_sparkle_min_os-options-handling

Conversation

@samford

@samford samford commented Sep 19, 2026

Copy link
Copy Markdown
Member

  • 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 brew benchmark results.
  • 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?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

I used Claude Code (Opus 5, high) to identify the source of the issue. I manually implemented a fix (confirming it with before/after runs of brew audit --online izip) and had Claude Code review the changes. Afterward, I used Claude Code to implement tests to bring coverage for the method up to 100% (for lines and branches). I reviewed the tests, cleaned them up, and confirmed that they achieved the desired coverage by targeting the various states that I had identified.


The cask_sparkle_min_os audit calls livecheck's page_content method directly but it doesn't pass the livecheck block options, so the audit won't work as expected in that scenario. For example, we recently hit the user agent deprecation logic in a version bump PR for the izip cask (Homebrew/homebrew-cask#288419) but that livecheck block contains a user_agent: :browser option, so that shouldn't be possible. I traced it back to this specific audit and confirmed that passing the livecheck block options fixes the issue. I checked other usage of page_content and page_headers and existing calls pass options, as we would expect.

Besides that, I've added a guard to ensure that livecheck.url is set, as this check relies on a livecheck block URL being present. This is a relatively safe assumption but better safe than sorry.

This also adds tests to expand coverage for the cask_sparkle_min_os audit to 100% for lines and branches. To achieve this without using #send, it was necessary to make the method public (following recent guidance around this). The only functional change in the method is to use #fetch in the normalize_min_os argument, as we're already guarding against items.blank?, so we couldn't exercise the nil path for items[0].


This bug can be replicated by running brew audit --online izip, which fails on the main branch (with the user agent deprecation error) and passes on this PR branch.

The `cask_sparkle_min_os` audit calls livecheck's `page_content`
method directly but it doesn't pass the `livecheck` block options, so
the audit won't work as expected in that scenario. For example, we
recently hit the user agent deprecation logic in a version bump PR for
the `izip` cask but that `livecheck` block contains a
`user_agent: :browser` option, so that shouldn't be possible. I traced
it back to this specific audit and confirmed that passing the
`livecheck` block `options` fixes the issue. I checked other usage of
`page_content` and `page_headers` and existing calls pass `options`,
as we would expect.

Besides that, I've added a guard to ensure that `livecheck.url` is
set, as this check relies on a `livecheck` block URL being present.
This is a relatively safe assumption but better safe than sorry.
This adds tests to expand coverage for the `cask_sparkle_min_os` audit
to 100% for lines and branches. To achieve this without using `#send`,
it was necessary to make the method public (following recent guidance
around this). The only functional change in the method is to use
`#fetch` in the `normalize_min_os` argument, as we're already guarding
against `items.blank?`, so we couldn't exercise the `nil` path for
`items[0]`.
Copilot AI lite review requested due to automatic review settings September 19, 2026 22:45

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@samford
samford force-pushed the fix-cask_sparkle_min_os-options-handling branch from 82ce54e to fdbff29 Compare September 20, 2026 01:13

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Sep 20, 2026
Merged via the queue into main with commit 6434e9c Sep 20, 2026
51 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the fix-cask_sparkle_min_os-options-handling branch September 20, 2026 13:46
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.

5 participants