import sys,tarfile,json
from pathlib import Path
root=Path('/tmp/baseline');root.mkdir()
with tarfile.open('/out/baseline_source.tar.gz') as f:f.extractall(root)
sys.path[:0]=[str(root),str(root/'tests')]
import pytest
cases=['tests/test_fight_crowd_integration.py::IntegrationTests::test_web_fight_shared_pose_and_crowd_switch',
 'tests/test_secure_bridge.py::test_artifact_attempt_owner_unchanged_and_only_one_delivery_path',
 'tests/test_secure_bridge.py::test_artifact_blocked_time_never_invokes_relay',
 'tests/test_secure_bridge.py::test_artifact_http_only_does_not_initialize_relay_or_ledger',
 'tests/test_secure_bridge.py::test_existing_post_response_validation']
class Report:
 def __init__(self):self.failures=[];self.errors=[]
 def pytest_runtest_logreport(self,report):
  if report.failed:(self.failures if report.when=='call' else self.errors).append(report.nodeid)
r=Report();code=pytest.main(['-q','-p','no:cacheprovider',*[str(root/c) for c in cases]],plugins=[r])
Path('/out/download/baseline_failures.json').write_text(json.dumps(dict(exit_code=int(code),failures=r.failures,errors=r.errors,
 scope='Only five existing synthetic config/artifact contract tests; no engine cache/model evaluation'),indent=2))
print('BASELINE_FAILURES',len(r.failures),len(r.errors))
