Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/type_check_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _to_relative(raw: str, root: Path) -> str | None:
path = Path(raw)
absolute = path if path.is_absolute() else root / path
try:
return absolute.resolve().relative_to(root).as_posix()
return absolute.resolve().relative_to(root.resolve()).as_posix()
except ValueError:
return None

Expand Down
15 changes: 15 additions & 0 deletions tests/test_litellm/test_type_check_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@ def test_paths_outside_repo_are_skipped():
assert gate.count_basedpyright(payload) == {}


def test_symlinked_root_keeps_diagnostics_in_tree(tmp_path):
real = tmp_path / "real"
real.mkdir()
link = tmp_path / "link"
link.symlink_to(real)
payload = json.dumps(
{
"generalDiagnostics": [
_bpr(link / "litellm" / "x.py", "error", "reportArgumentType")
]
}
)
assert gate.count_basedpyright(payload, root=link) == {"reportArgumentType": 1}


def test_at_or_under_ceiling_passes():
budget = {"no-any-return": {"limit": 5}}
assert gate.evaluate({"no-any-return": 5}, {}, budget) == []
Expand Down
Loading