Skip to content

Commit 38fd43e

Browse files
committed
fix(evidence): resolve repo-relative suite case dirs
1 parent 1291572 commit 38fd43e

2 files changed

Lines changed: 43 additions & 1 deletion

File tree

src/roboharness/evidence/proof_pack.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,14 @@ def _suite_case_dir(suite_dir: Path, result: dict[str, Any]) -> Path:
905905
output_dir = result.get("output_dir")
906906
if isinstance(output_dir, str) and output_dir:
907907
path = Path(output_dir)
908-
return path if path.is_absolute() else suite_dir / path
908+
if path.is_absolute():
909+
return path
910+
if path.exists():
911+
return path
912+
suite_relative = suite_dir / path
913+
if suite_relative.exists():
914+
return suite_relative
915+
return path
909916
artifact_dir_name = result.get("artifact_dir_name")
910917
if isinstance(artifact_dir_name, str) and artifact_dir_name:
911918
return suite_dir / artifact_dir_name

tests/unit/evidence/test_proof_pack.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,41 @@ def test_build_suite_proof_pack_and_visual_review_queue_from_case_artifacts(
234234
assert queue_payload["total_items"] == 1
235235

236236

237+
def test_suite_proof_pack_accepts_repo_relative_case_output_dir(
238+
tmp_path: Path,
239+
monkeypatch: pytest.MonkeyPatch,
240+
) -> None:
241+
repo_root = tmp_path / "repo"
242+
suite_root = repo_root / "tmp" / "visual_harness" / "suite"
243+
case_dir = suite_root / "X36_Y28_Z13"
244+
_write_groot_case(case_dir)
245+
suite_report_path = suite_root / "suite_report_representative.json"
246+
_write_json(
247+
suite_report_path,
248+
{
249+
"suite_name": "representative",
250+
"output_root": suite_root.as_posix(),
251+
"results": [
252+
{
253+
"case_id": "X36_Y28_Z13",
254+
"output_dir": "tmp/visual_harness/suite/X36_Y28_Z13",
255+
"status": "pass",
256+
}
257+
],
258+
},
259+
)
260+
monkeypatch.chdir(repo_root)
261+
262+
suite_proof_pack = build_suite_proof_pack(suite_report_path)
263+
queue = build_visual_review_queue(suite_proof_pack)
264+
265+
assert suite_proof_pack.reviewable_count == 1
266+
assert suite_proof_pack.skipped_count == 0
267+
assert suite_proof_pack.cases[0].case_dir == "X36_Y28_Z13"
268+
assert suite_proof_pack.cases[0].proof_pack_path == "X36_Y28_Z13/proof_pack.json"
269+
assert len(queue.items) == 1
270+
271+
237272
def test_suite_proof_pack_skips_execution_errors(tmp_path: Path) -> None:
238273
suite_report_path = tmp_path / "suite_report_representative.json"
239274
_write_json(

0 commit comments

Comments
 (0)