Skip to content

fix(bzlmod): convert coverage_tool Label to string - #4157

Open
kocolosk wants to merge 2 commits into
bazel-contrib:mainfrom
kocolosk:fix/coverage-tool-label-type-mismatch
Open

fix(bzlmod): convert coverage_tool Label to string#4157
kocolosk wants to merge 2 commits into
bazel-contrib:mainfrom
kocolosk:fix/coverage-tool-label-type-mismatch

Conversation

@kocolosk

@kocolosk kocolosk commented Sep 9, 2026

Copy link
Copy Markdown

The coverage_tool attribute on python.single_version_platform_override is declared as a Label, 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 #2570.

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.
Copilot AI lite review requested due to automatic review settings September 9, 2026 20:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 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_tool labels with str().
  • 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.

Comment thread news/2570.fixed.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

Miss match between coverage tool attribute type between single_version_platform_override and python_repository

2 participants