Files
cleveragents-core/features/container_resolve_crash.feature
hurui200320 2651e15854 fix(cli): replace non-existent Container.resolve() with named provider calls
The three plan.py call sites (tree, explain, correct) that originally used
container.resolve(DecisionService) were already fixed in master. This commit
completes the fix by aligning the Robot Framework test mocks to match the
corrected production code:

- robot/helper_m3_decision_validation_smoke.py: mock_container.resolve →
  mock_container.decision_service (plan correct dry-run path)
- robot/helper_m4_correction_subplan_smoke.py: container.resolve →
  container.decision_service (correction subplan path)

Both helpers previously passed silently because MagicMock auto-creates any
attribute, masking the mismatch between mock setup and actual code. Added
spec=Container to both mock containers so that accessing non-existent
attributes raises AttributeError, matching real container behavior.

Updated comment wording in features/container_resolve_crash.feature to
clarify that the bug is fixed and the scenarios serve as permanent
regression guards. The @tdd_expected_fail tag was already removed by the
TDD branch before this fix branch was created; the permanent @tdd_issue
and @tdd_issue_647 tags remain per TDD tag lifecycle rules.

Added CHANGELOG.md entry describing the fix.

ISSUES CLOSED: #647
2026-03-30 04:45:56 +00:00

28 lines
1.3 KiB
Gherkin

@tdd_issue @tdd_issue_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 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.
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