Skip to content

Conversation

@bazel-io
Copy link
Member

Bazel crashes at HEAD when use_repo_rule is used with local_repository while also using --inject_repository.

Make bugs like this less likely by extracting out a safe "get or create" helper for extension usages.

Fixes #27953

Closes #27967.

PiperOrigin-RevId: 844683022
Change-Id: I1edcf1e7c72ef8d46c67e51b4f9ffd6a6ce82ec8

Commit 21d7fec

Bazel crashes at HEAD when `use_repo_rule` is used with `local_repository` while also using `--inject_repository`.

Make bugs like this less likely by extracting out a safe "get or create" helper for extension usages.

Fixes bazelbuild#27953

Closes bazelbuild#27967.

PiperOrigin-RevId: 844683022
Change-Id: I1edcf1e7c72ef8d46c67e51b4f9ffd6a6ce82ec8
@bazel-io bazel-io added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. awaiting-review PR is awaiting review from an assigned reviewer labels Dec 15, 2025
@bazel-io bazel-io requested a review from a team as a code owner December 15, 2025 21:09
@bazel-io bazel-io added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. awaiting-review PR is awaiting review from an assigned reviewer labels Dec 15, 2025
@bazel-io bazel-io requested a review from Wyverald December 15, 2025 21:09
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively resolves a crash that occurs when use_repo_rule is used with --inject_repository. The fix correctly identifies that duplicated logic for creating module extension usages was the root cause and introduces a centralized getOrCreateExtensionUsageBuilder helper method in ModuleThreadContext. This refactoring simplifies the code in ModuleFileFunction and ModuleFileGlobals, prevents the creation of duplicate extension builders, and improves overall maintainability. The addition of a regression test ensures this specific crash scenario is covered going forward. The changes are well-implemented and represent a solid improvement.

@Wyverald Wyverald enabled auto-merge December 15, 2025 21:15
@Wyverald Wyverald added this pull request to the merge queue Dec 15, 2025
Merged via the queue into bazelbuild:release-8.6.0 with commit 1c16fbf Dec 15, 2025
47 checks passed
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Dec 15, 2025
@Wyverald Wyverald deleted the cp27967-8.6.0 branch December 15, 2025 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants