refactor(release): bundle the options and refuse untracked release inputs

quality, 7 findings: _release_impl and release take one frozen ReleaseOptions (new options.py, exported from pkgmgr.actions.release) and split into small private helpers with a frozen _Prepared carrier; the three _release_impl call paths become one plus dataclasses.replace(preview=True) for the interactive preview. cli/commands/release.py and cli/parser/release_cmd.py split into helpers with arguments in the same order, so the CLI surface is unchanged; test_workflow.py uses one with-block instead of five patch decorators. CodeRabbit: with --expect-tree an existing but untracked release input (pyproject, CHANGELOG.md, flake.nix, PKGBUILD, spec, debian/changelog, Cargo files) aborts before any write; the README says the abort comes before any release file is written and the pull is not reverted.

| 🌿 Branch | 📊 Diff stat | 🎯 Fix | 💥 Break | 💸 Tokens | ⏱️ Velocity | 🛡️ Security | 🏆 Score | Gate |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| feature/release-expect-tree | 13 files +457/-342 | 91 % | 4 % | – | – | 100 % | 87 | ✅ 90/5, tokens and velocity <= 100, security 100 % |

Evidence: tests/unit + tests/integration with PYTHONPATH=src 886 passed; 2 known gpg-in-sandbox failures in test_publish_integration. quality check --staged 0 findings, ruff clean, MEDUSA 100 %, critical 0. Hub review e12f7e62ce35b6f5.

Refs https://github.com/kevinveenbirkenbach/package-manager/pull/19

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-30 23:33:49 +00:00
1 parent 29cb898a0a
commit 208a8c3ace
13 files changed
+454 -339

No files matched your search

+6 -3
View File
@@ -10,6 +10,7 @@ from contextlib import redirect_stdout
from pathlib import Path
from unittest.mock import patch
from pkgmgr.actions.release.options import ReleaseOptions
from pkgmgr.actions.release.retry import retry_release
from pkgmgr.actions.release.workflow import _release_impl
from pkgmgr.actions.repository.push import (
@@ -383,9 +384,11 @@ class TestPushMirrorLeases(unittest.TestCase):
with redirect_stdout(io.StringIO()), self.assertRaises(PushRefusedError):
_release_impl(
pyproject_path=os.path.join(self.repo, "pyproject.toml"),
force=True,
expect_tree=None,
ReleaseOptions(
pyproject_path=os.path.join(self.repo, "pyproject.toml"),
force=True,
expect_tree=None,
)
)
self.assertEqual(git(self.repo, "rev-parse", "HEAD"), head)