diff --git a/CHANGELOG.md b/CHANGELOG.md index 31e62213f..40cd73c00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -152,6 +152,11 @@ Framework integration tests cover override acceptance, fallback acceptance, and full persistence round-trip. Tests use `@tdd_expected_fail` until the fix is merged. (#1100) +- Fixed Robot Framework test mocks for ``plan correct`` dry-run and correction + subplan helpers to use ``container.decision_service()`` instead of the + non-existent ``container.resolve()``, matching corrected production code. + Activated regression-guard BDD scenarios for ``plan tree``, ``plan explain``, + and ``plan correct``. (#647) - Added TDD bug-capture tests for bug #1076 — `use_action()` does not propagate `automation_profile` to Plan. Three Behave BDD scenarios (`@tdd_bug @tdd_bug_1076 @tdd_expected_fail`) verify the full precedence diff --git a/features/container_resolve_crash.feature b/features/container_resolve_crash.feature index d4b8e3fef..5d8055625 100644 --- a/features/container_resolve_crash.feature +++ b/features/container_resolve_crash.feature @@ -7,8 +7,7 @@ Feature: Container.resolve() crash in plan tree/explain/correct commands this class of bug because they mock get_container() with MagicMock, which auto-creates any attribute. - NOTE: Bug #647 appears fixed; these scenarios now run as normal - regression checks for correct command behavior. + NOTE: Bug #647 is fixed; these scenarios serve as permanent regression guards. `plan correct` is intentionally exercised with `--dry-run` in this real-container path so no live LLM execution is triggered. diff --git a/robot/helper_m3_decision_validation_smoke.py b/robot/helper_m3_decision_validation_smoke.py index a282a6d89..2b81fb245 100644 --- a/robot/helper_m3_decision_validation_smoke.py +++ b/robot/helper_m3_decision_validation_smoke.py @@ -21,6 +21,7 @@ if _SRC not in sys.path: from helpers_common import reset_global_state # noqa: E402 from typer.testing import CliRunner # noqa: E402 +from cleveragents.application.container import Container # noqa: E402 from cleveragents.cli.commands.invariant import app as invariant_app # noqa: E402 from cleveragents.cli.commands.plan import app as plan_app # noqa: E402 from cleveragents.cli.commands.validation import app as validation_app # noqa: E402 @@ -275,12 +276,12 @@ def plan_correct_dry_run() -> None: mock_correction_svc.request_correction.return_value = mock_request mock_correction_svc.analyze_impact.return_value = mock_impact - # Mock DecisionService resolved via DI container (issue #606 fix) + # Mock DecisionService provider on DI container (issue #606 / #647 fix) mock_decision_svc = MagicMock() mock_decision_svc.list_decisions.return_value = [] mock_decision_svc.get_influence_edges.return_value = {} - mock_container = MagicMock() - mock_container.resolve.return_value = mock_decision_svc + mock_container = MagicMock(spec=Container) + mock_container.decision_service.return_value = mock_decision_svc with ( patch( diff --git a/robot/helper_m4_correction_subplan_smoke.py b/robot/helper_m4_correction_subplan_smoke.py index ab53f00e6..586ac822d 100644 --- a/robot/helper_m4_correction_subplan_smoke.py +++ b/robot/helper_m4_correction_subplan_smoke.py @@ -21,6 +21,7 @@ from helpers_common import reset_global_state # noqa: E402 from typer.testing import CliRunner # noqa: E402 from ulid import ULID # noqa: E402 +from cleveragents.application.container import Container # noqa: E402 from cleveragents.cli.commands.plan import app as plan_app # noqa: E402 from cleveragents.domain.models.core.correction import ( # noqa: E402 CorrectionImpact, @@ -115,12 +116,12 @@ def _mock_correction_service() -> MagicMock: def _mock_container() -> MagicMock: - """Create a mock DI container that resolves a stub DecisionService.""" + """Create a mock DI container with a stub DecisionService provider.""" mock_decision_svc = MagicMock() mock_decision_svc.list_decisions.return_value = [] mock_decision_svc.get_influence_edges.return_value = {} - container = MagicMock() - container.resolve.return_value = mock_decision_svc + container = MagicMock(spec=Container) + container.decision_service.return_value = mock_decision_svc return container