Complete guided release console workflow
This commit is contained in:
@@ -23,7 +23,7 @@ from govoplan_release.selective_planner import build_selective_release_plan # n
|
||||
|
||||
|
||||
class ReleasePlanGuidanceTests(unittest.TestCase):
|
||||
def test_unprepared_target_has_structured_remediation_and_recommendation(
|
||||
def test_unprepared_target_gets_bounded_version_and_commit_steps(
|
||||
self,
|
||||
) -> None:
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
@@ -40,20 +40,25 @@ class ReleasePlanGuidanceTests(unittest.TestCase):
|
||||
repo_versions={"govoplan-files": "1.2.4"},
|
||||
)
|
||||
|
||||
self.assertEqual("blocked", plan.status)
|
||||
self.assertFalse(plan.source_preflight_ready)
|
||||
finding = next(
|
||||
item
|
||||
for item in plan.gate_findings
|
||||
if item.code == "repository_version_alignment"
|
||||
self.assertEqual("attention", plan.status)
|
||||
self.assertTrue(plan.source_preflight_ready)
|
||||
self.assertFalse(
|
||||
any(
|
||||
item.code == "repository_version_alignment"
|
||||
for item in plan.gate_findings
|
||||
)
|
||||
)
|
||||
self.assertEqual("govoplan-files", finding.repo)
|
||||
self.assertEqual("pyproject.toml", finding.source)
|
||||
self.assertEqual("1.2.4", finding.expected)
|
||||
self.assertEqual("1.2.3", finding.actual)
|
||||
self.assertIn("Regenerate lockfiles", finding.remediation)
|
||||
self.assertEqual("resolve_release_gate", plan.recommended_action.id)
|
||||
self.assertEqual("govoplan-files", plan.recommended_action.repo)
|
||||
steps = {step.id: step for step in plan.dry_run_steps}
|
||||
self.assertEqual("planned", steps["govoplan-files:version"].status)
|
||||
self.assertEqual("planned", steps["govoplan-files:commit"].status)
|
||||
self.assertIn("pyproject.toml", steps["govoplan-files:version"].detail)
|
||||
self.assertTrue(
|
||||
any(
|
||||
"version metadata will be updated" in warning
|
||||
for warning in plan.units[0].warnings
|
||||
)
|
||||
)
|
||||
self.assertIn("python-package", plan.units[0].capabilities)
|
||||
|
||||
def test_aligned_target_recommends_non_mutating_tag_preview(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
@@ -74,6 +79,91 @@ class ReleasePlanGuidanceTests(unittest.TestCase):
|
||||
self.assertEqual("preview_source_release", plan.recommended_action.id)
|
||||
self.assertIn("Preview Tag + Publish", plan.recommended_action.remediation)
|
||||
|
||||
def test_mixed_plan_tags_modules_before_core_and_aligns_before_push(
|
||||
self,
|
||||
) -> None:
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
workspace = Path(temp_dir)
|
||||
for repo_name in ("govoplan-core", "govoplan-files"):
|
||||
repo_path = workspace / repo_name
|
||||
repo_path.mkdir()
|
||||
(repo_path / "pyproject.toml").write_text(
|
||||
f'[project]\nname = "{repo_name}"\nversion = "1.2.3"\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
repositories = tuple(
|
||||
RepositorySnapshot(
|
||||
spec=RepositorySpec(
|
||||
name=repo_name,
|
||||
category="core" if repo_name == "govoplan-core" else "module",
|
||||
subtype="platform" if repo_name == "govoplan-core" else "infrastructure",
|
||||
remote=f"git@example.test:GovOPlaN/{repo_name}.git",
|
||||
path=repo_name,
|
||||
),
|
||||
absolute_path=str(workspace / repo_name),
|
||||
exists=True,
|
||||
is_git=True,
|
||||
has_head=True,
|
||||
branch="main",
|
||||
versions=VersionSnapshot(pyproject="1.2.3"),
|
||||
local_target_tag_exists=False,
|
||||
)
|
||||
for repo_name in ("govoplan-core", "govoplan-files")
|
||||
)
|
||||
base = dashboard(workspace=workspace, version="1.2.3")
|
||||
mixed = ReleaseDashboard(
|
||||
generated_at=base.generated_at,
|
||||
meta_root=base.meta_root,
|
||||
workspace_root=base.workspace_root,
|
||||
target_version=None,
|
||||
target_tag=None,
|
||||
online=False,
|
||||
include_migrations=False,
|
||||
summary=DashboardSummary(
|
||||
repository_count=2,
|
||||
missing_count=0,
|
||||
dirty_count=0,
|
||||
ahead_count=0,
|
||||
behind_count=0,
|
||||
no_head_count=0,
|
||||
error_count=0,
|
||||
safe_directory_count=0,
|
||||
local_target_tag_missing_count=0,
|
||||
status="ready",
|
||||
),
|
||||
repositories=repositories,
|
||||
catalog=base.catalog,
|
||||
)
|
||||
plan = build_selective_release_plan(
|
||||
mixed,
|
||||
selected_repos=("govoplan-core", "govoplan-files"),
|
||||
repo_versions={
|
||||
"govoplan-core": "1.2.3",
|
||||
"govoplan-files": "1.2.3",
|
||||
},
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
["govoplan-files", "govoplan-core"],
|
||||
[unit.repo for unit in plan.units],
|
||||
)
|
||||
step_ids = [step.id for step in plan.dry_run_steps]
|
||||
self.assertLess(
|
||||
step_ids.index("govoplan-files:tag"),
|
||||
step_ids.index("govoplan-core:tag"),
|
||||
)
|
||||
self.assertLess(
|
||||
step_ids.index("govoplan-core:tag"),
|
||||
step_ids.index("release:alignment"),
|
||||
)
|
||||
self.assertLess(
|
||||
step_ids.index("release:alignment"),
|
||||
step_ids.index("govoplan-files:push"),
|
||||
)
|
||||
self.assertEqual("release:install-verify", step_ids[-1])
|
||||
core = next(unit for unit in plan.units if unit.repo == "govoplan-core")
|
||||
self.assertIn("core-release-bundle", core.capabilities)
|
||||
|
||||
def test_malformed_version_metadata_is_a_structured_blocker(self) -> None:
|
||||
cases = (
|
||||
("package.json", "{not-json\n", "JSONDecodeError"),
|
||||
@@ -167,7 +257,8 @@ class ReleasePlanGuidanceTests(unittest.TestCase):
|
||||
self.assertIn("data-run-step-id", webui)
|
||||
self.assertIn("invalidateReleaseDraft", webui)
|
||||
self.assertIn("Installation Verification", webui)
|
||||
self.assertIn("external release-integration CI gate", webui)
|
||||
self.assertIn("receipt-bound local gate", webui)
|
||||
self.assertIn('step.id === "release:install-verify"', webui)
|
||||
self.assertIn('const inspectionNotices = (summary.missing_count || 0)', webui)
|
||||
self.assertIn('(summary.repository_count || 0) === 0', webui)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user