semantics

This commit is contained in:
2026-05-26 09:30:41 +03:00
parent 1e7bcecaea
commit 9ffa8af1dc
623 changed files with 28045 additions and 26557 deletions

View File

@@ -1,10 +1,10 @@
# #region CleanReleaseTuiScript [C:3] [TYPE Module] [SEMANTICS clean-release, validate, compliance, release, tui-facade-adapter]
# @BRIEF Interactive terminal interface for Enterprise Clean Release compliance validation.
# @LAYER: UI
# @LAYER UI
# @RELATION DEPENDS_ON -> [ComplianceExecutionService]
# @RELATION DEPENDS_ON -> [CleanReleaseRepository]
# @INVARIANT: TUI refuses startup in non-TTY environments; headless flow is CLI/API only.
# @DATA_CONTRACT: CLIArgs -> TUIExitCode
# @INVARIANT TUI refuses startup in non-TTY environments; headless flow is CLI/API only.
# @DATA_CONTRACT CLIArgs -> TUIExitCode
import contextlib
import curses
from datetime import UTC, datetime
@@ -50,8 +50,8 @@ from src.services.clean_release.repository import CleanReleaseRepository
# #region TuiFacadeAdapter [TYPE Class]
# @BRIEF Thin TUI adapter that routes business mutations through application services.
# @PRE: repository contains candidate and trusted policy/registry snapshots for execution.
# @POST: Business actions return service results/errors without direct TUI-owned mutations.
# @PRE repository contains candidate and trusted policy/registry snapshots for execution.
# @POST Business actions return service results/errors without direct TUI-owned mutations.
class TuiFacadeAdapter:
def __init__(self, repository: CleanReleaseRepository):
self.repository = repository
@@ -186,11 +186,11 @@ class TuiFacadeAdapter:
# #endregion TuiFacadeAdapter
# #region CleanReleaseTUI [TYPE Class]
# @BRIEF Curses-based application for compliance monitoring.
# @UX_STATE: READY -> Waiting for operator to start checks (F5).
# @UX_STATE: RUNNING -> Executing compliance stages with progress feedback.
# @UX_STATE: COMPLIANT -> Release candidate passed all checks.
# @UX_STATE: BLOCKED -> Violations detected, release forbidden.
# @UX_FEEDBACK: Red alerts for BLOCKED status, Green for COMPLIANT.
# @UX_STATE READY -> Waiting for operator to start checks (F5).
# @UX_STATE RUNNING -> Executing compliance stages with progress feedback.
# @UX_STATE COMPLIANT -> Release candidate passed all checks.
# @UX_STATE BLOCKED -> Violations detected, release forbidden.
# @UX_FEEDBACK Red alerts for BLOCKED status, Green for COMPLIANT.
class CleanReleaseTUI:
def __init__(self, stdscr: curses.window):
self.stdscr = stdscr
@@ -474,10 +474,10 @@ class CleanReleaseTUI:
self.stdscr.attron(curses.color_pair(1))
self.stdscr.addstr(max_y - 1, 0, footer_text[:max_x])
self.stdscr.attroff(curses.color_pair(1))
# [DEF:run_checks:Function]
# #region run_checks
# @PURPOSE: Execute compliance run via facade adapter and update UI state.
# @PRE: Candidate and policy snapshots are present in repository.
# @POST: UI reflects final run/report/violation state from service result.
# @PRE Candidate and policy snapshots are present in repository.
# @POST UI reflects final run/report/violation state from service result.
def run_checks(self):
self.status = "RUNNING"
self.report_id = None
@@ -514,7 +514,7 @@ class CleanReleaseTUI:
self.status = CheckFinalStatus.FAILED
self.refresh_overview()
self.refresh_screen()
# [/DEF:run_checks:Function]
# #endregion run_checks
def build_manifest(self):
try:
manifest = self.facade.build_manifest(