fix(bzlmod): convert coverage_tool Label to string - #4157
Open
kocolosk wants to merge 2 commits into
Open
Conversation
The `coverage_tool` attr on `python.single_version_platform_override` is declared as `attr.label` (so bzlmod resolves the target relative to the calling module), but the value was passed through unchanged to `python_repository`, which declares `coverage_tool` as a string. This caused a type mismatch error at module-extension evaluation time whenever `coverage_tool` was set. Convert the Label to its canonical string form before storing it. Fixes bazel-contrib#2570.
There was a problem hiding this comment.
🟢 Approval recommended
Only minor formatting nits remain; the functional fix and regression coverage are complete.
Pull request overview
Fixes the bzlmod coverage_tool type mismatch by converting labels to canonical strings.
Changes:
- Convert
coverage_toollabels withstr(). - Add regression coverage.
- Add issue #2570 release notes.
File summaries
| File | Summary | Review comments |
|---|---|---|
tests/python/python_tests.bzl |
Tests label-to-string conversion. | Nit (1 vote): wrap the long assignment. |
python/private/python.bzl |
Converts coverage tool labels to strings. | No findings. |
news/2570.fixed.md |
Documents the bug fix. | Nit (2 votes): wrap the entry to 80 columns. |
Review details
Suppressed comments (1)
tests/python/python_tests.bzl:519
- This newly added assignment is longer than the repository's 100-character line limit from
.editorconfig. Please wrap the final index so the test follows the established Starlark formatting convention.
coverage_tool = py.config.default["tool_versions"]["3.13.99"]["coverage_tool"]["aarch64-unknown-linux-gnu"]
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
coverage_toolattribute onpython.single_version_platform_overrideis declared as a Label, but the value was passed through unchanged topython_repository, which declarescoverage_toolas a string. This caused a type mismatch error at module-extension evaluation time whenevercoverage_toolwas set.Convert the Label to its canonical string form before storing it. Fixes #2570.