Skip to content

Fix | ExitError: keep the per-instance exit code with newer click types - #372

Merged
diego-ojeda-binbash merged 1 commit into
masterfrom
fix/exit-error-click-types
Nov 15, 2026
Merged

diego-ojeda-binbash merged 1 commit into
masterfrom
fix/exit-error-click-types

Conversation

@diego-ojeda-binbash

Copy link
Copy Markdown
Contributor

What?

One line in leverage/_utils.py: ExitError.__init__ keeps setting self.exit_code, now with # type: ignore[misc, unused-ignore] and a comment.

Why?

The Dependabot runtime group (#365) moves click from 8.0.1 to 8.5.1. click 8.5 declares ClickException.exit_code as a class variable, so mypy fails with "Cannot assign to class variable "exit_code" via instance".

At runtime nothing changes: click reads exit_code from the instance when it exits, which is how each ExitError gets its own code (40, 50, …). The tests assert those codes.

unused-ignore makes the same line pass on click 8.0.1 too, where the ignore isn't needed and warn_unused_ignores would flag it. So this goes in first, and #365 can be recreated on top without a hand-made commit.

Testing

After merging: @dependabot recreate on #365. It has a conflict in poetry.lock and an extra commit from me with the same fix, which this replaces.

🤖 Generated with Claude Code

click 8.5 declares ClickException.exit_code as a class variable, so mypy
rejects setting it on the instance. click reads it from the instance when
exiting, which is how each ExitError gets its own code: keep it, with an
ignore that also passes on click 8.0 (unused-ignore). Unblocks the
Dependabot runtime group (#365).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@diego-ojeda-binbash diego-ojeda-binbash added the bug Something isn't working label Nov 15, 2026
@coderabbitai

coderabbitai Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 21 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a3722f54-cf5c-49b9-974a-f3c19dee2e90
Commits

Reviewing files that changed from the base of the PR and between 9fe4342 and 0c14725.

Files selected for processing: 1

  • leverage/_utils.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@diego-ojeda-binbash diego-ojeda-binbash self-assigned this Nov 15, 2026
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 43730699524

Coverage remained the same at 78.106%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: 1 of 1 lines across 1 file are fully covered (100%).
  • 1 coverage regression across 1 file.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
_utils.py 1 82.5%

Coverage Stats

Coverage Status
Relevant Lines: 4132
Covered Lines: 3344
Line Coverage: 80.93%
Relevant Branches: 1084
Covered Branches: 730
Branch Coverage: 67.34%
Branches in Coverage %: Yes
Coverage Strength: 0.81 hits per line

💛 - Coveralls

@diego-ojeda-binbash
diego-ojeda-binbash merged commit f4b7f88 into master Nov 15, 2026
25 of 26 checks passed
@diego-ojeda-binbash
diego-ojeda-binbash deleted the fix/exit-error-click-types branch November 15, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants