work_item: ORCH-036 title: "Исполняемый самодеплой — стадия deploy дёргает хост-хук (Вариант B)" stage: analysis notes: > Все тесты — на изолированном уровне (unit/integration с моками subprocess/ssh и хука). Реальный прод (8500) НЕ трогается. Интеграционные прогоны хука — на staging-цели. Хост-хук (bash) проверяется отдельным интеграционным сценарием с поддельным health/exit-code; в pytest вызов хука мокается. tests: # --- exit-code -> deploy_status mapping (AC-1, AC-3) --- - id: TC-01 type: unit description: "Маппинг exit-code хука 0 -> deploy_status: SUCCESS" module: tests/test_deploy_hook_mapping.py expected: PASS - id: TC-02 type: unit description: "Маппинг exit-code хука 1 (rolled back) -> deploy_status: FAILED" module: tests/test_deploy_hook_mapping.py expected: PASS - id: TC-03 type: unit description: "Маппинг exit-code хука 2 (rollback тоже упал) -> deploy_status: FAILED" module: tests/test_deploy_hook_mapping.py expected: PASS # --- approve gate (AC-5, AC-12) --- - id: TC-04 type: unit description: "DEPLOY_REQUIRE_MANUAL_APPROVE дефолт == true в settings" module: tests/test_deploy_approve.py expected: PASS - id: TC-05 type: integration description: "Флаг true и нет 'go' -> прод-хук НЕ вызывается (subprocess/ssh не дёрнут)" module: tests/test_deploy_approve.py expected: PASS - id: TC-06 type: integration description: "Флаг true и есть 'go' -> прод-хук вызывается ровно один раз" module: tests/test_deploy_approve.py expected: PASS # --- self vs non-self routing (AC-2, AC-11) --- - id: TC-07 type: unit description: "is_self_hosting_repo('orchestrator') == True; иной репо -> False (не регрессировал)" module: tests/test_deploy_routing.py expected: PASS - id: TC-08 type: integration description: "self-репо orchestrator: рестарт инициируется detached/host-процессом, не синхронно из агента" module: tests/test_deploy_routing.py expected: PASS - id: TC-09 type: integration description: "не-self репо (enduro-trails): деплой идёт прежним ssh-путём, self-логика не применяется" module: tests/test_deploy_routing.py expected: PASS # --- rollback on FAILED (AC-4) --- - id: TC-10 type: integration description: "deploy_status: FAILED -> откат deploy->development, set_issue_blocked, release merge-lease" module: tests/test_deploy_rollback.py expected: PASS # --- staging precondition preserved (AC-8) --- - id: TC-11 type: integration description: "staging_status: FAILED -> до стадии deploy не доходит (откат на development)" module: tests/test_staging_precondition.py expected: PASS # --- notifications (AC-6) --- - id: TC-12 type: integration description: "Успешный промоут -> и Plane-коммент, и Telegram отправлены" module: tests/test_deploy_notifications.py expected: PASS - id: TC-13 type: integration description: "Откат -> и Plane-коммент, и Telegram отправлены (нет молчаливого деплоя)" module: tests/test_deploy_notifications.py expected: PASS # --- build-once (AC-7) --- - id: TC-14 type: integration description: "Прод-деплой использует образ staging (retag, без build) — нет шага docker build" module: tests/test_deploy_build_once.py expected: PASS # --- regression: unchanged gate contracts (AC-10) --- - id: TC-15 type: unit description: "_parse_deploy_status: SUCCESS->(True), FAILED->(False), нет frontmatter->(False) — контракт цел" module: tests/test_qg_checks.py expected: PASS - id: TC-16 type: unit description: "STAGE_TRANSITIONS deploy->done и agent/qg deploy не изменены" module: tests/test_stages.py expected: PASS - id: TC-17 type: integration description: "terminal-sync deploy->done (set_issue_done + release merge-lease) сохранён" module: tests/test_deploy_terminal_sync.py expected: PASS - id: TC-18 type: integration description: "merge-gate на ребре deploy-staging->deploy не затронут (регресс ORCH-43 зелёный)" module: tests/test_merge_gate.py expected: PASS # --- auto-rollback hook behavior (AC-9) --- - id: TC-19 type: integration description: "Симуляция битого деплоя на staging-цели: health fail -> авто-rollback -> healthy, exit 1, MTTR<60с" module: tests/test_deploy_hook_rollback_sim.py expected: PASS