from pathlib import Path ROOT = Path(__file__).resolve().parents[1] def test_dependency_handling_is_framed_as_gist_application_not_parallel_protocol(): worker = (ROOT / "src" / "worker_payload.py").read_text(encoding="utf-8") assert "This brief does **not** replace the HF Spaces gist" in worker assert "applying the gist method" in worker assert "read logs first, find the first" in worker assert "make one minimal requirements patch, rebuild, then" in worker def test_concrete_dependency_error_blocks_same_code_rebuild_by_gist_reasoning(): worker = (ROOT / "src" / "worker_payload.py").read_text(encoding="utf-8") normalize = worker.split("def normalize_repair_decision", 1)[1].split("def diagnose_failure_with_pi", 1)[0] assert "gist_log_first_dependency_error_needs_minimal_requirements_patch" in normalize assert "The gist says read the first actionable error and act once surgically" in normalize assert "same-code rebuild/wait is not the" in normalize def test_dependency_issue_carries_gist_alignment_context(): worker = (ROOT / "src" / "worker_payload.py").read_text(encoding="utf-8") classify = worker.split("def classify_repair_failure", 1)[1].split("def workspace_file_inventory", 1)[0] assert "gist_alignment" in classify assert "read first actionable pip error, patch minimally, rebuild, validate live" in classify