Skip to content

Embed executables in API JSON#22301

Merged
MikeMcQuaid merged 1 commit into
mainfrom
embed-executables-api-json
May 17, 2026
Merged

Embed executables in API JSON#22301
MikeMcQuaid merged 1 commit into
mainfrom
embed-executables-api-json

Conversation

@MikeMcQuaid

Copy link
Copy Markdown
Member
  • Avoid fetching executables.txt as a separate API artefact.
  • Keep which-formula data generated from active formula JSON.
  • Let internal API packages carry executable metadata.

  • 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? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes. Non-maintainers may only have one AI-assisted/generated PR open at a time.

OpenAI Codex 5.5 xhigh with local review, tweaks and testing.


Copilot AI review requested due to automatic review settings May 16, 2026 12:58

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.

Pull request overview

Removes the dedicated internal/executables.txt download path and instead embeds per-formula executable lists in the formula/internal API JSON. The client-side cache file is regenerated from that JSON whenever update-report writes name/alias lookups, and brew which-formula/brew exec rely on brew update --auto-update to refresh it rather than performing their own curl.

Changes:

  • Add executables to FormulaStruct and write it into per-formula JSON and internal packages.<tag>.json from ExecutablesDB data committed in the tap.
  • Add Homebrew::API.write_executables_file! and call it from API::Formula.write_names_and_aliases / API::Internal.write_formula_names_and_aliases to regenerate internal/executables.txt from JSON.
  • Drop the dedicated curl + homebrew.commandnotfound fetch path from update.sh/which-formula.sh (now ensure_executables_file just relies on auto-update).

Reviewed changes

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

Show a summary per file
File Description
Library/Homebrew/api.rb New write_executables_file! writing internal/executables.txt from formula JSON.
Library/Homebrew/api/formula.rb Call write_executables_file! after writing formula names/aliases.
Library/Homebrew/api/internal.rb Same call from the internal-API path.
Library/Homebrew/api/formula_struct.rb Add executables field to FormulaStruct.
Library/Homebrew/dev-cmd/generate-formula-api.rb Load ExecutablesDB and inject executables into generated formula hashes.
Library/Homebrew/dev-cmd/generate-internal-api.rb Same injection for internal packages JSON.
Library/Homebrew/executables_db.rb New to_hash accessor for read-only consumers.
Library/Homebrew/cmd/update.sh Remove conditional fetch of internal/executables.txt.
Library/Homebrew/cmd/which-formula.sh Replace download_and_cache_executables_file with ensure_executables_file that triggers brew update --auto-update.
Library/Homebrew/cmd/exec.sh Update caller to ensure_executables_file.
Library/Homebrew/test/api/* Add coverage for executables field and write_executables_file!.
Library/Homebrew/test/dev-cmd/generate-*-api_spec.rb Verify generator embeds executables read from ExecutablesDB.

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

Comment thread Library/Homebrew/api.rb Outdated
Comment thread Library/Homebrew/cmd/update.sh Outdated
Comment thread Library/Homebrew/cmd/which-formula.sh Outdated
@MikeMcQuaid MikeMcQuaid force-pushed the embed-executables-api-json branch 4 times, most recently from ee2dc80 to 9d8a8d1 Compare May 16, 2026 15:57

@Rylan12 Rylan12 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.

Nice, I think this makes a lot of sense!

My main concern would be that we're introducing a circular dependency where generating the API depends on the API itself. I'm pretty sure we're not actually doing that here because the /api/internal/executables.txt file is actually sourced from GitHub packages, not any in-api state.

One question, but otherwise good to go assuming my analysis above is correct!

Comment thread Library/Homebrew/dev-cmd/generate-internal-api.rb Outdated
@MikeMcQuaid MikeMcQuaid changed the base branch from main to which-formula-install-status May 17, 2026 08:01
Base automatically changed from which-formula-install-status to main May 17, 2026 08:27
- Avoid fetching `executables.txt` as a separate API artefact.
- Populate generated JSON from GitHub Packages metadata.
- Keep `which-formula` data generated from active formula JSON.
- Fall back to GitHub Packages data during the JSON transition.
- Drop obsolete `--skip-update` command options.
- Keep stale `HOMEBREW_BOOTSNAP_GEM_PATH` from breaking coverage runs.
- Use the correct Linux mtime check for the executables database.

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.

Pull request overview

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

Files not reviewed (2)
  • Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/exec.rbi: Language not supported
  • Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/which_formula.rbi: Language not supported

Comment thread Library/Homebrew/utils/executables.sh
@MikeMcQuaid MikeMcQuaid enabled auto-merge May 17, 2026 09:18
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue May 17, 2026
@MikeMcQuaid MikeMcQuaid mentioned this pull request May 17, 2026
6 tasks
Merged via the queue into main with commit d3bee9e May 17, 2026
41 checks passed
@MikeMcQuaid MikeMcQuaid deleted the embed-executables-api-json branch May 17, 2026 09:42
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.

3 participants