"""Phase 13 site 2: _chunk_code Result migration. Site 2 (BC at L224): the AST-aware chunking has a fallback to text chunking on any failure: try: parser = ASTParser('python') tree = parser.parse(content) ... return chunks except Exception: return self._chunk_text(content) Body: broad catch + fallback to a different implementation. Per Phase 11 anti-sliming, this is an empty-default fallback. Migrate to Result. """ import sys sys.path.insert(0, ".") def test_phase13_site2_chunk_code_result_exists(): import src.rag_engine assert hasattr(src.rag_engine.RAGEngine, "_chunk_code_result") or \ hasattr(src.rag_engine, "_chunk_code_result"), \ "_chunk_code_result helper missing" def test_phase13_site2_chunk_code_legacy_no_broad_except(): """Legacy _chunk_code must NOT have bare 'except Exception'.""" import inspect import src.rag_engine src_text = inspect.getsource(src.rag_engine.RAGEngine._chunk_code) assert "except Exception:" not in src_text, \ "_chunk_code legacy must not have bare 'except Exception'"