merge queue: checking main (4299cdf), #677, #678 and #679 together - #686
Closed
mergify[bot] wants to merge 7 commits into
Closed
merge queue: checking main (4299cdf), #677, #678 and #679 together#686mergify[bot] wants to merge 7 commits into
mergify[bot] wants to merge 7 commits into
Conversation
`on.pull_request.branches` filters on the *base* branch, not the head. With it pinned to `main`, only a pull request merging directly into `main` ran CI -- every stacked pull request, whose base is the branch below it in the stack, got no test, lint or mypy run at all and showed nothing but the Mergify checks. Drop the filter so CI runs for every pull request regardless of base. Change-Id: I1c211a106a57b9f4986bec4b76c0680c1a0f1b61
`__radd__` was annotated `other: wait_base`, which is the one type it can never receive: `wait_base.__add__` always succeeds, so Python never falls back to the reflected operator for two wait strategies. The only caller is `sum()`, which seeds its accumulator with the int 0 — hence the `type: ignore[comparison-overlap]` on `other == 0`, and the dead `return self` branch behind it that `--warn-unreachable` flags. Annotate the parameter as `int` and return `NotImplemented` for a non-zero left operand, so `5 + wait_fixed(1)` raises `TypeError` at the addition rather than building a `wait_combine` that explodes later when called. With the signature corrected, mypy infers `sum([...])` over wait strategies on its own, so four `type: ignore[list-item]` comments in `test_wait_arbitrary_sum` are no longer needed. Change-Id: Iad1bcef4412d6afc1a6f1335970cfbfcc4a34fcb
`strict = true` is a curated subset, not every check mypy has. These five error codes and three flags are all off under `strict` and all report zero errors on the current tree, so turning them on costs nothing today and catches regressions from here on: - `warn_unreachable` -- dead branches, which are usually a wrong annotation rather than dead code (see the `wait_base.__radd__` fix below this commit) - `disallow_any_unimported` -- silent `Any` leaking in from untyped deps - `extra_checks` -- unsafely overlapping operator signatures, among others - `ignore-without-code` -- keeps `type: ignore` comments specific - `redundant-expr`, `truthy-iterable`, `unused-awaitable`, `exhaustive-match` Deliberately left off: `disallow_any_expr` (655 errors -- unusable for a decorator library) and `disallow_any_decorated` (63 errors, all inherent to `@retry` wrapping untyped test helpers). Change-Id: I9eee43a749050d2bcf0aa0abbedf8725301eba18
`truthy-bool` reports objects tested for truthiness that implement neither `__bool__` nor `__len__`, and so can only ever be true. Three sites: `BaseRetrying._run_wait` and `AsyncRetrying._run_wait` both guarded the wait call with `if self.wait:`. `wait` is typed `WaitBaseT` and defaults to a `wait_none()` instance, so it is never falsy and the `sleep = 0.0` branch has been dead since 17aefd9 -- a leftover from when the surrounding code still used `if self.after is not None:` style guards. Call `self.wait` unconditionally. `if tornado:` guarded the optional import in two places. mypy only ever sees the `try` branch, so it resolves the name to the module and reads the test as always-true. Compute `_HAS_TORNADO` once and branch on that instead; this also keeps `tornado.gen` fully typed, which annotating the name as `ModuleType | None` would have thrown away. Change-Id: Icb9981f6797707e070dc2423015f2fbf6c94e4c4
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.
🎉 This pull request has been checked successfully and will be merged soon. 🎉
Branch main (4299cdf), #677, #678 and #679 are queued together for merge.
This pull request has been created by Mergify to speculatively check the mergeability of #679.
You don't need to do anything. Mergify will close this pull request automatically when it is complete.
Required conditions of queue rule
defaultfor merge:depends-on = jd/tenacity#678[⛓️ chore(mypy): enable the strictness optionsstrictleaves off #678]github-review-approved[🛡 GitHub branch protection]Required conditions to stay in the queue:
check-success=test (3.10, check)check-success=test (3.11, check)check-success=test (3.12, check)check-success=test (3.13, check)check-success=test (3.14, check)check-success=test (3.14, lint)check-success=test (3.14, mypy)depends-on = jd/tenacity#678[⛓️ chore(mypy): enable the strictness optionsstrictleaves off #678]github-review-approved[🛡 GitHub branch protection]author = jd#approved-reviews-by >= 1author = dependabot[bot]