You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stop pr_review.py cleanup From Loading a Second Copy of the Gate #3461
scripts/pr_cleanup.py does import pr_review as core, and scripts/pr_review.py imports pr_cleanup for its cleanup subcommand. When the gate runs as a script it is __main__, so pr_review.py cleanup loads a second copy of the gate under the name pr_review. That copy holds its own module state: its memoized readers and every constant a test patches. Today control passes straight to pr_cleanup.main, so nothing reads both copies. A future path that sets state on one copy and reads it from the other would disagree silently.
Suggested Change
Move what pr_cleanup.py takes from the gate (in_scope, parsed_json, reread, utf8_console, UNSAFE_REF, DOT_SEGMENT) to a module both import, so neither imports the other. Alternatively, make cleanup a separate entry point that the gate does not import.
Done When
Running pr_review.py cleanup loads one copy of each module, and a test asserts that sys.modules holds no second pr_review after the subcommand dispatches.
Activity
Split pr_review.py's Check and Round Readers Into Leaf Modules (#3462)
Load One Copy of the Gate When pr_review.py Dispatches cleanup (#3481)