feat(crawler): add python pixelrag capture worker
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
This commit is contained in:
@@ -302,3 +302,40 @@ def test_pixelrag_capture_worker_rejects_wrong_platform_host(tmp_path):
|
||||
payload = json.loads(completed.stdout)
|
||||
assert payload["status"] == "rejected"
|
||||
assert any("not allowed for platform momo" in error for error in payload["errors"])
|
||||
|
||||
|
||||
def test_pixelrag_python_capture_worker_dry_run_plans_artifact_outputs(tmp_path):
|
||||
from services.pixelrag_crawler_integration_service import (
|
||||
build_pixelrag_visual_evidence_manifest,
|
||||
)
|
||||
|
||||
manifest = build_pixelrag_visual_evidence_manifest(
|
||||
url="https://24h.pchome.com.tw/",
|
||||
platform="pchome",
|
||||
crawler="PChomeCrawler.visual_fallback",
|
||||
trigger_reason="parser_empty",
|
||||
page_size={"width": 1024, "height": 1024},
|
||||
tile_size={"width": 512, "height": 512},
|
||||
)
|
||||
completed = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
"scripts/ops/capture_pixelrag_visual_evidence.py",
|
||||
"--manifest-json",
|
||||
json.dumps(manifest),
|
||||
"--output-dir",
|
||||
str(tmp_path),
|
||||
"--dry-run",
|
||||
],
|
||||
capture_output=True,
|
||||
check=False,
|
||||
text=True,
|
||||
)
|
||||
|
||||
assert completed.returncode == 0
|
||||
payload = json.loads(completed.stdout)
|
||||
assert payload["policy"] == "read_only_pixelrag_visual_capture_artifact_v1"
|
||||
assert payload["status"] == "dry_run_ready"
|
||||
assert payload["controlled_apply"]["artifact_write"] is False
|
||||
assert payload["tile_plan"]["planned_tile_count"] == 4
|
||||
assert payload["capture_target"]["platform"] == "pchome"
|
||||
|
||||
Reference in New Issue
Block a user