fix(release): release the cwd checkout and refuse tracked changes
CI / test-virgin-root (push) Blocked by required conditions
CI / quality (push) Skipped
CI / security-codeql (push) Blocked by required conditions
CodeQL Advanced / Check security (none, actions) (push) Blocked by required conditions
CodeQL Advanced / Check security (none, python) (push) Blocked by required conditions
CI / test-unit (push) Blocked by required conditions
Test Units / test-unit (push) Blocked by required conditions
CI / test-integration (push) Blocked by required conditions
Test Code Integration / test-integration (push) Blocked by required conditions
CI / test-env-virtual (push) Blocked by required conditions
Test OS Containers / test-env-virtual (arch) (push) Blocked by required conditions
Test OS Containers / test-env-virtual (centos) (push) Blocked by required conditions
Test OS Containers / test-env-virtual (debian) (push) Blocked by required conditions
Test OS Containers / test-env-virtual (fedora) (push) Blocked by required conditions
Test OS Containers / test-env-virtual (ubuntu) (push) Blocked by required conditions
CI / test-env-nix (push) Blocked by required conditions
Test Virgin Nix (flake only) / test-env-nix (arch) (push) Blocked by required conditions
Test Virgin Nix (flake only) / test-env-nix (centos) (push) Blocked by required conditions
Test Virgin Nix (flake only) / test-env-nix (debian) (push) Blocked by required conditions
Test Virgin Nix (flake only) / test-env-nix (fedora) (push) Blocked by required conditions
Test Virgin Nix (flake only) / test-env-nix (ubuntu) (push) Blocked by required conditions
CI / test-e2e (push) Blocked by required conditions
Test End-To-End / test-e2e (arch) (push) Blocked by required conditions
Test End-To-End / test-e2e (centos) (push) Blocked by required conditions
Test End-To-End / test-e2e (debian) (push) Blocked by required conditions
Test End-To-End / test-e2e (fedora) (push) Blocked by required conditions
Test End-To-End / test-e2e (ubuntu) (push) Blocked by required conditions
CI / test-virgin-user (push) Blocked by required conditions
Test Virgin User / test-virgin-user (arch) (push) Blocked by required conditions
Test Virgin User / test-virgin-user (centos) (push) Blocked by required conditions
Test Virgin User / test-virgin-user (debian) (push) Blocked by required conditions
Test Virgin User / test-virgin-user (fedora) (push) Blocked by required conditions
Test Virgin User / test-virgin-user (ubuntu) (push) Blocked by required conditions
Test Virgin Root / test-virgin-root (arch) (push) Blocked by required conditions
Test Virgin Root / test-virgin-root (centos) (push) Blocked by required conditions
Test Virgin Root / test-virgin-root (debian) (push) Blocked by required conditions
Test Virgin Root / test-virgin-root (fedora) (push) Blocked by required conditions
Test Virgin Root / test-virgin-root (ubuntu) (push) Blocked by required conditions
CI / lint-shell (push) Blocked by required conditions
ShellCheck / lint-shell (push) Blocked by required conditions
CI / lint-python (push) Blocked by required conditions
Ruff (Python code sniffer) / lint-python (push) Blocked by required conditions
CI / lint-docker (push) Blocked by required conditions
Docker Linter / Lint Dockerfile (push) Blocked by required conditions

A release started from a nested clone (for example .worktrees/release-x) matched the configured main checkout by cwd prefix, so pkgmgr chdir'd into the main checkout and its commit -a swept that checkout's unfinished tracked edits into the release commit. Implicit selection for release now uses the cwd's git toplevel, an explicit identifier keeps the configured directory, and ensure_clean_and_synced refuses a tree with tracked changes before any sync or version bump.

🎯 fix 92 % · 💥 break 3 % · 💸 tokens – · ⏱️ velocity – · 🛡️ security 100 % · 🏆 score 89

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-11-27 21:20:26 +00:00
1 parent 895ec2f0d4
commit b06b33ff57
4 files changed
+159

No files matched your search

@@ -6,6 +6,7 @@ from unittest.mock import patch
from pkgmgr.actions.release.git_ops import ensure_clean_and_synced
@patch("pkgmgr.actions.release.git_ops.run", return_value="")
class TestEnsureCleanAndSynced(unittest.TestCase):
@patch("pkgmgr.actions.release.git_ops.pull_ff_only")
@patch("pkgmgr.actions.release.git_ops.fetch")
@@ -15,6 +16,7 @@ class TestEnsureCleanAndSynced(unittest.TestCase):
mock_get_upstream_ref,
mock_fetch,
mock_pull_ff_only,
_mock_run,
) -> None:
mock_get_upstream_ref.return_value = None
@@ -31,6 +33,7 @@ class TestEnsureCleanAndSynced(unittest.TestCase):
mock_get_upstream_ref,
mock_fetch,
mock_pull_ff_only,
_mock_run,
) -> None:
mock_get_upstream_ref.return_value = "origin/main"
@@ -53,6 +56,7 @@ class TestEnsureCleanAndSynced(unittest.TestCase):
mock_get_upstream_ref,
mock_fetch,
mock_pull_ff_only,
_mock_run,
) -> None:
mock_get_upstream_ref.return_value = "origin/main"
@@ -66,3 +70,30 @@ class TestEnsureCleanAndSynced(unittest.TestCase):
preview=False,
)
mock_pull_ff_only.assert_called_once_with(preview=False)
@patch("pkgmgr.actions.release.git_ops.pull_ff_only")
@patch("pkgmgr.actions.release.git_ops.fetch")
@patch("pkgmgr.actions.release.git_ops.get_upstream_ref")
def test_tracked_changes_refuse_before_any_sync(
self,
mock_get_upstream_ref,
mock_fetch,
mock_pull_ff_only,
mock_run,
) -> None:
mock_run.return_value = " M src/app.py"
with self.assertRaises(RuntimeError) as cm:
ensure_clean_and_synced(preview=True)
self.assertIn("src/app.py", str(cm.exception))
mock_run.assert_called_once_with(
["status", "--porcelain", "--untracked-files=no"]
)
mock_get_upstream_ref.assert_not_called()
mock_fetch.assert_not_called()
mock_pull_ff_only.assert_not_called()
if __name__ == "__main__":
unittest.main()