Skip to content

Isolate Bootsnap caches across gem changes - #24206

Merged
MikeMcQuaid merged 1 commit into
Homebrew:mainfrom
SSakutaro:bootsnap-gem-cache-generation
Oct 9, 2026
Merged

MikeMcQuaid merged 1 commit into
Homebrew:mainfrom
SSakutaro:bootsnap-gem-cache-generation

Conversation

@SSakutaro

Copy link
Copy Markdown
Contributor

  • 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.

Used OpenAI GPT-6 (Codex) to investigate and implement the fix.
Reviewed the changes and manually verified.


Addresses the JSON::Ext::Generator::GeneratorMethods errors in https://github.com/Homebrew/homebrew-cask/actions/runs/37932093336.

Include all installed gems in the Bootsnap cache key to prevent stale parent processes from overwriting caches after gem installation. This also rotates compile caches when optional gems change.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dfd24c23-49c7-468a-937c-a1bf21bf4c01

📥 Commits

Reviewing files that changed from the base of the PR and between 59febf9 and c1df963.


📒 Files selected for processing (2)
  • Library/Homebrew/startup/bootsnap.rb
  • Library/Homebrew/test/startup/bootsnap_spec.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.


📜 Recent review details
⏰ Context from checks skipped due to timeout. (19)
  • GitHub Check: upload_sarif
  • GitHub Check: docker (x86_64 Ubuntu 26.04)
  • GitHub Check: docker (x86_64 Ubuntu 24.04)
  • GitHub Check: docker (arm64 Ubuntu 26.04)
  • GitHub Check: docker (arm64 Ubuntu 24.04)
  • GitHub Check: tests (online, 1/2)
  • GitHub Check: tests (no Sorbet)
  • GitHub Check: tests (generic OS, 2/2)
  • GitHub Check: tests (Linux, 2/2)
  • GitHub Check: tests (Linux, 1/2)
  • GitHub Check: tests (macOS, 2/2)
  • GitHub Check: tests (macOS, 1/2)
  • GitHub Check: tests (online, 2/2)
  • GitHub Check: tests (load-only macOS)
  • GitHub Check: tests (load-only Linux)
  • GitHub Check: tests (generic OS, 1/2)
  • GitHub Check: syntax
  • GitHub Check: docs
  • GitHub Check: Analyze



📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Bootsnap now detects changes across all installed gems when determining whether its cache is current. Adding or updating a gem will trigger cache invalidation, helping prevent stale cached data from affecting application startup.

Walkthrough

Bootsnap now includes every installed gem directory in its cache key. Comments describe the default Bundler group and gem-load-path invalidation. The key spec checks changes to installed gem directories and the Sorbet runtime version.

Changes

Bootsnap cache key

Layer / File(s) Summary
Cache key and validation
Library/Homebrew/startup/bootsnap.rb, Library/Homebrew/test/startup/bootsnap_spec.rb
The key now hashes all installed gem directory names. Comments describe the related Bundler and gem-load-path behavior. The spec checks that adding a gem or changing the Sorbet runtime version changes the key.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: mikemcquaid


Merge Risk

Merge Risk: ⚪ Minimal · up to c1df9

Cache identities now track installed gem changes, and stale load-path state is invalidated. No material merge risk remains.

Security Architecture Review

Security architecture risk: 🔵 Low · up to c1df9

Gem changes now select separate caches, reducing interference between older and newer commands. No expanded privileges were identified. Cleanup during concurrent command execution remains insufficiently validated.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — The inspected change affects cache files under the configured Homebrew cache root. Additional directory names influence a hexadecimal hash, rather than becoming raw path components or new executable inputs.

Trust Boundaries and Controls

  • observed — Environment-selected Bootsnap loading, enablement controls, and cache-root selection are unchanged by the PR. The broader hash input does not add a require target, credential source, or filesystem authority.

Resilience and Maintainability Implications

  • inferred — Cleanup's inspected deletion path has no active-reader ownership check, so an older process's generation can be removed after an optional-gem change. Whether the cache consumer safely tolerates that deletion remains unresolved; this is not an established security vulnerability. Non-atomic marker replacement also predates the PR.



🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: isolating Bootsnap caches when installed gems change.
Description check Passed The description explains the cache-key change, the stale-cache error it addresses, the expected behavior, and the verification performed.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@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 enabled auto-merge October 9, 2026 15:31
@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Oct 9, 2026
Merged via the queue into Homebrew:main with commit 7a8f775 Oct 9, 2026
53 checks passed
@SSakutaro
SSakutaro deleted the bootsnap-gem-cache-generation branch October 9, 2026 23:52
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

⌂ 换网址