Split protected member diagnostics from no-access - #4537
Conversation
Map Pyright reportPrivateUsage to a dedicated error kind so disabling no-access no longer hides protected-member checks.
|
This pull request has been imported. If you are a Meta employee, you can view this in D115850858. (Because this pull request was imported automatically, there will not be any future comments.) |
|
The Meta Builds & Tests check is currently failing, but the internal failure details are not accessible to external contributors. The local formatter, Clippy, targeted regressions, and Pyrefly library suite passed. Could someone with access share the failing test or log snippet so I can address it? Thanks! |
|
Following up on the internal Builds & Tests failure — I think I've found a likely cause, so this may not need anyone to dig out the log.
Measured by checking polars 1.43.2's own source (207 files) as a project, building both sides from this checkout so the version is held constant:
Every other category is identical, so the 350 are entirely attributable to this change. They aren't false positives either — they're helper modules reaching into a sibling class, which is what the check is designed to catch: If a 200-file library produces 350 of these, a large internal codebase would produce far more, which would explain the failure without anything being wrong with the check itself. If that's right, the fix is to default it to The migration path would be unaffected: Happy to push that change. But the default severity of a new diagnostic is a product decision rather than mine to assume, so I'll wait for a maintainer to say which way you want it — and if the internal failure turns out to be something else, a log snippet would still be welcome. Disclosure, per the AI Usage section of CONTRIBUTING.md: the measurements above and this comment were produced by an AI agent (Claude Code) working in my checkout. I reviewed them before posting. |
Summary
private-usageerror kind for protected class membersno-accessreportPrivateUsagetoprivate-usageand document the new diagnosticRoot cause
The Pyright migration mapped
reportPrivateUsagetono-access, even thoughno-accessonly checked name-mangled double-underscore attributes. This made the migrated setting affect an unrelated diagnostic without enforcing protected-member access.User impact
Projects migrating from Pyright can configure protected-member checks independently. Disabling
no-accessno longer disablesreportPrivateUsagebehavior.Testing
cargo test protected_attributecargo test private_attributecargo test test_report_private_usage_mappingtest.pyFixes #3659