From daa139c9e38e41453722f13e78a48de99edd0868 Mon Sep 17 00:00:00 2001 From: kshitij <82637225+kshitijk4poor@users.noreply.github.com> Date: Sat, 8 Aug 2026 14:35:54 +0530 Subject: [PATCH] fix(tools): classify git bisect as a worktree mutation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bisect sat in _KNOWN_GIT_BUILTINS and was allowed in the running source root, yet it repeatedly checks out commits — the exact module-version skew this guard exists to prevent. Move it to _WORKTREE_MUTATIONS. --- tests/tools/test_self_repo_guard.py | 2 ++ tools/self_repo_guard.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/tools/test_self_repo_guard.py b/tests/tools/test_self_repo_guard.py index 503eac02edc2f..d2738ecc903a9 100644 --- a/tests/tools/test_self_repo_guard.py +++ b/tests/tools/test_self_repo_guard.py @@ -30,6 +30,8 @@ class TestBlocksMutationsInSourceRepo: [ "checkout pr-51020", "switch main", + "bisect start", + "bisect good HEAD~10", "reset --hard origin/main", "reset --har origin/main", "rebase origin/main", diff --git a/tools/self_repo_guard.py b/tools/self_repo_guard.py index 32d3641f29e12..6d3f4b4c815d8 100644 --- a/tools/self_repo_guard.py +++ b/tools/self_repo_guard.py @@ -27,6 +27,9 @@ _WORKTREE_MUTATIONS = frozenset({ "clean", "cherry-pick", "revert", + # bisect drives repeated checkouts of the running root — the exact + # module-version-skew hazard this guard exists for. + "bisect", }) _WORKTREE_TARGET_ACTIONS = frozenset({"move", "remove"}) _STASH_SAFE_ACTIONS = frozenset({"list", "show", "create", "store", "drop", "clear"}) @@ -35,7 +38,6 @@ _KNOWN_GIT_BUILTINS = frozenset({ "add", "am", "apply", - "bisect", "blame", "branch", "bundle",