Skip to content

fix(gazelle): fix module map for old-style namespaces - #4135

Open
gholms wants to merge 1 commit into
bazel-contrib:mainfrom
gholms:gazelle-submodules
Open

fix(gazelle): fix module map for old-style namespaces#4135
gholms wants to merge 1 commit into
bazel-contrib:mainfrom
gholms:gazelle-submodules

Conversation

@gholms

@gholms gholms commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

The performance tweak in #3415 which parallelized gazelle module map generation calls simplify() on wheels individually, which always results in entries which collapse to the highest level modules which contain init.py files. But when two wheels do old-style namespace packages by both including that file under their top-level module, they simplify down to the top-level module, clobber each other when merged, and wind up with one wheel getting mapped for the entire namespace. This causes bug #3528.

We fix this by deferring our call to simplify() until after we've merged all the wheels' module info.

Fixes #3528

The performance tweak in bazel-contrib#3415 which parallelized gazelle module
map generation calls simplify() on wheels individually, which always
results in entries which collapse to the highest level modules which
contain __init__.py files.  But when two wheels do old-style namespace
packages by both including that file under their top-level module, they
simplify down to the top-level module, clobber each other when merged,
and wind up with one wheel getting mapped for the entire namespace.
This causes bug bazel-contrib#3528.

We fix this by deferring our call to simplify() until after we've merged
all the wheels' module info.

Fixes bazel-contrib#3528

@aignas aignas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I can see that this is just code move and it makes sense, please add news/4135.fixed.md file describing what is fixed. I am happy to backport it to the current dot release.

@aignas

aignas commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

/backport

@github-actions github-actions Bot mentioned this pull request Sep 1, 2026
7 tasks
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.

Wrong Gazelle mappings after upgrading to 1.8

2 participants