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,7 +1,7 @@
# [DEF:test_clean_release_cli:Module]
# @RELATION: BELONGS_TO -> SrcRoot
# #region test_clean_release_cli [C:2] [TYPE Module]
# @RELATION BINDS_TO -> SrcRoot
# @PURPOSE: Smoke tests for the redesigned clean release CLI.
# @LAYER: Domain
# @LAYER Domain
"""Smoke tests for the redesigned clean release CLI commands."""
@@ -20,8 +20,8 @@ from src.scripts.clean_release_cli import main as cli_main
from src.services.clean_release.enums import CandidateStatus, ComplianceDecision
# [DEF:test_cli_candidate_register_scaffold:Function]
# @RELATION: BINDS_TO -> test_clean_release_cli
# #region test_cli_candidate_register_scaffold [C:2] [TYPE 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."""
@@ -41,11 +41,11 @@ def test_cli_candidate_register_scaffold() -> None:
assert exit_code == 0
# [/DEF:test_cli_candidate_register_scaffold:Function]
# #endregion test_cli_candidate_register_scaffold
# [DEF:test_cli_manifest_build_scaffold:Function]
# @RELATION: BINDS_TO -> test_clean_release_cli
# #region test_cli_manifest_build_scaffold [C:2] [TYPE 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."""
@@ -93,11 +93,11 @@ def test_cli_manifest_build_scaffold() -> None:
assert manifest_exit == 0
# [/DEF:test_cli_manifest_build_scaffold:Function]
# #endregion test_cli_manifest_build_scaffold
# [DEF:test_cli_compliance_run_scaffold:Function]
# @RELATION: BINDS_TO -> test_clean_release_cli
# #region test_cli_compliance_run_scaffold [C:2] [TYPE 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."""
@@ -204,11 +204,11 @@ def test_cli_compliance_run_scaffold() -> None:
assert report_exit == 0
# [/DEF:test_cli_compliance_run_scaffold:Function]
# #endregion test_cli_compliance_run_scaffold
# [DEF:test_cli_release_gate_commands_scaffold:Function]
# @RELATION: BINDS_TO -> test_clean_release_cli
# #region test_cli_release_gate_commands_scaffold [C:2] [TYPE 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."""
@@ -339,5 +339,5 @@ def test_cli_release_gate_commands_scaffold() -> None:
assert revoke_exit == 0
# [/DEF:test_cli_release_gate_commands_scaffold:Function]
# [/DEF:test_clean_release_cli:Module]
# #endregion test_cli_release_gate_commands_scaffold
# #endregion test_clean_release_cli

View File

@@ -1,8 +1,8 @@
# [DEF:TestCleanReleaseTui:Module]
# @RELATION: BELONGS_TO -> SrcRoot
# #region TestCleanReleaseTui [C:2] [TYPE Module]
# @RELATION BINDS_TO -> SrcRoot
# @SEMANTICS: tests, tui, clean-release, curses
# @PURPOSE: Unit tests for the interactive curses TUI of the clean release process.
# @LAYER: Scripts
# @LAYER Tests
# @INVARIANT: TUI initializes, handles hotkeys (F5, F10) and safely falls back without TTY.
import curses
@@ -25,8 +25,8 @@ def mock_stdscr() -> MagicMock:
return stdscr
# [DEF:test_headless_fallback:Function]
# @RELATION: BINDS_TO -> TestCleanReleaseTui
# #region test_headless_fallback [C:2] [TYPE Function]
# @RELATION BINDS_TO -> TestCleanReleaseTui
def test_headless_fallback(capsys):
"""
@TEST_EDGE: stdout_unavailable
@@ -44,11 +44,11 @@ def test_headless_fallback(capsys):
assert "Use CLI/API workflow instead" in captured.err
# [/DEF:test_headless_fallback:Function]
# #endregion test_headless_fallback
@patch("src.scripts.clean_release_tui.curses")
# [DEF:test_tui_initial_render:Function]
# @RELATION: BINDS_TO -> TestCleanReleaseTui
# #region test_tui_initial_render [C:2] [TYPE Function]
# @RELATION BINDS_TO -> TestCleanReleaseTui
def test_tui_initial_render(mock_curses_module, mock_stdscr: MagicMock):
"""
Simulates the initial rendering cycle of the TUI application to ensure
@@ -81,11 +81,11 @@ def test_tui_initial_render(mock_curses_module, mock_stdscr: MagicMock):
assert any("F5 Run" in str(call) for call in addstr_calls)
# [/DEF:test_tui_initial_render:Function]
# #endregion test_tui_initial_render
@patch("src.scripts.clean_release_tui.curses")
# [DEF:test_tui_run_checks_f5:Function]
# @RELATION: BINDS_TO -> TestCleanReleaseTui
# #region test_tui_run_checks_f5 [C:2] [TYPE Function]
# @RELATION BINDS_TO -> TestCleanReleaseTui
def test_tui_run_checks_f5(mock_curses_module, mock_stdscr: MagicMock):
"""
Simulates pressing F5 to transition into the RUNNING checks flow.
@@ -120,11 +120,11 @@ def test_tui_run_checks_f5(mock_curses_module, mock_stdscr: MagicMock):
assert len(app.violations_list) > 0
# [/DEF:test_tui_run_checks_f5:Function]
# #endregion test_tui_run_checks_f5
@patch("src.scripts.clean_release_tui.curses")
# [DEF:test_tui_exit_f10:Function]
# @RELATION: BINDS_TO -> TestCleanReleaseTui
# #region test_tui_exit_f10 [C:2] [TYPE Function]
# @RELATION BINDS_TO -> TestCleanReleaseTui
def test_tui_exit_f10(mock_curses_module, mock_stdscr: MagicMock):
"""
Simulates pressing F10 to exit the application immediately without running checks.
@@ -141,11 +141,11 @@ def test_tui_exit_f10(mock_curses_module, mock_stdscr: MagicMock):
assert app.status == "READY"
# [/DEF:test_tui_exit_f10:Function]
# #endregion test_tui_exit_f10
@patch("src.scripts.clean_release_tui.curses")
# [DEF:test_tui_clear_history_f7:Function]
# @RELATION: BINDS_TO -> TestCleanReleaseTui
# #region test_tui_clear_history_f7 [C:2] [TYPE Function]
# @RELATION BINDS_TO -> TestCleanReleaseTui
def test_tui_clear_history_f7(mock_curses_module, mock_stdscr: MagicMock):
"""
Simulates pressing F7 to clear history.
@@ -169,16 +169,16 @@ def test_tui_clear_history_f7(mock_curses_module, mock_stdscr: MagicMock):
assert len(app.checks_progress) == 0
# [/DEF:test_tui_clear_history_f7:Function]
# #endregion test_tui_clear_history_f7
@patch("src.scripts.clean_release_tui.curses")
# [DEF:test_tui_real_mode_bootstrap_imports_artifacts_catalog:Function]
# @RELATION: BINDS_TO -> TestCleanReleaseTui
# #region test_tui_real_mode_bootstrap_imports_artifacts_catalog [C:2] [TYPE Function]
# @RELATION BINDS_TO -> TestCleanReleaseTui
def test_tui_real_mode_bootstrap_imports_artifacts_catalog(
mock_curses_module,
mock_stdscr: MagicMock,
tmp_path,
# [/DEF:test_tui_real_mode_bootstrap_imports_artifacts_catalog:Function]
# #endregion test_tui_real_mode_bootstrap_imports_artifacts_catalog
):
"""
@@ -242,4 +242,4 @@ def test_tui_real_mode_bootstrap_imports_artifacts_catalog(
assert artifacts[0].detected_category == "core"
# [/DEF:TestCleanReleaseTui:Module]
# #endregion TestCleanReleaseTui

View File

@@ -1,7 +1,7 @@
# [DEF:test_clean_release_tui_v2:Module]
# @RELATION: BELONGS_TO -> SrcRoot
# #region test_clean_release_tui_v2 [C:2] [TYPE Module]
# @RELATION BINDS_TO -> SrcRoot
# @PURPOSE: Smoke tests for thin-client TUI action dispatch and blocked transition behavior.
# @LAYER: Domain
# @LAYER Domain
"""Smoke tests for the redesigned clean release TUI."""
@@ -14,8 +14,8 @@ from src.models.clean_release import CheckFinalStatus
from src.scripts.clean_release_tui import CleanReleaseTUI, main
# [DEF:_build_mock_stdscr:Function]
# @RELATION: BINDS_TO -> test_clean_release_tui_v2
# #region _build_mock_stdscr [C:2] [TYPE Function]
# @RELATION BINDS_TO -> test_clean_release_tui_v2
# @PURPOSE: Build deterministic curses screen mock with default terminal geometry and exit key.
def _build_mock_stdscr() -> MagicMock:
stdscr = MagicMock()
@@ -24,12 +24,12 @@ def _build_mock_stdscr() -> MagicMock:
return stdscr
# [/DEF:_build_mock_stdscr:Function]
# #endregion _build_mock_stdscr
@patch("src.scripts.clean_release_tui.curses")
# [DEF:test_tui_f5_dispatches_run_action:Function]
# @RELATION: BINDS_TO -> test_clean_release_tui_v2
# #region test_tui_f5_dispatches_run_action [C:2] [TYPE Function]
# @RELATION BINDS_TO -> test_clean_release_tui_v2
# @PURPOSE: Verify F5 key dispatch invokes run_checks exactly once before graceful exit.
def test_tui_f5_dispatches_run_action(mock_curses_module: MagicMock) -> None:
"""F5 should dispatch run action from TUI loop."""
@@ -48,12 +48,12 @@ def test_tui_f5_dispatches_run_action(mock_curses_module: MagicMock) -> None:
run_checks_mock.assert_called_once_with()
# [/DEF:test_tui_f5_dispatches_run_action:Function]
# #endregion test_tui_f5_dispatches_run_action
@patch("src.scripts.clean_release_tui.curses")
# [DEF:test_tui_f5_run_smoke_reports_blocked_state:Function]
# @RELATION: BINDS_TO -> test_clean_release_tui_v2
# #region test_tui_f5_run_smoke_reports_blocked_state [C:2] [TYPE Function]
# @RELATION BINDS_TO -> test_clean_release_tui_v2
# @PURPOSE: Verify blocked compliance state is surfaced after F5-triggered run action.
def test_tui_f5_run_smoke_reports_blocked_state(mock_curses_module: MagicMock) -> None:
"""F5 smoke test should expose blocked outcome state after run action."""
@@ -79,11 +79,11 @@ def test_tui_f5_run_smoke_reports_blocked_state(mock_curses_module: MagicMock) -
assert app.violations_list
# [/DEF:test_tui_f5_run_smoke_reports_blocked_state:Function]
# #endregion test_tui_f5_run_smoke_reports_blocked_state
# [DEF:test_tui_non_tty_refuses_startup:Function]
# @RELATION: BINDS_TO -> test_clean_release_tui_v2
# #region test_tui_non_tty_refuses_startup [C:2] [TYPE Function]
# @RELATION BINDS_TO -> test_clean_release_tui_v2
# @PURPOSE: Verify non-TTY execution returns exit code 2 with actionable stderr guidance.
def test_tui_non_tty_refuses_startup(capsys) -> None:
"""Non-TTY startup must refuse TUI mode and redirect operator to CLI/API flow."""
@@ -96,12 +96,12 @@ def test_tui_non_tty_refuses_startup(capsys) -> None:
assert "Use CLI/API workflow instead" in captured.err
# [/DEF:test_tui_non_tty_refuses_startup:Function]
# #endregion test_tui_non_tty_refuses_startup
@patch("src.scripts.clean_release_tui.curses")
# [DEF:test_tui_f8_blocked_without_facade_binding:Function]
# @RELATION: BINDS_TO -> test_clean_release_tui_v2
# #region test_tui_f8_blocked_without_facade_binding [C:2] [TYPE Function]
# @RELATION BINDS_TO -> test_clean_release_tui_v2
# @PURPOSE: Verify F8 path reports disabled action instead of mutating hidden facade state.
def test_tui_f8_blocked_without_facade_binding(mock_curses_module: MagicMock) -> None:
"""F8 should not perform hidden state mutation when facade action is not bound."""
@@ -120,5 +120,5 @@ def test_tui_f8_blocked_without_facade_binding(mock_curses_module: MagicMock) ->
assert "F8 disabled" in app.last_error
# [/DEF:test_tui_f8_blocked_without_facade_binding:Function]
# [/DEF:test_clean_release_tui_v2:Module]
# #endregion test_tui_f8_blocked_without_facade_binding
# #endregion test_clean_release_tui_v2