Repository navigation
ci: upgrade pyrefly to 1.4.0 and gate on a baseline file - #5298
Conversation
93db711 to
684dd48
Compare
eb7b20b to
ca79589
Compare
|
/ok to test ca79589 |
|
/ok to test ca79589 |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
One validation regression needs fixing: (C1) the new Pyrefly root list drops the previously checked Docker cache-pruning script.
I inspected all 13 changed files and the affected hook and CI paths. One parallel report was unavailable, so I covered its suppression and documentation changes directly.
This was a static review. I did not run lint, Pyrefly or tests, and CI results were not supplied. Baseline compatibility between aarch64 and x86_64 is unverified.
Generated by Codex
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex. This was a full review. Request a full review with /review reset=true.
|
/ok to test cb1ae0f |
|
/review reset=true |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
LGTM. I found no qualifying findings after reviewing all 24 changed files and their directly affected paths with three parallel reviewers.
The previous Docker coverage finding is fixed. The current root list includes docker/*.py, covering the cache-pruning script.
This was a static review. I did not run lint, Pyrefly or tests, and CI results were not supplied. Diagnostic matching on x86_64 for the aarch64-generated baseline is still unverified.
Generated by Codex
Review generated by codex. This was a full review. Request a full review with /review reset=true.
|
/ok to test 741a817 |
741a817 to
a48fc3a
Compare
|
/ok to test a48fc3a |
Pin pyrefly 1.4.0 and replace the per-file allow-list in pyrefly.toml, and the CI step that kept it complete, with pyrefly's baseline file. Every file under nemo_rl, examples, docs and tools is now checked, and the check fails only on errors that are not recorded in pyrefly-baseline.json. The baseline holds the 1,610 errors that exist today. Five suppression comments are renamed to the error codes 1.4.0 uses. This revives the approach of #3080 on current main. Co-Authored-By: Claude Fable 5.2 <[email protected]> Signed-off-by: Robin Nabel <[email protected]>
The allow-list on main includes docker/prune_uv_cache.py, which none of the four globs match, so the file would have dropped out of type checking. Add docker/*.py to project-includes. The file is clean under pyrefly 1.4.0, so the baseline is unchanged. Co-Authored-By: Claude Fable 5.2 <[email protected]> Signed-off-by: Robin Nabel <[email protected]>
Signed-off-by: Robin Nabel <[email protected]> Co-authored-by: Claude Fable 5.2 <[email protected]>
6e805bc to
13d40e8
Compare
Signed-off-by: Robin Nabel <[email protected]>
Pyrefly's default baseline mode matches on path, error kind and column only, so one recorded entry hid every new error of that kind at that column in the file. "column-ordered" also counts the entries, and a key that shows up more often than recorded is reported. Regenerate pyrefly-baseline.json in this mode. It now holds one row per flagged source range: 1,303 rows for the same 1,457 errors. Co-Authored-By: Claude Fable 5.2 <[email protected]> Signed-off-by: Robin Nabel <[email protected]>
…utor notes The review skill still asked reviewers to flag new files missing from project-includes, which no longer exists as an allow-list. It now asks them to flag new entries in pyrefly-baseline.json. The note about the removed CI step is in the past tense, and the contributor note lists docker/*.py among the checked paths. Co-Authored-By: Claude Fable 5.2 <[email protected]> Signed-off-by: Robin Nabel <[email protected]>
|
/ok to test 8aa1cdd |
Signed-off-by: Robin Nabel <[email protected]> # Conflicts: # pyrefly.toml
Three changes merged to main after the baseline was written add one error each that Pyrefly 1.4.0 reports: an index on a possibly-None value in grpo_sync.py, a possibly-unbound name in rollout_checkpointing/restore.py, and an index on object in megatron_policy_worker.py. Record them so the gate starts from main's current state. Co-Authored-By: Claude Fable 5.2 <[email protected]> Signed-off-by: Robin Nabel <[email protected]>
|
/ok to test a061c0e |
|
/resolve-conflict |
Conflict in pyrefly.toml: main added a file to the old whitelist; the glob in project-includes already covers it. Co-Authored-By: Claude Fable 5.2 <[email protected]> Signed-off-by: Robin Nabel <[email protected]>
|
/ok to test 8d17dd0 |
…ting Resolve one conflict with NVIDIA-NeMo#5298 in pyrefly.toml: take main's globbed project-includes, which cover nemo_gym_multi_harness.py. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Zeyu Zhou <[email protected]>
…ig for pyrefly Main now gates lint on pyrefly 1.4.0 with a baseline (NVIDIA-NeMo#5298), and the full-batch train path tripped two new errors: automodel_cfg is a union with the disabled variant, so .get() returned object and could not be used in a modulo against the typed microbatch index; and get_microbatch_iterator takes dict[str, Any], which PolicyConfig is not. Cast to AutomodelConfig, which the full-batch path already requires, and cast the policy config at the call like the existing generation-config precedent in this file. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Shuang Yu <[email protected]>
…ig for pyrefly Main now gates lint on pyrefly 1.4.0 with a baseline (NVIDIA-NeMo#5298), and the full-batch train path tripped two new errors: automodel_cfg is a union with the disabled variant, so .get() returned object and could not be used in a modulo against the typed microbatch index; and get_microbatch_iterator takes dict[str, Any], which PolicyConfig is not. Cast to AutomodelConfig, which the full-batch path already requires, and cast the policy config at the call like the existing generation-config precedent in this file. Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Shuang Yu <[email protected]>
What does this PR do ?
Upgrades the pinned type checker from Pyrefly 0.24.2 to 1.4.0 and replaces the per-file allow-list with Pyrefly's baseline file, so every file is type-checked and only new errors fail.
Issues
Revives the approach of #3080 on current
main, moved from 1.1.1 to 1.4.0. Follows #5296. Includes #5305 and #5306, which were merged into this branch.Usage
Before your PR is "Ready for review"
Pre checks:
Additional Information
Why upgrade
matchclass patterns, somatchwithassert_neveris reported as an error. 1.4.0 handles it.no-matching-overloaderrors onpydantic.Field(default=..., ge=...). 1.4.0 does not.Changes
pyproject.tomlanduv.lock:pyrefly==1.4.0. The lock diff is the Pyrefly entry only.pyrefly.toml:project-includesis five globs (nemo_rl,examples,docs,tools, anddocker/*.pyso thatdocker/prune_uv_cache.py, which is on today's allow-list, stays checked) and the explicit allow-list is gone. The globs also cover the 33 files directly underexamples/, which the old CI step'sgit ls-files 'examples/**/*.py'never matched.baseline = "pyrefly-baseline.json"andbaseline-matching-mode = "column-ordered"are set here.pyrefly-baseline.json: the 1,460 existing errors across 132 files, written bypyrefly check --update-baselineas 1,306 rows, one per flagged source range. Entries match on path, error kind and column, not on line number or message.column-orderedalso counts them, so a key that shows up more often than recorded is reported.modelopt,sglang,sglang_router,transformer_engine,nvidia_resiliency_ext,fla,sentence_transformers,myst_parser) are added toreplace-imports-with-any, which removes theirmissing-importerrors from the baseline.MasterConfig.model_validate(config)instead ofMasterConfig(**config), which removes 114 errors from the baseline. Five test files are updated to match.import-errortomissing-importfour times,typed-dict-key-errortobad-typed-dict-keyonce).skills/: the contributor and reviewer notes that described the allow-list now describe the baseline. Reviewers are asked to flag new entries inpyrefly-baseline.jsoninstead of files missing fromproject-includes.The only runtime change is the
MasterConfig.model_validatecall in the example entry points.Differences from #3080
pyrefly.toml, not passed as--baselinein the pre-commit hook, so a plainpyrefly checkand editor integrations use it too. The hook entry is unchanged.Please check
--error-stale-baselinein the hook would enforce pruning; I left it out to avoid baseline conflicts between PRs.ignore[implicitly-defined-attribute]comments no longer suppress anything, because 1.4.0 does not report that kind. They are left in place to keep this diff small.Testing
Run in a Linux container with the locked environment, CPU only:
pre-commit run --all-files: every hook passes, includingpyrefly checkat 1.4.0.bad-argument-typeerror innemo_rl/algorithms/grpo.py, at a column where the file already has a baselined error of that kind, is reported withcolumn-orderedand hidden in the default mode.--error-stale-baselineon the fresh baseline reports nothing.model_validatecall, which the existing entry-point tests cover. GPU and functional tests were not run locally.🤖 Generated with Claude Code