Add missing pyrefly suppressions to fix main CI - #1757
Open
kartik1pandey wants to merge 1 commit into
Open
Conversation
Four pre-existing pyrefly errors on main, each a type-stub precision gap rather than a real bug (verified by running the affected test suites): a while_loop carry variable typed as a union across all carry slots, ArrayLike including complex in a real-only comparison, a None baseline only read behind an if-guard, and ravel_pytree's unravel_fn return type. Fixes google-deepmind#1756.
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.
Fixes #1756.
Summary
pyrefly checkfails onmainwith 10 errors across 4 lines. Each is a pre-existing type-stub precision gap (not a real bug — confirmed by running the affected test suites), missed when this codebase migrated frompytypetopyrefly(#1674) or after a subsequent JAX typing change (cf.0f6d10b).Changes
linear_algebra.py: suppressmissing-attributeonold_mat_h.dtype— identical pattern to the line immediately below it, which already has this suppression.linesearch.py: suppressunsupported-operationondecrease_error > atol—decrease_erroris typed asArrayLike(includescomplex), but is only ever assigned real values._make_pert.py: suppressbad-argument-typeonbaselinepassed tovmap—baselinecan beNone, but is only read inside anif use_baseline:guard, so theNoneis never dereferenced.projections.py: suppressbad-argument-typeonunravel_fn(new_values)—new_valuesis always ajax.Arrayat runtime; the union withndarraycomes fromArrayLike's breadth.Verification
pyrefly check --python-interpreter-path <venv>: 0 errors (was 10; 482 suppressed vs. 472 before).pytest optax/_src/linesearch_test.py optax/perturbations/_make_pert_test.py optax/projections/_projections_test.py -q: 295 passed, 1 skipped.optax/_src/linear_algebra_test.py::test_matrix_inverse_pth_rootreproduced standalone (its module needsflax, unavailable in my sandbox): all condition-number cases pass with identical error values to the documented thresholds.