fix(crawler): relocate pixelrag receipt file paths
Some checks failed
CD Pipeline / deploy (push) Has been cancelled

This commit is contained in:
ogt
2026-07-09 17:47:29 +08:00
parent 157f3e8106
commit 28beab0df7
2 changed files with 50 additions and 1 deletions

View File

@@ -538,6 +538,32 @@ def _receipt_candidates(
return sorted(search_root.glob(pattern), key=lambda path: path.stat().st_mtime, reverse=True)
def _portable_receipt_file_path(receipt_path: Path, raw_path: Any, kind: Any) -> Path:
path = Path(str(raw_path or ""))
if path.exists():
return path
receipt_dir = receipt_path.parent
basename = path.name
if not basename:
return path
if kind == "tile":
tile_path = receipt_dir / "tiles" / basename
if tile_path.exists():
return tile_path
sibling_path = receipt_dir / basename
if sibling_path.exists():
return sibling_path
parts = path.parts
if receipt_dir.name in parts:
index = parts.index(receipt_dir.name)
suffix = parts[index + 1:]
if suffix:
relocated = receipt_dir.joinpath(*suffix)
if relocated.exists():
return relocated
return path
def build_pixelrag_visual_evidence_readback(
*,
artifact_root: str | Path | None = None,
@@ -594,7 +620,7 @@ def build_pixelrag_visual_evidence_readback(
missing_file_count = 0
tile_file_count = 0
for item in files:
path = Path(str(item.get("path") or ""))
path = _portable_receipt_file_path(latest_path, item.get("path"), item.get("kind"))
exists = path.exists()
if not exists:
missing_file_count += 1