Repository navigation
Report net dependency impact in test-bot - #24213
Conversation
Signed-off-by: Patrick Linnane <patrick@linnane.io>
|
@cho-m This was inspired by your OpenSSL PRs. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
cffd2144-4f35-4b1a-96a6-00f44d7c5126
📒 Files selected for processing (2)
Library/Homebrew/test/test_bot/formulae_spec.rbLibrary/Homebrew/test_bot/formulae.rb
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📜 Review details
⏰ Context from checks skipped due to timeout. (19)
- GitHub Check: docker (arm64 Ubuntu 24.04)
- GitHub Check: docker (x86_64 Ubuntu 26.04)
- GitHub Check: docker (arm64 Ubuntu 26.04)
- GitHub Check: docker (x86_64 Ubuntu 24.04)
- GitHub Check: tests (load-only macOS)
- GitHub Check: tests (macOS, 1/2)
- GitHub Check: tests (generic OS, 2/2)
- GitHub Check: tests (generic OS, 1/2)
- GitHub Check: tests (Linux, 2/2)
- GitHub Check: tests (macOS, 2/2)
- GitHub Check: tests (online, 2/2)
- GitHub Check: tests (no Sorbet)
- GitHub Check: tests (load-only Linux)
- GitHub Check: tests (Linux, 1/2)
- GitHub Check: tests (online, 1/2)
- GitHub Check: workflow_syntax
- GitHub Check: syntax
- GitHub Check: docs
- GitHub Check: Analyze
🧰 Additional context used
🪛 ast-grep (0.45.3)
Library/Homebrew/test/test_bot/formulae_spec.rb
[warning] 161-163: Found the use of an hardcoded passphrase for RSA. The passphrase can be easily discovered, and therefore should not be stored in source-code. It is recommended to remove the passphrase from source-code, and use system environment variables or a restricted configuration file.
Context: allow(Utils).to receive(:safe_popen_read)
.with("git", "-C", repository, "diff", "--no-ext-diff", "--unified=0",
"origin/HEAD", "HEAD", "--", formula.path.relative_path_from(repository).to_s).and_return <<~DIFF
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures
(hardcoded-secret-rsa-passphrase-ruby)
[warning] 161-163: Found the use of an hardcoded passphrase for RSA. The passphrase can be easily discovered, and therefore should not be stored in source-code. It is recommended to remove the passphrase from source-code, and use system environment variables or a restricted configuration file.
Context: receive(:safe_popen_read)
.with("git", "-C", repository, "diff", "--no-ext-diff", "--unified=0",
"origin/HEAD", "HEAD", "--", formula.path.relative_path_from(repository).to_s)
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures
(hardcoded-secret-rsa-passphrase-ruby)
[warning] 363-366: Found the use of an hardcoded passphrase for RSA. The passphrase can be easily discovered, and therefore should not be stored in source-code. It is recommended to remove the passphrase from source-code, and use system environment variables or a restricted configuration file.
Context: allow(Utils).to receive(:safe_popen_read)
.with("git", "-C", repository, "diff", "--no-ext-diff", "--unified=0",
"origin/HEAD", "HEAD", "--", current.path.relative_path_from(repository).to_s)
.and_return <<~DIFF
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures
(hardcoded-secret-rsa-passphrase-ruby)
[warning] 363-365: Found the use of an hardcoded passphrase for RSA. The passphrase can be easily discovered, and therefore should not be stored in source-code. It is recommended to remove the passphrase from source-code, and use system environment variables or a restricted configuration file.
Context: receive(:safe_popen_read)
.with("git", "-C", repository, "diff", "--no-ext-diff", "--unified=0",
"origin/HEAD", "HEAD", "--", current.path.relative_path_from(repository).to_s)
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures
(hardcoded-secret-rsa-passphrase-ruby)
[warning] 436-439: Found the use of an hardcoded passphrase for RSA. The passphrase can be easily discovered, and therefore should not be stored in source-code. It is recommended to remove the passphrase from source-code, and use system environment variables or a restricted configuration file.
Context: allow(Utils).to receive(:safe_popen_read)
.with("git", "-C", repository, "diff", "--no-ext-diff", "--unified=0",
"origin/HEAD", "HEAD", "--", current.path.relative_path_from(repository).to_s)
.and_return <<~DIFF
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures
(hardcoded-secret-rsa-passphrase-ruby)
[warning] 436-438: Found the use of an hardcoded passphrase for RSA. The passphrase can be easily discovered, and therefore should not be stored in source-code. It is recommended to remove the passphrase from source-code, and use system environment variables or a restricted configuration file.
Context: receive(:safe_popen_read)
.with("git", "-C", repository, "diff", "--no-ext-diff", "--unified=0",
"origin/HEAD", "HEAD", "--", current.path.relative_path_from(repository).to_s)
Note: [CWE-798]: Use of Hard-coded Credentials [OWASP A07:2021]: Identification and Authentication Failures
(hardcoded-secret-rsa-passphrase-ruby)
🔇 Additional comments (5)
Library/Homebrew/test_bot/formulae.rb (3)
582-582: Pass the dependency's own spec context when loading historical formulae.
recursive_runtime_dependency_namescallsdependency_impact_formulawithoutspec:, so every transitive dependency loads with the default:stablespec. The top-level formula, by contrast, usesformula.active_spec_sym. For a formula tested with HEAD or devel specs, the previous set comes from the formula's own active spec, but its dependencies come from:stable. The current side also resolves through:stableviaFormulary.factory(name, :stable). Both sides are consistent with each other, so this does not cause a false diff. The report can still describe a different graph than the one actually tested. This is low impact, and I am not raising it as a defect.
243-259: The size lookup uses current formulae for removed dependencies.
Formulary.factory(formula_name)resolves removed dependencies through the current tap. A removed dependency that was deleted in the PR raisesFormulaUnavailableError. The code then rescues the error and treats the size as unknown. The total becomes "unknown", and the tests expect that result. This matches the stated design.
43-43: LGTM!Also applies to: 225-241, 260-284, 545-571, 573-595
Library/Homebrew/test/test_bot/formulae_spec.rb (2)
161-167: This static-analysis hint is a false positive.The
hardcoded-secret-rsa-passphrase-rubyhints flag a git diff heredoc stub. The stub contains no credential. No change is needed.
94-122: LGTM!Also applies to: 168-184, 186-333, 335-453
brew test-bot's dependency impact annotation compared an added dependency only against the formula's other current dependencies, so replacingopenssl@3withopenssl@4was reported as two new recursive dependencies: the removedopenssl@3and theca-certificatesboth versions share weren't taken into account.It now compares the formula's recursive runtime dependencies at
origin/HEADandHEAD, loading formulae changed or deleted in the pull request fromorigin/HEAD, and writes one annotation listing added and removed dependencies with the net installed size change. A missing size for a removed dependency makes the change unknown and one for an added dependency gives a lower bound. An unchanged dependency set gets no annotation.Replaying Homebrew/homebrew-core#316286 (202 formulae moved to
openssl@4) on macOS, 199 formulae are now annotated withopenssl@4added andopenssl@3removed; previously 57 reported two new dependencies, two reported one and 143 reported nothing.brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?GPT-6 Astra drafted the implementation and tests and ran
brew lgtm --online. Claude Code (Opus 5.5) reviewed each revision, reproducing its findings in throwaway taps with real Git history, and replayed Homebrew/homebrew-core#316286 against the final version. I reviewed the diff.