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
feat(pycg): bound the fixpoint with --pycg-max-iter; stop following in-tree deps
Two robustness fixes for level-2 PyCG, motivated by odoo divergence analysis.
1. max_iter cap (--pycg-max-iter, default 50). PyCG runs its PostProcessor
fixpoint with max_iter=-1 (until convergence). Its abstract domain is
field-sensitive access paths with no k-limiting/widening, so on heavy
metaclass/mixin code the def set balloons (measured: 23 odoo ORM files ->
7.3k defs pass 0, 8.4k pass 1) and convergence may need many O(defs^2)
passes. Capping passes returns a sound-but-incomplete graph and guarantees
termination even with --pycg-shard-timeout 0 (which previously hung forever
on a single diverging shard). Threaded through _run_pycg_batch and the Ray
worker. Note: the wall-clock timeout is still the guard for shards whose
individual passes exceed it.
2. Dependency exclusion. PyCG bounds analysis to its package dir via
"if mod_dir not in mod.__file__". The whole-project path used
package=project_dir, but an in-tree .codeanalyzer venv / site-packages
lives under project_dir, so PyCG followed imports into dependencies and
exploded. Run the whole-project path inside a symlink mini-project (as the
shards already do) whose root mirrors only the SKIP_DIRS-filtered source,
so deps resolve outside mod_dir and stay ghost nodes.
Add test/test_pycg_sharding.py (max_iter threading; in-tree dep stays a ghost
and its internals are never analysed).
0 commit comments