|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | 3 | import json |
| 4 | +import os |
4 | 5 | import subprocess |
5 | 6 | import sys |
6 | 7 | from datetime import datetime, timezone |
@@ -246,6 +247,33 @@ def test_current_run_consistency_downgrades_stale_local_advisory_to_advisory(tmp |
246 | 247 | assert "source_sha_mismatch" in payload["authority_reasons"] |
247 | 248 |
|
248 | 249 |
|
| 250 | +def test_ci_control_plane_doctor_can_emit_current_run_source_metadata(tmp_path: Path) -> None: |
| 251 | + out_dir = tmp_path / "doctor" |
| 252 | + env = { |
| 253 | + "OPENVIBECODING_CI_CONTROL_PLANE_DOCTOR_OUT_DIR": str(out_dir), |
| 254 | + "OPENVIBECODING_DOCTOR_REQUIRE_DOCKER": "0", |
| 255 | + "OPENVIBECODING_DOCTOR_REQUIRE_SUDO": "0", |
| 256 | + "RUNNER_TEMP": str(tmp_path / "runner-temp"), |
| 257 | + "OPENVIBECODING_CI_SOURCE_RUN_ID": "local-run", |
| 258 | + "OPENVIBECODING_CI_SOURCE_ROUTE": "local_full_ci", |
| 259 | + "OPENVIBECODING_CI_SOURCE_EVENT": "local", |
| 260 | + } |
| 261 | + proc = subprocess.run( |
| 262 | + ["bash", str(REPO_ROOT / "scripts" / "ci_control_plane_doctor.sh")], |
| 263 | + cwd=REPO_ROOT, |
| 264 | + text=True, |
| 265 | + capture_output=True, |
| 266 | + env={**os.environ, **env}, |
| 267 | + check=False, |
| 268 | + ) |
| 269 | + |
| 270 | + assert proc.returncode == 0, proc.stderr or proc.stdout |
| 271 | + payload = json.loads((out_dir / "report.json").read_text(encoding="utf-8")) |
| 272 | + assert payload["source_run_id"] == "local-run" |
| 273 | + assert payload["source_route"] == "local_full_ci" |
| 274 | + assert payload["source_event"] == "local" |
| 275 | + |
| 276 | + |
249 | 277 | def test_artifact_index_marks_head_mismatch_non_authoritative(tmp_path: Path) -> None: |
250 | 278 | route_report = tmp_path / "trusted_pr.json" |
251 | 279 | route_report.write_text("{}", encoding="utf-8") |
|
0 commit comments