From af6e68c0d1f3f18ee87ea535a1781583b9c3efb9 Mon Sep 17 00:00:00 2001 From: "pulse-triage[bot]" <249995291+pulse-triage[bot]@users.noreply.github.com> Date: Sat, 19 Sep 2026 15:14:26 +0100 Subject: [PATCH] fix(governance): validate completion pairs without a linked worktree The canonical completion history validator materialised the completion tree with 'git worktree add', which writes administrative files into the reviewed repository's git directory. That directory is read-only inside the maintainer proof sandbox, so the maintainer preflight could not consult the registry that canonical governance already honours. Materialise the tree with a shared local clone instead: it reads the reviewed objects through alternates and writes only inside the disposable temporary directory, so CI and the maintainer pipeline validate the same reviewed pair without relaxing the sandbox boundary. Change-source: pulse-maintainer --- .../canonical_completion_history.py | 50 +++++++++++-------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/scripts/release_control/canonical_completion_history.py b/scripts/release_control/canonical_completion_history.py index 014adfb82c..d508037711 100644 --- a/scripts/release_control/canonical_completion_history.py +++ b/scripts/release_control/canonical_completion_history.py @@ -87,29 +87,35 @@ def validate_completion(incomplete: str, head: str) -> bool: files = sorted(set(changed_files(incomplete) + changed_files(completion))) with tempfile.TemporaryDirectory(prefix="pulse-canonical-completion-") as temp: worktree = Path(temp) / "pulse" - git("worktree", "add", "--detach", str(worktree), completion) - try: - guard = worktree / "scripts/release_control/canonical_completion_guard.py" - result = subprocess.run( - [ - sys.executable, - str(guard), - "--files-from-stdin", - "--diff-base", - f"{incomplete}^", - "--commit", - completion, - ], - cwd=worktree, - input="".join(f"{path}\n" for path in files), - text=True, + # Materialise the completion tree with a shared clone rather than a + # linked worktree. A linked worktree writes its administrative files + # into the reviewed repository's git directory, which is read-only + # inside the maintainer proof sandbox. A shared clone reads the + # reviewed objects through alternates and writes only inside the + # disposable temporary directory, so CI and the maintainer preflight + # validate the pair identically without relaxing that boundary. + git("clone", "--quiet", "--shared", "--no-checkout", "--local", + str(REPO_ROOT), str(worktree)) + git("-C", str(worktree), "checkout", "--quiet", "--detach", completion) + guard = worktree / "scripts/release_control/canonical_completion_guard.py" + result = subprocess.run( + [ + sys.executable, + str(guard), + "--files-from-stdin", + "--diff-base", + f"{incomplete}^", + "--commit", + completion, + ], + cwd=worktree, + input="".join(f"{path}\n" for path in files), + text=True, + ) + if result.returncode != 0: + raise ValueError( + f"registered completion {completion} does not complete {incomplete}" ) - if result.returncode != 0: - raise ValueError( - f"registered completion {completion} does not complete {incomplete}" - ) - finally: - git("worktree", "remove", "--force", str(worktree)) print( "Canonical completion history passed "