[BUG] Version 11.2.6 does not detect --auto-load-params-from ...
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 89
- Forks
- 64
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
This is a real bug reported and seen by me (not a AI generated slop) in our Nix CI where we use codecov upload-coverage ....
This bug made me pin to 10.4.0 for a long time (with Nix) because the 11.2.6 does not work:
- The 10.4.0 binary does handle
--auto-load-params-from githubactionsfine. - The binary 11.2.6 does not, all loaded values are
null(same environment)
I used Claude Opus 4.8 debugging showed me that the problem seems to be in codecov click dependency.
Could somebody confirm that this is the root cause?
CodecovOption CI-adapter fallback broken with click ≥ 8.3 (--slug not auto-loaded → "The provided slug is invalid")
Root cause
click 8.3 introduced an UNSET sentinel: click.Parameter.get_default() now returns UNSET (not None) when an option has no explicit default.
CodecovOption.get_default in codecov_cli/fallbacks.py only guards against None:
def get_default(self, ctx, call=True):
res = super().get_default(ctx, call=call)
if res is not None: # UNSET is not None -> returns here
return res
if self.fallback_field is not None:
if ctx.obj.get("ci_adapter") is not None:
res = ctx.obj.get("ci_adapter").get_fallback_value(self.fallback_field)
...
Summary
The CI-adapter fallback for CodecovOption options no longer fires when running with click >= 8.3. As a result, upload-coverage (and the individual commands) ignore auto-loadable parameters such as the repo slug, even though --auto-load-params-from is passed and the CI env vars are present. With --slug unset, the upload fails with:
ValueError: The provided slug is invalid
File ".../codecov_cli/helpers/encoder.py", line 10, in encode_slug
raise ValueError("The provided slug is invalid")
Reproduction
In a GitHub Actions-like environment (GITHUB_ACTIONS=true, GITHUB_REPOSITORY=owner/repo set) run without --slug:
codecov --auto-load-params-from githubactions upload-coverage \
--network-root-folder . --flag myflag --disable-search \
--commit-sha <sha> --token <token> -f coverage.txt
The --dry-run debug log shows "slug": null even though GITHUB_REPOSITORY is set and readable.
Expected vs actual
- Expected: slug is auto-loaded from the GitHub Actions adapter (
GITHUB_REPOSITORY), as it was with click 8.2.x. - Actual: slug stays
None;encode_slug(None)raises "The provided slug is invalid".
Because super().get_default() now returns UNSET (truthy, not None), the method returns early and the CI-adapter / versioning-system fallback below becomes dead code.
Confirmed by introspection under click 8.3.1:
adapter.get_fallback_value(FallbackFieldEnum.slug)→'owner/repo'(adapter works)slug_option.get_default(ctx)→Sentinel.UNSET(fallback skipped)
Any CodecovOption field with no explicit default that relies on the fallback is affected (slug, git-service, etc.). --commit-sha masks the issue when passed explicitly.
Suggested fix
Treat click's UNSET sentinel as "no value" in the override, e.g.:
try:
from click.core import UNSET # click >= 8.3
except ImportError:
UNSET = None
def get_default(self, ctx, call=True):
res = super().get_default(ctx, call=call)
if res is not None and res is not UNSET:
return res
...
return None # normalize UNSET -> None on the fallback miss path too
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in codecov_cli/fallbacks.py at CodecovOption.get_default and inspect how click 8.3.1's UNSET is handled. Reproduce with the provided GitHub Actions-like environment and upload-coverage command, then verify that an omitted --slug is loaded from GITHUB_REPOSITORY instead of producing null and the invalid-slug error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, python
- Domain
- ci-cd, cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100