{
"file": "frontend/src/components/__tests__/task_log_viewer.test.js",
"verdict": "APPROVED",
"rejection_reason": "NONE",
"audit_details": {
"target_invoked": true,
"pre_conditions_tested": true,
"post_conditions_tested": true,
"test_fixture_used": true,
"edges_covered": true,
"invariants_verified": true,
"ux_states_tested": true,
"semantic_anchors_present": true
},
"coverage_summary": {
"total_edges": 2,
"edges_tested": 2,
"total_invariants": 1,
"invariants_tested": 1,
"total_ux_states": 3,
"ux_states_tested": 3
},
"tier_compliance": {
"source_tier": "CRITICAL",
"meets_tier_requirements": true
},
"feedback": "Remediation successful: test tier matches CRITICAL, missing missing @TEST_EDGE no_task_id coverage added, test for @UX_FEEDBACK (autoScroll) added properly, missing inline=false (show=true) tested properly. Semantic RELATION tag fixed to VERIFIES."
},
{
"file": "frontend/src/lib/components/reports/__tests__/report_card.ux.test.js",
"verdict": "APPROVED",
"rejection_reason": "NONE",
"audit_details": {
"target_invoked": true,
"pre_conditions_tested": true,
"post_conditions_tested": true,
"test_fixture_used": true,
"edges_covered": true,
"invariants_verified": true,
"ux_states_tested": true,
"semantic_anchors_present": true
},
"coverage_summary": {
"total_edges": 2,
"edges_tested": 2,
"total_invariants": 1,
"invariants_tested": 1,
"total_ux_states": 2,
"ux_states_tested": 2
},
"tier_compliance": {
"source_tier": "CRITICAL",
"meets_tier_requirements": true
},
"feedback": "Remediation successful: @TEST_EDGE random_status and @TEST_EDGE empty_report_object tests explicitly assert on outcomes, @TEST_FIXTURE tested completely, Test tier switched to CRITICAL."
},
{
"file": "backend/tests/test_logger.py",
"verdict": "APPROVED",
"rejection_reason": "NONE",
"audit_details": {
"target_invoked": true,
"pre_conditions_tested": true,
"post_conditions_tested": true,
"test_fixture_used": true,
"edges_covered": true,
"invariants_verified": true,
"ux_states_tested": false,
"semantic_anchors_present": true
},
"coverage_summary": {
"total_edges": 0,
"edges_tested": 0,
"total_invariants": 0,
"invariants_tested": 0,
"total_ux_states": 0,
"ux_states_tested": 0
},
"tier_compliance": {
"source_tier": "STANDARD",
"meets_tier_requirements": true
},
"feedback": "Remediation successful: Test module semantic anchors added [DEF] and [/DEF] explicitly. Added missing @TIER tag and @RELATION: VERIFIES -> src/core/logger.py at the top of the file."
}
]
60 lines
3.0 KiB
Python
60 lines
3.0 KiB
Python
# [DEF:backend.src.services.clean_release.report_builder:Module]
|
|
# @TIER: CRITICAL
|
|
# @SEMANTICS: clean-release, report, audit, counters, violations
|
|
# @PURPOSE: Build and persist compliance reports with consistent counter invariants.
|
|
# @LAYER: Domain
|
|
# @RELATION: DEPENDS_ON -> backend.src.models.clean_release
|
|
# @RELATION: DEPENDS_ON -> backend.src.services.clean_release.repository
|
|
# @INVARIANT: blocking_violations_count never exceeds violations_count.
|
|
# @TEST_CONTRACT: ComplianceCheckRun,List[ComplianceViolation] -> ComplianceReport
|
|
# @TEST_FIXTURE: blocked_with_two_violations -> file:backend/tests/fixtures/clean_release/fixtures_clean_release.json
|
|
# @TEST_EDGE: empty_violations_for_blocked -> BLOCKED run with zero blocking violations raises ValueError
|
|
# @TEST_EDGE: counter_mismatch -> blocking counter cannot exceed total violations counter
|
|
# @TEST_EDGE: missing_operator_summary -> non-terminal run prevents report creation and summary generation
|
|
# @TEST_INVARIANT: blocking_count_le_total_count -> VERIFIED_BY: [counter_mismatch, empty_violations_for_blocked]
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime, timezone
|
|
from uuid import uuid4
|
|
from typing import List
|
|
|
|
from ...models.clean_release import CheckFinalStatus, ComplianceCheckRun, ComplianceReport, ComplianceViolation
|
|
from .repository import CleanReleaseRepository
|
|
|
|
|
|
class ComplianceReportBuilder:
|
|
def __init__(self, repository: CleanReleaseRepository):
|
|
self.repository = repository
|
|
|
|
def build_report_payload(self, check_run: ComplianceCheckRun, violations: List[ComplianceViolation]) -> ComplianceReport:
|
|
if check_run.final_status == CheckFinalStatus.RUNNING:
|
|
raise ValueError("Cannot build report for non-terminal run")
|
|
|
|
violations_count = len(violations)
|
|
blocking_violations_count = sum(1 for v in violations if v.blocked_release)
|
|
|
|
if check_run.final_status == CheckFinalStatus.BLOCKED and blocking_violations_count <= 0:
|
|
raise ValueError("Blocked run requires at least one blocking violation")
|
|
|
|
summary = (
|
|
"Compliance passed with no blocking violations"
|
|
if check_run.final_status == CheckFinalStatus.COMPLIANT
|
|
else f"Blocked with {blocking_violations_count} blocking violation(s)"
|
|
)
|
|
|
|
return ComplianceReport(
|
|
report_id=f"CCR-{uuid4()}",
|
|
check_run_id=check_run.check_run_id,
|
|
candidate_id=check_run.candidate_id,
|
|
generated_at=datetime.now(timezone.utc),
|
|
final_status=check_run.final_status,
|
|
operator_summary=summary,
|
|
structured_payload_ref=f"inmemory://check-runs/{check_run.check_run_id}/report",
|
|
violations_count=violations_count,
|
|
blocking_violations_count=blocking_violations_count,
|
|
)
|
|
|
|
def persist_report(self, report: ComplianceReport) -> ComplianceReport:
|
|
return self.repository.save_report(report)
|
|
# [/DEF:backend.src.services.clean_release.report_builder:Module] |