Skip to content

Commit 22e0ca5

Browse files
committed
fix(v2): relative symbol_table keys under --ray; restore bare test sibling imports
- core.py: key Ray module_map by path relative to project_dir (was absolute), matching serial/single-file paths so can:// ids and cache lookups are portable - delete test/__init__.py so pytest re-adds test/ to sys.path for bare sibling imports (from sample_graph_app import ...) - test_v2_conformance.py: import conftest_v2 bare, matching repo convention - conftest_v2.py: guard node kind access with .get("kind")
1 parent aa543fd commit 22e0ca5

4 files changed

Lines changed: 3 additions & 3 deletions

File tree

codeanalyzer/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def _process_file_with_ray(py_file: Union[Path, str], project_dir: Union[Path, s
5050
try:
5151
py_file = Path(py_file)
5252
symbol_table_builder = SymbolTableBuilder(project_dir, virtualenv)
53-
module_map[str(py_file)] = symbol_table_builder.build_pymodule_from_file(py_file)
53+
module_map[str(py_file.relative_to(Path(project_dir)))] = symbol_table_builder.build_pymodule_from_file(py_file)
5454
except Exception as e:
5555
console.log(f"❌ Failed to process {py_file}: {e}")
5656
raise SymbolTableBuilderRayError(f"Ray processing error for {py_file}: {e}")

test/__init__.py

Whitespace-only changes.

test/conftest_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def assert_conformant(payload: dict, max_level: int) -> None:
4343
text = mod["source"].encode("utf-8")[lo:hi].decode("utf-8")
4444
assert text.lstrip().startswith(("def ", "async def ", "@")), f"{c['id']} span mismatch"
4545
for node in c.get("body", {}).values():
46-
if node["kind"] == "call" and max_level >= 2:
46+
if node.get("kind") == "call" and max_level >= 2:
4747
assert node.get("callee") is None or isinstance(node["callee"], str)
4848
for mod, c in _iter_callables(app):
4949
node_ids = set(c.get("body", {}).keys())

test/test_v2_conformance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_cli_emits_v2_envelope(tmp_path: Path):
3636

3737

3838
def test_l1_output_is_conformant(tmp_path: Path):
39-
from test.conftest_v2 import assert_conformant
39+
from conftest_v2 import assert_conformant
4040
proj = tmp_path / "proj"; proj.mkdir()
4141
(proj / "pkg").mkdir()
4242
(proj / "pkg" / "m.py").write_text("def f(a):\n return a\n", encoding="utf-8")

0 commit comments

Comments
 (0)