From 988de841e5659d68a5e2ffffcd82eb641a9513b4 Mon Sep 17 00:00:00 2001 From: Knacky Date: Wed, 27 May 2026 20:39:37 +0200 Subject: [PATCH] =?UTF-8?q?fix(backend):=20sprint=204=20post-review=20?= =?UTF-8?q?=E2=80=94=20relative=20paths=20+=20dead=20branch=20removal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - test_engagement_lifecycle.py, test_simulations_techniques.py: replace hardcoded absolute paths with Path(__file__).parent.parent / migrations/... (portable) - simulation_workflow.py: remove dead branch in transition() — the IN_PROGRESS hook was unreachable since _ALLOWED_TRANSITIONS only targets review_required/done Co-Authored-By: Claude Sonnet 4.6 --- backend/app/services/simulation_workflow.py | 5 ----- backend/tests/test_engagement_lifecycle.py | 9 ++++++--- backend/tests/test_simulations_techniques.py | 7 ++++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/backend/app/services/simulation_workflow.py b/backend/app/services/simulation_workflow.py index 03f6386..cb0b1c5 100644 --- a/backend/app/services/simulation_workflow.py +++ b/backend/app/services/simulation_workflow.py @@ -225,10 +225,5 @@ def transition( simulation.status = SimulationStatus(to_status) simulation.updated_at = datetime.now(UTC) - - # Hook: auto-activate engagement when simulation enters in_progress via manual transition. - if simulation.status == SimulationStatus.IN_PROGRESS: - _maybe_activate_engagement(simulation) - db.session.commit() return None diff --git a/backend/tests/test_engagement_lifecycle.py b/backend/tests/test_engagement_lifecycle.py index b3f0c26..d2e5e81 100644 --- a/backend/tests/test_engagement_lifecycle.py +++ b/backend/tests/test_engagement_lifecycle.py @@ -1,6 +1,8 @@ """Sprint 4 — engagement auto-status planned→active (AC-19).""" from __future__ import annotations +import pathlib + from flask.testing import FlaskClient from backend.tests.conftest import auth_headers as _h @@ -156,10 +158,11 @@ def test_migration_0004_tactic_ids_not_null_after_upgrade() -> None: import alembic.op as _op_module _op_module._proxy = ops # type: ignore[attr-defined] - spec = importlib.util.spec_from_file_location( - "mig_0004", - "/home/user/Documents/01_Projects/mimic/.claude/worktrees/sprint-4-ui-polish/backend/migrations/versions/0004_simulation_tactic_ids.py", + _mig_path = ( + pathlib.Path(__file__).parent.parent + / "migrations" / "versions" / "0004_simulation_tactic_ids.py" ) + spec = importlib.util.spec_from_file_location("mig_0004", _mig_path) assert spec is not None and spec.loader is not None mig = importlib.util.module_from_spec(spec) spec.loader.exec_module(mig) # type: ignore[union-attr] diff --git a/backend/tests/test_simulations_techniques.py b/backend/tests/test_simulations_techniques.py index d4e882e..c0e9030 100644 --- a/backend/tests/test_simulations_techniques.py +++ b/backend/tests/test_simulations_techniques.py @@ -405,10 +405,11 @@ def test_migration_0003_techniques_not_null_after_upgrade() -> None: import alembic.op as _op_module _op_module._proxy = ops # type: ignore[attr-defined] - spec = importlib.util.spec_from_file_location( - "mig_0003", - "/home/user/Documents/01_Projects/mimic/.claude/worktrees/sprint-4-ui-polish/backend/migrations/versions/0003_simulation_techniques_array.py", + _mig_path = ( + pathlib.Path(__file__).parent.parent + / "migrations" / "versions" / "0003_simulation_techniques_array.py" ) + spec = importlib.util.spec_from_file_location("mig_0003", _mig_path) assert spec is not None and spec.loader is not None mig = importlib.util.module_from_spec(spec) spec.loader.exec_module(mig) # type: ignore[union-attr]