Skip to content

Conversation

@issyl0
Copy link
Member

@issyl0 issyl0 commented Nov 10, 2025

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Copilot AI review requested due to automatic review settings November 10, 2025 00:30
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 migrates the test-bot codebase from typed: true to typed: strict mode in Sorbet, adding comprehensive type annotations throughout the codebase to enable stricter type checking.

Key changes:

  • Upgraded Sorbet typing level from true to strict across all test-bot files
  • Added explicit type signatures (sig) to all methods, attributes, and instance variables
  • Used T.let to explicitly type all instance variable initializations
  • Added T.must() calls where needed to satisfy Sorbet's strict null checking

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
Library/Homebrew/test_bot/test_runner.rb Added strict typing with method signatures and instance variable types; includes an initialize method for module (potential issue)
Library/Homebrew/test_bot/test_formulae.rb Added comprehensive type annotations for attributes, methods, and complex instance variables including hashes and arrays
Library/Homebrew/test_bot/test_cleanup.rb Added type signatures and converted repository parameters to use .to_s for git commands
Library/Homebrew/test_bot/test.rb Added passed? helper method and upgraded to strict typing
Library/Homebrew/test_bot/tap_syntax.rb Added method signature and upgraded to strict typing
Library/Homebrew/test_bot/step.rb Added extensive type annotations for all attributes and methods; includes type assertions with T.must()
Library/Homebrew/test_bot/setup.rb Added method signature with T.self_type return type
Library/Homebrew/test_bot/junit.rb Added type signatures and moved require statement to top of file
Library/Homebrew/test_bot/formulae_detect.rb Added comprehensive type signatures including complex parameter lists
Library/Homebrew/test_bot/formulae_dependents.rb Added type signatures and extensive use of T.must() for nullable variables
Library/Homebrew/test_bot/formulae.rb Added type annotations and fixed array wrapping pattern from Array.new to literal syntax
Library/Homebrew/test_bot/cleanup_before.rb Added signature and simplified conditional logic
Library/Homebrew/test_bot/cleanup_after.rb Added method signature and upgraded to strict typing
Library/Homebrew/test_bot/bottles_fetch.rb Added type signatures for accessor and methods
Library/Homebrew/test_bot.rb Added type annotations for constants and module methods
Comments suppressed due to low confidence (1)

Library/Homebrew/test_bot/setup.rb:21

  • The run! method signature declares a return type of T.self_type, but the method doesn't have an explicit return statement. In Ruby, methods return the value of the last expression, which in this case would be the result of the last test call (either "brew", "doctor", "--debug", verbose: true or "brew", "doctor").

The method should either explicitly return self to match the signature, or the return type should be changed to match what test returns (which appears to be a Step object based on the Test class implementation).

      sig { params(args: Homebrew::CLI::Args).returns(T.self_type) }
      def run!(args:)
        test_header(:Setup)

        test "brew", "install-bundler-gems", "--add-groups=ast,audit,bottle,formula_test,livecheck,style"

        # Always output `brew config` output even when it doesn't fail.
        test "brew", "config", verbose: true

        if ENV["HOMEBREW_TEST_BOT_VERBOSE_DOCTOR"]
          test "brew", "doctor", "--debug", verbose: true
        else
          test "brew", "doctor"
        end
      end

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

@github-actions
Copy link

github-actions bot commented Dec 2, 2025

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Dec 2, 2025
- There's one left (as of 2025-11-09), `test_bot/test.rb` which shows
  >70 errors when making `strict`, so I'm leaving that one for future
  us!
@github-actions github-actions bot removed the stale No recent activity label Dec 7, 2025
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