Check that public functions and classes have outside callers - #229
Merged
Conversation
The architecture test checked module-level constants only, so a function or class whose last caller outside its module went away kept claiming callers it no longer had. It now covers functions and classes too, bar the names nothing calls: a class a framework discovers by scanning, and the function behind a module's `if __name__ == "__main__"` guard. The 48 names it reported across `src`, `tests`, and `tools` are private now. `CacheClearingTestCase` also stopped listing the caches it clears; it walks the package and clears every `@cache` it finds. The visibility check moved to `test_visibility.py`, since it reads what modules expose rather than how they depend on one another. `just rename` renames a module-level name and every reference to it, through LibCST's `RenameCommand`, which resolves the name against each module's scopes: the same word in a docstring, a help string, or an f-string is left alone, and so is a parameter or a local of that name. LibCST counts the files it read rather than the ones it rewrote and exits 0 whether it found the name or not, so the recipe compares the files and fails when nothing changed. CLAUDE.md now sends a rename there rather than to a substitution.
fniessink
force-pushed
the
check-public-private
branch
from
August 11, 2026 15:25
847d54f to
c3dd4f6
Compare
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.
The architecture test checked module-level constants only, so a function or class whose last caller outside its module went away kept claiming callers it no longer had. It now covers functions and classes too, bar the names nothing calls: a class a framework discovers by scanning, and the function behind a module's
if __name__ == "__main__"guard. The 48 names it reported acrosssrc,tests, andtoolsare private now.CacheClearingTestCasealso stopped listing the caches it clears; it walks the package and clears every@cacheit finds. The visibility check moved totest_visibility.py, since it reads what modules expose rather than how they depend on one another.