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 requested a review from a team as a code owner December 15, 2025 10:57
@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 10:57
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 caused by the interaction between use_repo_rule and --inject_repository. The core of the change is a refactoring that introduces a getOrCreateExtensionUsageBuilder helper method in ModuleThreadContext. This centralizes the logic for creating or retrieving extension usage builders, eliminating code duplication and ensuring that builders for non-isolated extensions are correctly reused. The changes are clean, improve maintainability, and are accompanied by a valuable regression test to prevent this issue in the future. Overall, this is a solid improvement.

@Wyverald Wyverald enabled auto-merge December 15, 2025 10:58
@Wyverald Wyverald added this pull request to the merge queue Dec 15, 2025
Merged via the queue into bazelbuild:release-9.0.0 with commit 84912c8 Dec 15, 2025
46 checks passed
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Dec 15, 2025
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