|
13 | 13 | REPO_ROOT = Path(__file__).resolve().parents[2] |
14 | 14 | sys.path.insert(0, str(REPO_ROOT)) |
15 | 15 |
|
16 | | -import loopx.canary.runner as runner_module # noqa: E402 |
17 | 16 | from loopx.canary.runner import ( # noqa: E402 |
18 | 17 | build_catalog_canary_run, |
19 | 18 | normalize_canary_command, |
@@ -107,22 +106,24 @@ def assert_domain_checks_precede_family_checks() -> None: |
107 | 106 |
|
108 | 107 |
|
109 | 108 | def assert_git_required_smoke_skips_without_git_worktree() -> None: |
110 | | - original_root = runner_module.REPO_ROOT |
111 | 109 | with tempfile.TemporaryDirectory() as temp_dir: |
112 | 110 | temp_root = Path(temp_dir).resolve() |
113 | 111 | (temp_root / "examples" / "control_plane").mkdir(parents=True) |
114 | | - runner_module.REPO_ROOT = temp_root |
115 | | - try: |
116 | | - payload = build_catalog_canary_run( |
117 | | - catalog_path=REPO_ROOT / "docs/concepts/interaction-pattern-catalog.md", |
118 | | - profiles=["repo-architecture-budget"], |
119 | | - max_checks_per_profile=1, |
120 | | - check_limit=1, |
121 | | - execute=True, |
122 | | - timeout_seconds=10, |
123 | | - ) |
124 | | - finally: |
125 | | - runner_module.REPO_ROOT = original_root |
| 112 | + # TMPDIR may be inside a checkout. A bare repository stops Git's |
| 113 | + # ancestor discovery without providing a worktree to the check. |
| 114 | + subprocess.run( |
| 115 | + ["git", "init", "--bare", "--quiet", str(temp_root)], check=True, |
| 116 | + stdout=subprocess.PIPE, stderr=subprocess.PIPE, |
| 117 | + ) |
| 118 | + payload = build_catalog_canary_run( |
| 119 | + catalog_path=REPO_ROOT / "docs/concepts/interaction-pattern-catalog.md", |
| 120 | + profiles=["repo-architecture-budget"], |
| 121 | + max_checks_per_profile=1, |
| 122 | + check_limit=1, |
| 123 | + execute=True, |
| 124 | + timeout_seconds=10, |
| 125 | + repo_root=temp_root, |
| 126 | + ) |
126 | 127 |
|
127 | 128 | assert payload["ok"] is True, payload |
128 | 129 | assert payload["failure_count"] == 0, payload |
|
0 commit comments