fix: finalize semantic repair and test updates
This commit is contained in:
@@ -13,13 +13,19 @@ from src.dependencies import get_clean_release_repository, get_config_manager
|
||||
from datetime import datetime, timezone
|
||||
from uuid import uuid4
|
||||
|
||||
from src.models.clean_release import CleanPolicySnapshot, ComplianceReport, ReleaseCandidate, SourceRegistrySnapshot
|
||||
from src.models.clean_release import (
|
||||
CleanPolicySnapshot,
|
||||
ComplianceReport,
|
||||
ReleaseCandidate,
|
||||
SourceRegistrySnapshot,
|
||||
)
|
||||
from src.services.clean_release.enums import CandidateStatus, ComplianceDecision
|
||||
from src.scripts.clean_release_cli import main as cli_main
|
||||
|
||||
|
||||
# [DEF:test_cli_candidate_register_scaffold:Function]
|
||||
# @RELATION: BINDS_TO -> test_clean_release_cli
|
||||
# @PURPOSE: Verify candidate-register command exits successfully for valid required arguments.
|
||||
def test_cli_candidate_register_scaffold() -> None:
|
||||
"""Candidate register CLI command smoke test."""
|
||||
exit_code = cli_main(
|
||||
@@ -40,8 +46,10 @@ def test_cli_candidate_register_scaffold() -> None:
|
||||
|
||||
# [/DEF:test_cli_candidate_register_scaffold:Function]
|
||||
|
||||
|
||||
# [DEF:test_cli_manifest_build_scaffold:Function]
|
||||
# @RELATION: BINDS_TO -> test_clean_release_cli
|
||||
# @PURPOSE: Verify candidate-register/artifact-import/manifest-build smoke path succeeds end-to-end.
|
||||
def test_cli_manifest_build_scaffold() -> None:
|
||||
"""Manifest build CLI command smoke test."""
|
||||
register_exit = cli_main(
|
||||
@@ -90,8 +98,10 @@ def test_cli_manifest_build_scaffold() -> None:
|
||||
|
||||
# [/DEF:test_cli_manifest_build_scaffold:Function]
|
||||
|
||||
|
||||
# [DEF:test_cli_compliance_run_scaffold:Function]
|
||||
# @RELATION: BINDS_TO -> test_clean_release_cli
|
||||
# @PURPOSE: Verify compliance run/status/violations/report commands complete for prepared candidate.
|
||||
def test_cli_compliance_run_scaffold() -> None:
|
||||
"""Compliance CLI command smoke test for run/status/report/violations."""
|
||||
repository = get_clean_release_repository()
|
||||
@@ -119,6 +129,7 @@ def test_cli_compliance_run_scaffold() -> None:
|
||||
|
||||
config = config_manager.get_config()
|
||||
if getattr(config, "settings", None) is None:
|
||||
# @INVARIANT: SimpleNamespace substitutes for GlobalSettings — any field rename in GlobalSettings will silently not propagate here; re-verify on GlobalSettings schema changes.
|
||||
config.settings = SimpleNamespace()
|
||||
config.settings.clean_release = SimpleNamespace(
|
||||
active_policy_id=policy.id,
|
||||
@@ -180,7 +191,11 @@ def test_cli_compliance_run_scaffold() -> None:
|
||||
)
|
||||
assert run_exit == 0
|
||||
|
||||
run_id = next(run.id for run in repository.check_runs.values() if run.candidate_id == "cli-candidate-3")
|
||||
run_id = next(
|
||||
run.id
|
||||
for run in repository.check_runs.values()
|
||||
if run.candidate_id == "cli-candidate-3"
|
||||
)
|
||||
|
||||
status_exit = cli_main(["compliance-status", "--run-id", run_id, "--json"])
|
||||
assert status_exit == 0
|
||||
@@ -194,8 +209,10 @@ def test_cli_compliance_run_scaffold() -> None:
|
||||
|
||||
# [/DEF:test_cli_compliance_run_scaffold:Function]
|
||||
|
||||
|
||||
# [DEF:test_cli_release_gate_commands_scaffold:Function]
|
||||
# @RELATION: BINDS_TO -> test_clean_release_cli
|
||||
# @PURPOSE: Verify approve/reject/publish/revoke release-gate commands execute with valid fixtures.
|
||||
def test_cli_release_gate_commands_scaffold() -> None:
|
||||
"""Release gate CLI smoke test for approve/reject/publish/revoke commands."""
|
||||
repository = get_clean_release_repository()
|
||||
@@ -231,7 +248,11 @@ def test_cli_release_gate_commands_scaffold() -> None:
|
||||
run_id=f"run-{uuid4()}",
|
||||
candidate_id=approved_candidate_id,
|
||||
final_status=ComplianceDecision.PASSED.value,
|
||||
summary_json={"operator_summary": "ok", "violations_count": 0, "blocking_violations_count": 0},
|
||||
summary_json={
|
||||
"operator_summary": "ok",
|
||||
"violations_count": 0,
|
||||
"blocking_violations_count": 0,
|
||||
},
|
||||
generated_at=datetime.now(timezone.utc),
|
||||
immutable=True,
|
||||
)
|
||||
@@ -242,7 +263,11 @@ def test_cli_release_gate_commands_scaffold() -> None:
|
||||
run_id=f"run-{uuid4()}",
|
||||
candidate_id=rejected_candidate_id,
|
||||
final_status=ComplianceDecision.PASSED.value,
|
||||
summary_json={"operator_summary": "ok", "violations_count": 0, "blocking_violations_count": 0},
|
||||
summary_json={
|
||||
"operator_summary": "ok",
|
||||
"violations_count": 0,
|
||||
"blocking_violations_count": 0,
|
||||
},
|
||||
generated_at=datetime.now(timezone.utc),
|
||||
immutable=True,
|
||||
)
|
||||
@@ -317,5 +342,5 @@ def test_cli_release_gate_commands_scaffold() -> None:
|
||||
assert revoke_exit == 0
|
||||
|
||||
|
||||
# [/DEF:test_clean_release_cli:Module]
|
||||
# [/DEF:test_cli_release_gate_commands_scaffold:Function]
|
||||
# [/DEF:test_clean_release_cli:Module]
|
||||
|
||||
Reference in New Issue
Block a user