@@ -47,19 +47,40 @@ HOOKS_PATH = REPO_ROOT / ".pre-commit-hooks.yaml" |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | def test_pre_commit_hooks_yaml_is_valid() -> None: |
| 50 | | - """Smoke: ``.pre-commit-hooks.yaml`` parses and declares the two |
| 51 | | - expected hooks. Cheap — runs without network — and catches |
| 52 | | - structural drift before the slow-lane invocation.""" |
| 50 | + """Smoke: ``.pre-commit-hooks.yaml`` parses and declares the three |
| 51 | + expected hooks (system / isolated-venv / docker_image). Cheap — |
| 52 | + runs without network — and catches structural drift before the |
| 53 | + slow-lane invocation.""" |
| 53 | 54 | assert HOOKS_PATH.exists(), f"missing {HOOKS_PATH}" |
| 54 | 55 | hooks = yaml.safe_load(HOOKS_PATH.read_text(encoding="utf-8")) |
| 55 | 56 | assert isinstance(hooks, list) |
| 56 | 57 | ids = [h["id"] for h in hooks] |
| 57 | | - assert ids == ["sway-gate", "sway-gate-isolated"], f"unexpected hook ids: {ids}" |
| 58 | + assert ids == [ |
| 59 | + "sway-gate", |
| 60 | + "sway-gate-isolated", |
| 61 | + "sway-gate-docker", |
| 62 | + ], f"unexpected hook ids: {ids}" |
| 63 | + |
| 58 | 64 | system_hook = next(h for h in hooks if h["id"] == "sway-gate") |
| 59 | 65 | assert system_hook["language"] == "system" |
| 60 | 66 | assert system_hook["pass_filenames"] is False |
| 61 | 67 | assert system_hook["entry"] == "sway gate" |
| 62 | 68 | |
| 69 | + isolated_hook = next(h for h in hooks if h["id"] == "sway-gate-isolated") |
| 70 | + assert isolated_hook["language"] == "python" |
| 71 | + # Post-F05: the isolated variant pins the PyPI wheel, not a git SHA. |
| 72 | + assert any( |
| 73 | + dep.startswith("dlm-sway[hf]==") for dep in isolated_hook["additional_dependencies"] |
| 74 | + ), f"isolated hook deps lost PyPI pin: {isolated_hook['additional_dependencies']!r}" |
| 75 | + |
| 76 | + docker_hook = next(h for h in hooks if h["id"] == "sway-gate-docker") |
| 77 | + assert docker_hook["language"] == "docker_image" |
| 78 | + assert docker_hook["pass_filenames"] is False |
| 79 | + # Entry is "<image> <cmd>" — first token is the image, rest is argv. |
| 80 | + assert docker_hook["entry"].startswith("ghcr.io/tenseleyflow/sway-gate:"), ( |
| 81 | + f"docker hook image path changed: {docker_hook['entry']!r}" |
| 82 | + ) |
| 83 | + |
| 63 | 84 | |
| 64 | 85 | def _build_random_lora_adapter(base_dir: Path, out_dir: Path) -> None: |
| 65 | 86 | """Same deterministic LoRA build the other integration tests use. |