Files
cleveragents-core/features/container_resolve_crash.feature
aditya 36c36bc0ee test(cli): add regression-guard tests for Container.resolve() crash
Add Behave and Robot Framework regression tests for bug #647, where
plan tree, plan explain, and plan correct CLI commands crashed with
AttributeError when resolving DecisionService from the DI container.

Tests use a real DI container with seeded decisions (not MagicMock)
to catch the exact class of bug that existing M3 tests missed.
Assertions verify successful execution and command-specific output
content. Includes Settings.reset() classmethod for robust singleton
cleanup in test teardown.

Review feedback addressed (hurui200320 Round 5):
- Fixed Behave step engine leak by capturing UoW in cleanup closure
- Removed dead @then decorator; renamed to private _assert_command_succeeded
- Strengthened plan correct assertions with revert/dry-run content checks
- Updated misleading get_container() comment to reflect singleton warming
- Added test-only warning to Settings.reset() docstring
- Added type annotations to 4 settings step functions
- Fixed CONTRIBUTORS.md alphabetical ordering and removed duplicate entry
- Replaced glob.glob with pathlib suffix iteration in Robot helper
- Fixed feature description line break for readability
- Removed redundant TYPE_CHECKING import for Decision

ISSUES CLOSED: #648
2026-03-24 08:46:58 +00:00

29 lines
1.4 KiB
Gherkin

@tdd_bug @tdd_bug_647
Feature: Container.resolve() crash in plan tree/explain/correct commands
Regression guard for bug #647, where these CLI commands previously
crashed when resolving DecisionService from the DI container.
These tests use a REAL DI container (not MagicMock). Existing M3 tests missed
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.
`plan correct` is intentionally exercised with `--dry-run` in this
real-container path so no live LLM execution is triggered.
Background:
Given cr647- a real DI container with seeded decisions
Scenario: plan tree command regression guard for container.resolve() crash
When cr647- I invoke the plan tree CLI command with a real container
Then cr647- plan tree output should include seeded decision id
Scenario: plan explain command regression guard for container.resolve() crash
When cr647- I invoke the plan explain CLI command with a real container
Then cr647- plan explain output should include seeded decision details
Scenario: plan correct command regression guard for container.resolve() crash
When cr647- I invoke the plan correct CLI command with a real container
Then cr647- plan correct output should reference seeded decision