Skip to content

Conversation

@MikeMcQuaid
Copy link
Member

Add a new audit method to check if the revision and compatibility_version are consistent with each other.

This ensures that when a formula's compatibility_version is increased, the revision of dependent formulas was also increased.

Inversely, when a formula's revision is increased in the same PR as one of its dependencies, the compatibility_version of dependent formulae must be increased by 1.

Add a new audit method to check if the `revision` and
`compatibility_version` are consistent with each other.

This ensures that when a formula's `compatibility_version` is increased,
the `revision` of dependent formulas was also increased.

Inversely, when a formula's `revision` is increased in the same PR as
one of its dependencies, the `compatibility_version` of dependent
formulae must be increased by 1.
@MikeMcQuaid MikeMcQuaid force-pushed the audit_revision_and_compatibility_version_relationships branch from d7bae0f to 21b5d67 Compare October 28, 2025 17:40
@MikeMcQuaid MikeMcQuaid marked this pull request as ready for review October 28, 2025 17:40
Copilot AI review requested due to automatic review settings October 28, 2025 17:40
Copy link
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.

Pull Request Overview

This PR adds support for auditing compatibility_version changes in formulae and extends the existing revision audit to validate dependency relationships.

  • Introduces a new audit_compatibility_version method that ensures compatibility versions don't decrease and only increment by 1, and that dependent formulae bump their revisions accordingly
  • Extends audit_revision to validate that when a formula's revision increases, changed dependencies must have their compatibility_version incremented by 1
  • Refactors version info caching and adds a changed_formulae_paths helper method to identify changed formulae in a tap

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
Library/Homebrew/formula_auditor.rb Adds audit_compatibility_version method, extends audit_revision with dependency validation, adds changed_formulae_paths helper, and refactors version info caching to support multiple formulae
Library/Homebrew/test/formula_auditor_spec.rb Adds comprehensive test coverage for both compatibility_version audits and revision-dependency relationship validation, including new test helper methods for formula creation and stubbing

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

relative_path = relative_path.sub_ext(".rb") if relative_path.extname.empty?
absolute_path = tap.formula_dir/relative_path
absolute_path.expand_path if absolute_path.exist?
rescue
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

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

Bare rescue clause catches all exceptions including system errors. This is a bad practice as it can mask critical errors. Consider specifying the specific exception types to rescue (e.g., rescue StandardError), or at a minimum document which exceptions are expected here.

Suggested change
rescue
rescue StandardError

Copilot uses AI. Check for mistakes.
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.

2 participants