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

+24 -18
View File
@@ -16,6 +16,8 @@ import unittest
from types import SimpleNamespace
from unittest.mock import call, patch
from pkgmgr.actions.release import ReleaseOptions
class TestReleaseCommand(unittest.TestCase):
"""
@@ -100,15 +102,17 @@ class TestReleaseCommand(unittest.TestCase):
# And run_release should be invoked once with the expected parameters.
mock_run_release.assert_called_once_with(
pyproject_path="pyproject.toml",
changelog_path="CHANGELOG.md",
release_type="minor",
message="Close branch after minor release",
preview=False,
force=True,
close=True,
retry=False,
expect_tree=None,
ReleaseOptions(
pyproject_path="pyproject.toml",
changelog_path="CHANGELOG.md",
release_type="minor",
message="Close branch after minor release",
preview=False,
force=True,
close=True,
retry=False,
expect_tree=None,
)
)
@patch("pkgmgr.cli.commands.release.os.path.isdir", return_value=True)
@@ -152,15 +156,17 @@ class TestReleaseCommand(unittest.TestCase):
handle_release(args, ctx, selected)
mock_run_release.assert_called_once_with(
pyproject_path="pyproject.toml",
changelog_path="CHANGELOG.md",
release_type="patch",
message=None,
preview=True,
force=False,
close=False,
retry=False,
expect_tree="4b825dc642cb6eb9a060e54bf8d69288fbee4904",
ReleaseOptions(
pyproject_path="pyproject.toml",
changelog_path="CHANGELOG.md",
release_type="patch",
message=None,
preview=True,
force=False,
close=False,
retry=False,
expect_tree="4b825dc642cb6eb9a060e54bf8d69288fbee4904",
)
)
@patch("pkgmgr.cli.commands.release.run_release")