CI: use `pyrefly coverage` instead of `basedpyright --verifytypes` #890
All Vouch review confidence checks passed
Residual risk 0.11 = Change Risk (0.30) × (1 − Review Confidence (0.64)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.30 · 12 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.54 · 2 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.153
Rapid Merge
rapid_merge
0.100
jorenham
samwgoldman
Pyrefly already runs in the
typecheckjob, so this switches the public-API type-completeness gate in thelintjob (and thepyright-verifytox env, nowpyrefly-coverage) frombasedpyright --ignoreexternal --verifytypes optypetopyrefly coverage check --public-only optype. numpy, scipy-stubs, and pandas-stubs already use the same gate.On
masterboth tools report 100% (pyrefly: 779 of 779 typable symbols). The coverage is the same with numpy 2.0 and 2.5 installed.Passing
optypeexplicitly matters. Without it, project mode also countstests/andexamples/and reports 98.71%.Mutation testing
To check that the new gate is at least as strict, I applied one regression at a time to
optype/inspect.py, exporting new symbols through__all__where needed. I ran both tools on each, then restored the file:| Regression |
basedpyright --verifytypes|pyrefly coverage --public-only||---|---|---|
| Drop a return annotation | fail | fail |
| Drop a parameter annotation | fail | fail |
| Unannotated method parameter on a public class | fail | fail |
| Public constant assigned from an
Any-returning call (json.loads(...)) | pass | fail || Explicit
-> Anyreturn | pass | pass || Unannotated but inferable constant (
X = 1,X = [1, 2]) | pass | pass || Unannotated but inferable class attribute | pass | pass |
| Public alias of an unresolved import | pass | pass |
| Untyped private helper (should pass) | pass | pass |
Pyrefly caught every regression that
--verifytypescaught. It also caught a public symbol that silently resolves toAny, which--verifytypesmisses.Speed
Measured locally, with the same machine and environment:
basedpyright --ignoreexternal --verifytypes optype: about 1.45 spyrefly coverage check --public-only optype: about 0.20 sThat is roughly 7x faster, measured across 11 runs of each.
Why not
--strict--strictalso countsAny-resolved annotations as untyped. It would catch the explicit-> Anycase above, but today it reports 99.49% (775/779). The only findings are the two__replace__methods inoptype/copy.py:Both use
_: Any, *changes: Anyon purpose, as theCanReplacedocstring explains. So--strictwould need either a brittle--fail-under=99.4threshold or a way to exempt those two signatures. I left it out of this PR.Unrelated finding
Without
--public-only, pyrefly flags one untyped symbol in a private module:optype.infer._signature.signature(optype/infer/_signature.py:28). The public gate doesn't count it, but it might be worth annotating.