feat: Introduce and enforce test contract annotations for critical modules and update coverage tracking.
This commit is contained in:
@@ -48,6 +48,33 @@ def test_orchestrator_stage_failure_blocks_release():
|
||||
# [/DEF:test_orchestrator_stage_failure_blocks_release:Function]
|
||||
|
||||
|
||||
# [DEF:test_orchestrator_compliant_candidate:Function]
|
||||
# @PURPOSE: Verify happy path where all mandatory stages pass yields COMPLIANT.
|
||||
def test_orchestrator_compliant_candidate():
|
||||
repository = CleanReleaseRepository()
|
||||
orchestrator = CleanComplianceOrchestrator(repository)
|
||||
|
||||
run = orchestrator.start_check_run(
|
||||
candidate_id="2026.03.03-rc1",
|
||||
policy_id="policy-enterprise-clean-v1",
|
||||
triggered_by="tester",
|
||||
execution_mode="tui",
|
||||
)
|
||||
run = orchestrator.execute_stages(
|
||||
run,
|
||||
forced_results=[
|
||||
CheckStageResult(stage=CheckStageName.DATA_PURITY, status=CheckStageStatus.PASS, details="ok"),
|
||||
CheckStageResult(stage=CheckStageName.INTERNAL_SOURCES_ONLY, status=CheckStageStatus.PASS, details="ok"),
|
||||
CheckStageResult(stage=CheckStageName.NO_EXTERNAL_ENDPOINTS, status=CheckStageStatus.PASS, details="ok"),
|
||||
CheckStageResult(stage=CheckStageName.MANIFEST_CONSISTENCY, status=CheckStageStatus.PASS, details="ok"),
|
||||
],
|
||||
)
|
||||
run = orchestrator.finalize_run(run)
|
||||
|
||||
assert run.final_status == CheckFinalStatus.COMPLIANT
|
||||
# [/DEF:test_orchestrator_compliant_candidate:Function]
|
||||
|
||||
|
||||
# [DEF:test_orchestrator_missing_stage_result:Function]
|
||||
# @PURPOSE: Verify incomplete mandatory stage set cannot end as COMPLIANT and results in FAILED.
|
||||
def test_orchestrator_missing_stage_result():
|
||||
|
||||
@@ -66,6 +66,26 @@ def test_report_builder_blocked_requires_blocking_violations():
|
||||
# [/DEF:test_report_builder_blocked_requires_blocking_violations:Function]
|
||||
|
||||
|
||||
# [DEF:test_report_builder_blocked_with_two_violations:Function]
|
||||
# @PURPOSE: Verify report builder generates conformant payload for a BLOCKED run with violations.
|
||||
def test_report_builder_blocked_with_two_violations():
|
||||
builder = ComplianceReportBuilder(CleanReleaseRepository())
|
||||
run = _terminal_run(CheckFinalStatus.BLOCKED)
|
||||
v1 = _blocking_violation()
|
||||
v2 = _blocking_violation()
|
||||
v2.violation_id = "viol-2"
|
||||
v2.category = ViolationCategory.DATA_PURITY
|
||||
|
||||
report = builder.build_report_payload(run, [v1, v2])
|
||||
|
||||
assert report.check_run_id == run.check_run_id
|
||||
assert report.candidate_id == run.candidate_id
|
||||
assert report.final_status == CheckFinalStatus.BLOCKED
|
||||
assert report.violations_count == 2
|
||||
assert report.blocking_violations_count == 2
|
||||
# [/DEF:test_report_builder_blocked_with_two_violations:Function]
|
||||
|
||||
|
||||
# [DEF:test_report_builder_counter_consistency:Function]
|
||||
# @PURPOSE: Verify violations counters remain consistent for blocking payload.
|
||||
def test_report_builder_counter_consistency():
|
||||
|
||||
Reference in New Issue
Block a user