Compare commits

...
5 Commits
Author SHA1 Message Date
Kevin Veen-BirkenbachandClaude Opus 5.5 b06b33ff57 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>
2026-11-27 21:20:26 +00:00
Kevin Veen-Birkenbach 895ec2f0d4 Merge pull request #11 from kevinveenbirkenbach/chore/quality-reusable-gate
ci: run ruff and the quality gate from infinito-nexus/quality
2026-11-25 22:26:22 +01:00
Kevin Veen-BirkenbachandClaude Opus 5.5 d34c3f3772 ci: pin the quality workflows to v0.2.0
CI / security-codeql (push) Canceled after 0s
CI / test-unit (push) Canceled after 0s
CI / test-integration (push) Canceled after 0s
CI / test-env-virtual (push) Canceled after 0s
CI / test-env-nix (push) Canceled after 0s
CI / test-e2e (push) Canceled after 0s
CI / test-virgin-user (push) Canceled after 0s
CI / test-virgin-root (push) Canceled after 0s
CI / lint-shell (push) Canceled after 0s
CI / lint-python (push) Canceled after 0s
CI / lint-docker (push) Canceled after 0s
CI / quality (push) Canceled after 0s
Both reusable quality workflows move from quality main ed91a38 to the v0.2.0 release commit 003eed6, pinned by sha with the version comment that Dependabot's github-actions updates. job.workflow_sha resolves to the same commit, so the tool versions follow this one pin.

🎯 Fix: 93 %
💥 Break: 2 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 91
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 20:47:11 +00:00
Kevin Veen-BirkenbachandClaude Opus 5.5 2b18deede8 ci: call the quality gate from ci.yml to keep the workflow folder at 15 files
CI / security-codeql (push) Canceled after 0s
CI / test-unit (push) Canceled after 0s
CI / test-integration (push) Canceled after 0s
CI / test-env-virtual (push) Canceled after 0s
CI / test-env-nix (push) Canceled after 0s
CI / test-e2e (push) Canceled after 0s
CI / test-virgin-user (push) Canceled after 0s
CI / test-virgin-root (push) Canceled after 0s
CI / lint-shell (push) Canceled after 0s
CI / lint-python (push) Canceled after 0s
CI / lint-docker (push) Canceled after 0s
CI / quality (push) Canceled after 0s
The gate's first run on PR #11 found one new finding, clean.folder-items on .github/workflows (16 items). The gate's call moves into ci.yml as the job quality, which runs only on pull requests and pushes to main, so the folder keeps the 15 files main has.

🎯 Fix: 90 %
💥 Break: 3 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 87
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 19:53:16 +00:00
Kevin Veen-BirkenbachandClaude Opus 5.5 1707cc0192 ci: run quality's gate and take ruff from the quality flake
CodeQL Advanced / Check security (none, python) (push) Canceled after 0s
CodeQL Advanced / Check security (none, actions) (push) Canceled after 0s
CI / security-codeql (push) Canceled after 0s
Test Units / test-unit (push) Canceled after 0s
CI / test-unit (push) Canceled after 0s
Test Code Integration / test-integration (push) Canceled after 0s
CI / test-integration (push) Canceled after 0s
Test OS Containers / test-env-virtual (ubuntu) (push) Canceled after 0s
Test OS Containers / test-env-virtual (fedora) (push) Canceled after 0s
Test OS Containers / test-env-virtual (debian) (push) Canceled after 0s
Test OS Containers / test-env-virtual (centos) (push) Canceled after 0s
Test OS Containers / test-env-virtual (arch) (push) Canceled after 0s
CI / test-env-virtual (push) Canceled after 0s
Test Virgin Nix (flake only) / test-env-nix (ubuntu) (push) Canceled after 0s
Test Virgin Nix (flake only) / test-env-nix (fedora) (push) Canceled after 0s
Test Virgin Nix (flake only) / test-env-nix (debian) (push) Canceled after 0s
Test Virgin Nix (flake only) / test-env-nix (centos) (push) Canceled after 0s
Test Virgin Nix (flake only) / test-env-nix (arch) (push) Canceled after 0s
CI / test-env-nix (push) Canceled after 0s
Test End-To-End / test-e2e (ubuntu) (push) Canceled after 0s
Test End-To-End / test-e2e (fedora) (push) Canceled after 0s
Test End-To-End / test-e2e (debian) (push) Canceled after 0s
Test End-To-End / test-e2e (centos) (push) Canceled after 0s
Test End-To-End / test-e2e (arch) (push) Canceled after 0s
CI / test-e2e (push) Canceled after 0s
Test Virgin User / test-virgin-user (ubuntu) (push) Canceled after 0s
Test Virgin User / test-virgin-user (fedora) (push) Canceled after 0s
Test Virgin User / test-virgin-user (debian) (push) Canceled after 0s
Test Virgin User / test-virgin-user (centos) (push) Canceled after 0s
Test Virgin User / test-virgin-user (arch) (push) Canceled after 0s
CI / test-virgin-user (push) Canceled after 0s
Test Virgin Root / test-virgin-root (ubuntu) (push) Canceled after 0s
Test Virgin Root / test-virgin-root (fedora) (push) Canceled after 0s
Test Virgin Root / test-virgin-root (debian) (push) Canceled after 0s
Test Virgin Root / test-virgin-root (centos) (push) Canceled after 0s
Test Virgin Root / test-virgin-root (arch) (push) Canceled after 0s
CI / test-virgin-root (push) Canceled after 0s
ShellCheck / lint-shell (push) Canceled after 0s
CI / lint-shell (push) Canceled after 0s
Docker Linter / Lint Dockerfile (push) Canceled after 0s
CI / lint-docker (push) Canceled after 0s
CI / lint-python (push) Failing after 0s
Ruff (Python code sniffer) / lint-python (push) Failing after 0s
lint-python now runs ruff through quality's reusable tool workflow, so its version comes from quality's flake.lock instead of the latest pip release, and a new workflow runs quality's differential gate on pull requests and pushes to main. Both pin one quality commit by their uses: line only.

🎯 Fix: 85 %
💥 Break: 4 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 82
🚦 Gate: ⛔ fix 85 % < 90

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 19:13:25 +00:00
6 changed files with 169 additions and 16 deletions

No files matched your search

+6
View File
@@ -71,3 +71,9 @@ jobs:
contents: read
security-events: write
uses: ./.github/workflows/lint-docker.yml
quality:
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
permissions:
contents: read
uses: infinito-nexus/quality/.github/workflows/quality.yml@003eed66dd51592c3312a7c21ae429abead54d6f # v0.2.0
+4 -16
View File
@@ -8,19 +8,7 @@ permissions:
jobs:
lint-python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install ruff
run: pip install ruff
- name: Run ruff
run: |
ruff check src tests
uses: infinito-nexus/quality/.github/workflows/tool.yml@003eed66dd51592c3312a7c21ae429abead54d6f # v0.2.0
with:
tool: ruff
args: check src tests
+12
View File
@@ -1,5 +1,6 @@
from __future__ import annotations
from pkgmgr.core.git import run
from pkgmgr.core.git.commands import (
fetch,
pull_ff_only,
@@ -14,7 +15,18 @@ def ensure_clean_and_synced(*, preview: bool = False) -> None:
Always run a pull BEFORE modifying anything.
Uses --ff-only to avoid creating merge commits automatically.
If no upstream is configured, we skip.
Raises:
RuntimeError: a tracked file is modified; the release commit uses
``commit -a`` and would ship it.
"""
dirty = run(["status", "--porcelain", "--untracked-files=no"])
if dirty:
raise RuntimeError(
"Tracked changes in the release checkout; commit or park them "
f"first, the release commit would include them:\n{dirty}"
)
upstream = get_upstream_ref()
if not upstream:
print("[INFO] No upstream configured for current branch. Skipping pull.")
+11
View File
@@ -23,6 +23,7 @@ from pkgmgr.cli.commands import (
)
from pkgmgr.cli.context import CLIContext
from pkgmgr.cli.proxy import maybe_handle_proxy
from pkgmgr.core.git import GitRunError, run
from pkgmgr.core.repository.dir import get_repo_dir
from pkgmgr.core.repository.selected import get_selected_repos
@@ -60,6 +61,14 @@ def _select_repo_for_current_directory(ctx: CLIContext) -> list[dict[str, Any]]:
return [matches[0][1]]
def _at_cwd_checkout(selected: list[dict[str, Any]]) -> list[dict[str, Any]]:
try:
toplevel = run(["rev-parse", "--show-toplevel"])
except GitRunError:
return selected
return [{**repo, "directory": toplevel} for repo in selected]
def dispatch_command(args, ctx: CLIContext) -> None:
if maybe_handle_proxy(args, ctx):
return
@@ -143,6 +152,8 @@ def dispatch_command(args, ctx: CLIContext) -> None:
return
if args.command == "release":
if not _has_explicit_selection(args):
selected = _at_cwd_checkout(selected)
handle_release(args, ctx, selected)
return
@@ -0,0 +1,105 @@
from __future__ import annotations
import io
import os
import subprocess
import tempfile
import unittest
from contextlib import redirect_stdout
from pathlib import Path
from unittest.mock import patch
from pkgmgr.actions.release.git_ops import ensure_clean_and_synced
from pkgmgr.cli.context import CLIContext
from pkgmgr.cli.dispatch import dispatch_command
from pkgmgr.cli.parser import create_parser
def git(cwd: str, *args: str) -> str:
return subprocess.run(
["git", *args], cwd=cwd, check=True, capture_output=True, text=True
).stdout.strip()
class TestReleaseCwdCheckout(unittest.TestCase):
def setUp(self) -> None:
self._tmp = tempfile.TemporaryDirectory()
self.addCleanup(self._tmp.cleanup)
root = Path(os.path.realpath(self._tmp.name))
(root / "gitconfig").write_text(
"[user]\n\tname = t\n\temail = t@example.org\n"
"[commit]\n\tgpgsign = false\n"
"[init]\n\tdefaultBranch = main\n"
)
env = patch.dict(
os.environ,
{"GIT_CONFIG_GLOBAL": str(root / "gitconfig"), "GIT_CONFIG_NOSYSTEM": "1"},
)
env.start()
self.addCleanup(env.stop)
cwd = os.getcwd()
self.addCleanup(os.chdir, cwd)
self.main = str(root / "app")
git(str(root), "init", "-q", self.main)
Path(self.main, "app.py").write_text("v1\n")
git(self.main, "add", "app.py")
git(self.main, "commit", "-q", "-m", "init")
self.clone = os.path.join(self.main, ".worktrees", "release")
git(str(root), "clone", "-q", self.main, self.clone)
Path(self.main, "app.py").write_text("unfinished work\n")
self.ctx = CLIContext(
config_merged={},
repositories_base_dir=str(root / "repos"),
all_repositories=[
{
"provider": "github.com",
"account": "t",
"repository": "app",
"directory": self.main,
}
],
binaries_dir=str(root / "bin"),
user_config_path=str(root / "config.yaml"),
)
def _release_cwd(self, cwd: str, *argv: str) -> str:
seen: list[str] = []
os.chdir(cwd)
args = create_parser("test").parse_args(["release", *argv, "--no-publish"])
with (
patch(
"pkgmgr.cli.commands.release.run_release",
side_effect=lambda **_kwargs: seen.append(os.getcwd()),
),
redirect_stdout(io.StringIO()),
):
dispatch_command(args, self.ctx)
self.assertEqual(len(seen), 1)
return seen[0]
def test_release_from_a_nested_clone_runs_in_the_clone(self) -> None:
self.assertEqual(self._release_cwd(self.clone, "patch"), self.clone)
def test_explicit_identifier_keeps_the_configured_checkout(self) -> None:
self.assertEqual(self._release_cwd(self.clone, "patch", "app"), self.main)
def test_tracked_changes_refuse_the_release(self) -> None:
os.chdir(self.main)
with self.assertRaises(RuntimeError) as cm:
ensure_clean_and_synced(preview=False)
self.assertIn("app.py", str(cm.exception))
self.assertEqual(Path(self.main, "app.py").read_text(), "unfinished work\n")
def test_clean_clone_passes_the_check(self) -> None:
os.chdir(self.clone)
with redirect_stdout(io.StringIO()):
ensure_clean_and_synced(preview=False)
if __name__ == "__main__":
unittest.main()
@@ -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()