Compare commits

...
Author SHA1 Message Date
Kevin Veen-BirkenbachandClaude Opus 5.5 5e08847286 Merge origin/main into fix/branch-cleanup-held-once
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
CI / test-virgin-root (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
Brings the 11-14 held-branches fix (e017af0) up to main 895ec2f; clean merge, no conflicts. test_branch_cleanup_local passes 76/76 on the merge and both new tests fail on the unfixed main on the held-branches read count.

🎯 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-28 09:35:52 +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
Kevin Veen-BirkenbachandClaude Opus 5.5 e017af0cd1 perf(branch): read the held branches once per cleanup plan
branch cleanup --local reads the held-branches map lazily once per snapshot instead of once per item, so a plan reads it once and every apply-time re-check still reads it fresh; a branch held after the plan is still skipped. On a scratch repository with 60 merged branches and 101 git dirs the plan drops from 27.1 s to 2.3 s with a byte-identical JSON plan. Tests run once after the merge (operator order 2026-11-14).

🎯 Fix: 85 %
💥 Break: 3 %
💸 Tokens: 10 %
⏱️ Velocity: 5 %
🛡️ Security: 100 %
🏆 Score: 100
🚦 Gate: ⛔ fix 85 % < 90

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 21:39:37 +00:00
4 changed files with 73 additions and 22 deletions

No files matched your search

+6
View File
@@ -71,3 +71,9 @@ jobs:
contents: read contents: read
security-events: write security-events: write
uses: ./.github/workflows/lint-docker.yml 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
+3 -15
View File
@@ -8,19 +8,7 @@ permissions:
jobs: jobs:
lint-python: lint-python:
runs-on: ubuntu-latest uses: infinito-nexus/quality/.github/workflows/tool.yml@003eed66dd51592c3312a7c21ae429abead54d6f # v0.2.0
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with: with:
python-version: "3.12" tool: ruff
args: check src tests
- name: Install ruff
run: pip install ruff
- name: Run ruff
run: |
ruff check src tests
+18 -7
View File
@@ -8,6 +8,7 @@ import sys
import time import time
from collections.abc import Callable from collections.abc import Callable
from dataclasses import asdict, dataclass, field from dataclasses import asdict, dataclass, field
from functools import cache
from graphlib import CycleError, TopologicalSorter from graphlib import CycleError, TopologicalSorter
from pkgmgr.actions.worktree.hooks import FINI_HOOK, hook_command, run_hook from pkgmgr.actions.worktree.hooks import FINI_HOOK, hook_command, run_hook
@@ -37,6 +38,7 @@ Snapshot = tuple[
dict[int, str], dict[int, str],
dict[str, tuple[str | None, int | None, int | None, bool]], dict[str, tuple[str | None, int | None, int | None, bool]],
Registrations, Registrations,
Callable[[], dict[str, str]],
] ]
# PROC_PID_INIT_INO: only the initial PID namespace sees every process of the host. # PROC_PID_INIT_INO: only the initial PID namespace sees every process of the host.
@@ -665,7 +667,7 @@ def _build(
tree: Worktree | None, tree: Worktree | None,
snapshot: Snapshot, snapshot: Snapshot,
) -> Item: ) -> Item:
local, remote, cwds, tracking, registrations = snapshot local, remote, cwds, tracking, registrations, held = snapshot
upstream, ahead, behind, gone = tracking.get( upstream, ahead, behind, gone = tracking.get(
branch or "", (None, None, None, False) branch or "", (None, None, None, False)
) )
@@ -759,7 +761,7 @@ def _build(
and (time.time() - item.last_activity) / 3600 < repo.min_age and (time.time() - item.last_activity) / 3600 < repo.min_age
): ):
item.skip = f"younger than {repo.min_age:g} h" item.skip = f"younger than {repo.min_age:g} h"
item.actions = _actions(repo, item, tree, checkout, dirty, registrations) item.actions = _actions(repo, item, tree, checkout, dirty, registrations, held)
if repo.unsafe: if repo.unsafe:
item.actions = [a for a in item.actions if not a.startswith("remote-branch:")] item.actions = [a for a in item.actions if not a.startswith("remote-branch:")]
return item return item
@@ -772,9 +774,10 @@ def _actions(
checkout: bool, checkout: bool,
dirty: int, dirty: int,
registrations: Registrations, registrations: Registrations,
held: Callable[[], dict[str, str]],
) -> list[str]: ) -> list[str]:
if repo.scope == "local": if repo.scope == "local":
return _local_actions(repo, item, tree) return _local_actions(repo, item, tree, held)
tree_part: list[str] = [] tree_part: list[str] = []
if tree: if tree:
if ( if (
@@ -813,7 +816,12 @@ def _actions(
return actions return actions
def _local_actions(repo: Repo, item: Item, tree: Worktree | None) -> list[str]: def _local_actions(
repo: Repo,
item: Item,
tree: Worktree | None,
held: Callable[[], dict[str, str]],
) -> list[str]:
""" """
Settle the actions of an item planned with scope `local`. Settle the actions of an item planned with scope `local`.
@@ -823,6 +831,8 @@ def _local_actions(repo: Repo, item: Item, tree: Worktree | None) -> list[str]:
item: the classified item; a merged-clean one whose tip is an item: the classified item; a merged-clean one whose tip is an
ancestor of none of them gets that as its skip. ancestor of none of them gets that as its skip.
tree: the worktree holding its branch, or None. tree: the worktree holding its branch, or None.
held: the snapshot's _held_branches of the repository, read on the
first call and reused for every later item of that snapshot.
Returns: Returns:
`local-branch` for a merged-clean local branch that no worktree, `local-branch` for a merged-clean local branch that no worktree,
@@ -832,9 +842,9 @@ def _local_actions(repo: Repo, item: Item, tree: Worktree | None) -> list[str]:
""" """
if item.state != "merged-clean" or not item.local_sha or tree is not None: if item.state != "merged-clean" or not item.local_sha or tree is not None:
return [] return []
held = _held_branches(repo.repo).get(item.branch) hold = held().get(item.branch)
if held: if hold:
item.skip = item.skip or held item.skip = item.skip or hold
return [] return []
targets = [repo.default, *repo.lines] targets = [repo.default, *repo.lines]
if any(_is_ancestor(item.local_sha, ref, repo.repo) for ref in targets): if any(_is_ancestor(item.local_sha, ref, repo.repo) for ref in targets):
@@ -854,6 +864,7 @@ def _snapshot(repo: Repo) -> tuple[list[Worktree], Snapshot]:
cwds, cwds,
tracking, tracking,
_registrations(repo.repo), _registrations(repo.repo),
cache(lambda: _held_branches(repo.repo)),
) )
@@ -489,6 +489,52 @@ class TestBranchCleanupLocal(unittest.TestCase):
heads["refs/heads/local-done"], heads["refs/heads/local-done"],
) )
def test_plan_reads_the_held_branches_once_per_repository(self) -> None:
self._set_head()
extra = ("more-a", "more-b", "more-c")
for name in extra:
git(self.repo, "branch", name, "done")
with patch.object(gc, "_held_branches", wraps=gc._held_branches) as held:
run = self._cleanup("local", apply=False)
self.assertEqual(held.call_count, 1)
self.assertEqual(
{name for name, i in run.items.items() if i["actions"]},
{"done", "local-done", *extra},
)
def test_branch_held_after_the_plan_is_not_deleted(self) -> None:
self._set_head()
real = gc._rebuild
changes = [
lambda: git(
self.repo, "symbolic-ref", "refs/tags/pin", "refs/heads/local-done"
)
]
def late(repo: gc.Repo, item: gc.Item) -> gc.Item:
if changes:
changes.pop()()
return real(repo, item)
with (
patch.object(gc, "_held_branches", wraps=gc._held_branches) as held,
patch.object(gc, "_rebuild", side_effect=late),
):
run = self._cleanup("local", apply=True)
self.assertEqual(held.call_count, 3)
self.assertEqual(
self._results(run),
{
"done": "done",
"local-done": "skipped: changed since plan "
"(target of symbolic ref refs/tags/pin)",
},
)
self.assertIn("refs/heads/local-done", self._refs(self.repo, "refs/heads"))
def test_delete_never_follows_a_symref_made_after_the_check(self) -> None: def test_delete_never_follows_a_symref_made_after_the_check(self) -> None:
planned = git(self.repo, "rev-parse", "held-done") planned = git(self.repo, "rev-parse", "held-done")