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

+8 -8
View File
@@ -74,17 +74,17 @@ class TestIntegrationReleaseCommand(unittest.TestCase):
self._run_pkgmgr(["release", "patch", "--preview"])
mock_run_release.assert_called_once()
_args, kwargs = mock_run_release.call_args
options = mock_run_release.call_args.args[0]
# CLI wiring
self.assertEqual(kwargs.get("release_type"), "patch")
self.assertEqual(options.release_type, "patch")
self.assertTrue(
kwargs.get("preview"),
options.preview,
"preview should be True when --preview is used",
)
# Default: no --close → close=False
self.assertFalse(
kwargs.get("close"),
options.close,
"close must be False when --close is not given",
)
@@ -116,17 +116,17 @@ class TestIntegrationReleaseCommand(unittest.TestCase):
self._run_pkgmgr(["release", "minor", "--preview", "--close"])
mock_run_release.assert_called_once()
_args, kwargs = mock_run_release.call_args
options = mock_run_release.call_args.args[0]
# CLI wiring
self.assertEqual(kwargs.get("release_type"), "minor")
self.assertEqual(options.release_type, "minor")
self.assertTrue(
kwargs.get("preview"),
options.preview,
"preview should be True when --preview is used",
)
# With --close → close=True
self.assertTrue(
kwargs.get("close"),
options.close,
"close must be True when --close is given",
)