fix(backend): sprint 4 post-review — relative paths + dead branch removal
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -225,10 +225,5 @@ def transition(
|
|||||||
|
|
||||||
simulation.status = SimulationStatus(to_status)
|
simulation.status = SimulationStatus(to_status)
|
||||||
simulation.updated_at = datetime.now(UTC)
|
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()
|
db.session.commit()
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
"""Sprint 4 — engagement auto-status planned→active (AC-19)."""
|
"""Sprint 4 — engagement auto-status planned→active (AC-19)."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import pathlib
|
||||||
|
|
||||||
from flask.testing import FlaskClient
|
from flask.testing import FlaskClient
|
||||||
|
|
||||||
from backend.tests.conftest import auth_headers as _h
|
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
|
import alembic.op as _op_module
|
||||||
_op_module._proxy = ops # type: ignore[attr-defined]
|
_op_module._proxy = ops # type: ignore[attr-defined]
|
||||||
|
|
||||||
spec = importlib.util.spec_from_file_location(
|
_mig_path = (
|
||||||
"mig_0004",
|
pathlib.Path(__file__).parent.parent
|
||||||
"/home/user/Documents/01_Projects/mimic/.claude/worktrees/sprint-4-ui-polish/backend/migrations/versions/0004_simulation_tactic_ids.py",
|
/ "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
|
assert spec is not None and spec.loader is not None
|
||||||
mig = importlib.util.module_from_spec(spec)
|
mig = importlib.util.module_from_spec(spec)
|
||||||
spec.loader.exec_module(mig) # type: ignore[union-attr]
|
spec.loader.exec_module(mig) # type: ignore[union-attr]
|
||||||
|
|||||||
@@ -405,10 +405,11 @@ def test_migration_0003_techniques_not_null_after_upgrade() -> None:
|
|||||||
import alembic.op as _op_module
|
import alembic.op as _op_module
|
||||||
_op_module._proxy = ops # type: ignore[attr-defined]
|
_op_module._proxy = ops # type: ignore[attr-defined]
|
||||||
|
|
||||||
spec = importlib.util.spec_from_file_location(
|
_mig_path = (
|
||||||
"mig_0003",
|
pathlib.Path(__file__).parent.parent
|
||||||
"/home/user/Documents/01_Projects/mimic/.claude/worktrees/sprint-4-ui-polish/backend/migrations/versions/0003_simulation_techniques_array.py",
|
/ "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
|
assert spec is not None and spec.loader is not None
|
||||||
mig = importlib.util.module_from_spec(spec)
|
mig = importlib.util.module_from_spec(spec)
|
||||||
spec.loader.exec_module(mig) # type: ignore[union-attr]
|
spec.loader.exec_module(mig) # type: ignore[union-attr]
|
||||||
|
|||||||
Reference in New Issue
Block a user