fix(parser): guard against tree-sitter-python infinite recursion on missing colon
Summary
- tree-sitter-python 0.25.0 enters infinite C-level recursion during error recovery when parsing
def name(args)orclass name(args)without a trailing colon - The recursion is within a single C parse step, so no Rust stack guard, progress callback, or timeout can stop it
- Detect the pattern before parsing and skip the file with an error
- Discovered while benchmarking against the VSCode repo (14K+ files) --
extensions/copilot/test/scenarios/test-cli/wkspc1/demo.py(19 lines) crashes the process
Test plan
-
test_python_missing_colon_detected-- verifies detection of the pattern -
test_python_missing_colon_skipped_by_parser-- verifies the parser rejects the file - All 347 parser tests pass
- VSCode repo (10K+ files) indexes without crash
Closes #449 (closed)