Skip to content

Add missing pyrefly suppressions to fix main CI - #1757

Closed
kartik1pandey wants to merge 1 commit into
google-deepmind:mainfrom
kartik1pandey:fix-pyrefly-ci-errors
Closed

Add missing pyrefly suppressions to fix main CI#1757
kartik1pandey wants to merge 1 commit into
google-deepmind:mainfrom
kartik1pandey:fix-pyrefly-ci-errors

Conversation

@kartik1pandey

Copy link
Copy Markdown

Fixes #1756.

Summary

pyrefly check fails on main with 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 from pytype to pyrefly (#1674) or after a subsequent JAX typing change (cf. 0f6d10b).

Changes

  • linear_algebra.py: suppress missing-attribute on old_mat_h.dtype — identical pattern to the line immediately below it, which already has this suppression.
  • linesearch.py: suppress unsupported-operation on decrease_error > atoldecrease_error is typed as ArrayLike (includes complex), but is only ever assigned real values.
  • _make_pert.py: suppress bad-argument-type on baseline passed to vmapbaseline can be None, but is only read inside an if use_baseline: guard, so the None is never dereferenced.
  • projections.py: suppress bad-argument-type on unravel_fn(new_values)new_values is always a jax.Array at runtime; the union with ndarray comes from ArrayLike's breadth.

Verification

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.
@kartik1pandey

Copy link
Copy Markdown
Author

Closing this as superseded — the pyrefly failures this PR targets were independently fixed on main in d01841f ("Fix pyrefly type-check failures in the OSS CI"), which covers all 4 files touched here (and in two cases with a proper type fix rather than a suppression). No remaining diff to contribute.

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.

main CI failing on pyrefly type-check (4 pre-existing errors, unrelated to any specific PR)

1 participant