fix(cli): replace non-existent Container.resolve() with named provider calls #1157

Merged
hurui200320 merged 1 commit from bugfix/m3-container-resolve into master 2026-03-30 05:45:10 +00:00
Member

Summary

Closes #647

Fixes the Container.resolve() crash in plan tree, plan explain, and plan correct CLI commands by aligning Robot Framework test mocks with the corrected production code.

Changes

Robot Framework Mock Alignment

  • robot/helper_m3_decision_validation_smoke.py: Updated mock from mock_container.resolve.return_value to mock_container.decision_service.return_value to match the production code path (container.decision_service()). Added spec=Container to prevent silent attribute auto-creation.
  • robot/helper_m4_correction_subplan_smoke.py: Same fix in _mock_container() helper function, also with spec=Container.

BDD Feature File Comment Update

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

CHANGELOG

  • CHANGELOG.md: Added entry under ## Unreleased describing the fix.

Context

The three container.resolve(_DS) call sites in plan.py were already replaced with container.decision_service() in master. However, two Robot test helpers still used the old mock pattern (container.resolve.return_value), which passed silently because MagicMock auto-creates any attribute. This commit completes the fix by ensuring mocks match the actual production code, and adds spec=Container to both mock containers so that any future attribute mismatches will raise AttributeError instead of passing silently.

Quality Gates

Gate Status
lint Pass
typecheck Pass (0 errors)
unit_tests 12,822 scenarios passed
integration_tests Pass
e2e_tests 56 passed, 1 skipped
coverage_report 97% (≥97%)
## Summary Closes #647 Fixes the `Container.resolve()` crash in `plan tree`, `plan explain`, and `plan correct` CLI commands by aligning Robot Framework test mocks with the corrected production code. ## Changes ### Robot Framework Mock Alignment - **`robot/helper_m3_decision_validation_smoke.py`**: Updated mock from `mock_container.resolve.return_value` to `mock_container.decision_service.return_value` to match the production code path (`container.decision_service()`). Added `spec=Container` to prevent silent attribute auto-creation. - **`robot/helper_m4_correction_subplan_smoke.py`**: Same fix in `_mock_container()` helper function, also with `spec=Container`. ### BDD Feature File Comment Update - **`features/container_resolve_crash.feature`**: Updated comment wording to clarify that bug #647 is fixed and the scenarios serve as permanent regression guards. The `@tdd_expected_fail` tag was already removed by the TDD branch prior to this fix branch being created; the permanent `@tdd_issue` and `@tdd_issue_647` tags remain per TDD tag lifecycle rules in CONTRIBUTING.md. ### CHANGELOG - **`CHANGELOG.md`**: Added entry under `## Unreleased` describing the fix. ## Context The three `container.resolve(_DS)` call sites in `plan.py` were already replaced with `container.decision_service()` in master. However, two Robot test helpers still used the old mock pattern (`container.resolve.return_value`), which passed silently because MagicMock auto-creates any attribute. This commit completes the fix by ensuring mocks match the actual production code, and adds `spec=Container` to both mock containers so that any future attribute mismatches will raise `AttributeError` instead of passing silently. ## Quality Gates | Gate | Status | |------|--------| | lint | ✅ Pass | | typecheck | ✅ Pass (0 errors) | | unit_tests | ✅ 12,822 scenarios passed | | integration_tests | ✅ Pass | | e2e_tests | ✅ 56 passed, 1 skipped | | coverage_report | ✅ 97% (≥97%) |
hurui200320 added this to the v3.2.0 milestone 2026-03-25 11:22:43 +00:00
hurui200320 force-pushed bugfix/m3-container-resolve from 9e39c5a683
Some checks failed
CI / status-check (pull_request) Blocked by required conditions
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Failing after 14s
CI / lint (pull_request) Successful in 3m22s
CI / quality (pull_request) Successful in 3m42s
CI / unit_tests (pull_request) Successful in 3m45s
CI / typecheck (pull_request) Successful in 3m55s
CI / benchmark-regression (pull_request) Has started running
CI / security (pull_request) Successful in 4m2s
CI / docker (pull_request) Successful in 9s
CI / e2e_tests (pull_request) Failing after 4m34s
CI / integration_tests (pull_request) Successful in 7m26s
CI / coverage (pull_request) Failing after 14m12s
to 021fb9985e
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 22s
CI / quality (pull_request) Successful in 3m41s
CI / lint (pull_request) Successful in 3m43s
CI / typecheck (pull_request) Successful in 4m11s
CI / security (pull_request) Successful in 4m14s
CI / integration_tests (pull_request) Successful in 6m46s
CI / unit_tests (pull_request) Successful in 7m9s
CI / docker (pull_request) Successful in 1m3s
CI / e2e_tests (pull_request) Successful in 8m24s
CI / coverage (pull_request) Successful in 10m11s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Has been cancelled
2026-03-25 12:14:58 +00:00
Compare
hurui200320 force-pushed bugfix/m3-container-resolve from 021fb9985e
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 22s
CI / quality (pull_request) Successful in 3m41s
CI / lint (pull_request) Successful in 3m43s
CI / typecheck (pull_request) Successful in 4m11s
CI / security (pull_request) Successful in 4m14s
CI / integration_tests (pull_request) Successful in 6m46s
CI / unit_tests (pull_request) Successful in 7m9s
CI / docker (pull_request) Successful in 1m3s
CI / e2e_tests (pull_request) Successful in 8m24s
CI / coverage (pull_request) Successful in 10m11s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Has been cancelled
to 946aaf0620
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 30s
CI / lint (pull_request) Successful in 38s
CI / typecheck (pull_request) Successful in 45s
CI / quality (pull_request) Successful in 3m42s
CI / security (pull_request) Successful in 4m0s
CI / integration_tests (pull_request) Successful in 8m57s
CI / unit_tests (pull_request) Successful in 9m4s
CI / docker (pull_request) Successful in 56s
CI / e2e_tests (pull_request) Successful in 8m50s
CI / coverage (pull_request) Successful in 11m22s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Successful in 1h10m22s
2026-03-25 12:34:22 +00:00
Compare
hurui200320 force-pushed bugfix/m3-container-resolve from 946aaf0620
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 30s
CI / lint (pull_request) Successful in 38s
CI / typecheck (pull_request) Successful in 45s
CI / quality (pull_request) Successful in 3m42s
CI / security (pull_request) Successful in 4m0s
CI / integration_tests (pull_request) Successful in 8m57s
CI / unit_tests (pull_request) Successful in 9m4s
CI / docker (pull_request) Successful in 56s
CI / e2e_tests (pull_request) Successful in 8m50s
CI / coverage (pull_request) Successful in 11m22s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Successful in 1h10m22s
to 3589a495ad
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 32s
CI / quality (pull_request) Successful in 6m13s
CI / lint (pull_request) Successful in 6m17s
CI / typecheck (pull_request) Successful in 6m37s
CI / security (pull_request) Successful in 6m46s
CI / integration_tests (pull_request) Successful in 9m24s
CI / unit_tests (pull_request) Successful in 9m45s
CI / docker (pull_request) Successful in 1m12s
CI / e2e_tests (pull_request) Successful in 14m16s
CI / coverage (pull_request) Successful in 12m0s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Successful in 1h1m5s
2026-03-27 10:01:05 +00:00
Compare
Owner

Code Review Note

Unable to review — the branch for this PR (expected bugfix/m3-container-resolve or similar) was not found on the remote. A TDD branch tdd/container-resolve-crash exists with regression tests but not the actual fix. Please verify the fix branch has been pushed.

## Code Review Note **Unable to review** — the branch for this PR (expected `bugfix/m3-container-resolve` or similar) was not found on the remote. A TDD branch `tdd/container-resolve-crash` exists with regression tests but not the actual fix. Please verify the fix branch has been pushed.
freemo requested changes 2026-03-28 21:32:01 +00:00
Dismissed
freemo left a comment

Day 48 Planning Review — Bug Fix PR for #647

The code fix itself (replacing Container.resolve() with named provider calls) is sound and well-scoped. However, there are blocking issues that must be resolved before merge:

  1. Merge conflictsmergeable: false. Branch must be rebased onto current master.

  2. @tdd_expected_fail removal not visible in diff — The PR description claims the tag was removed, but the diff only shows a comment rewording in features/container_resolve_crash.feature. If the tag was already absent on master before this branch was created, the description is misleading. Please clarify: was @tdd_expected_fail present on this branch before your changes? If not, remove the claim from the PR description.

  3. Tag naming mismatch — The feature file uses @tdd_issue / @tdd_issue_647 but CONTRIBUTING.md requires @tdd_bug / @tdd_bug_647. The three-tag system specified in CONTRIBUTING.md uses @tdd_bug, @tdd_bug_<N>, and @tdd_expected_fail — not @tdd_issue. Please verify and correct the tag names if needed.

  4. @freemo's comment (Mar 27) about the branch not being found on the remote — @hurui200320, please reply confirming the branch is now available and request re-review.

Requested changes: Rebase onto master, resolve tag naming, clarify @tdd_expected_fail removal, respond to @freemo's comment.

**Day 48 Planning Review — Bug Fix PR for #647** The code fix itself (replacing `Container.resolve()` with named provider calls) is sound and well-scoped. However, there are blocking issues that must be resolved before merge: 1. **Merge conflicts** — `mergeable: false`. Branch must be rebased onto current `master`. 2. **`@tdd_expected_fail` removal not visible in diff** — The PR description claims the tag was removed, but the diff only shows a comment rewording in `features/container_resolve_crash.feature`. If the tag was already absent on master before this branch was created, the description is misleading. Please clarify: was `@tdd_expected_fail` present on this branch before your changes? If not, remove the claim from the PR description. 3. **Tag naming mismatch** — The feature file uses `@tdd_issue` / `@tdd_issue_647` but CONTRIBUTING.md requires `@tdd_bug` / `@tdd_bug_647`. The three-tag system specified in CONTRIBUTING.md uses `@tdd_bug`, `@tdd_bug_<N>`, and `@tdd_expected_fail` — not `@tdd_issue`. Please verify and correct the tag names if needed. 4. **@freemo's comment (Mar 27)** about the branch not being found on the remote — @hurui200320, please reply confirming the branch is now available and request re-review. **Requested changes**: Rebase onto master, resolve tag naming, clarify `@tdd_expected_fail` removal, respond to @freemo's comment.
freemo approved these changes 2026-03-30 04:22:36 +00:00
Dismissed
freemo left a comment

Review: APPROVED

Small, focused fix. Using MagicMock(spec=Container) correctly prevents auto-creating non-existent attributes. Properly replaces the non-existent container.resolve() with actual DI provider calls.

## Review: APPROVED Small, focused fix. Using `MagicMock(spec=Container)` correctly prevents auto-creating non-existent attributes. Properly replaces the non-existent `container.resolve()` with actual DI provider calls.
hurui200320 force-pushed bugfix/m3-container-resolve from 3589a495ad
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 32s
CI / quality (pull_request) Successful in 6m13s
CI / lint (pull_request) Successful in 6m17s
CI / typecheck (pull_request) Successful in 6m37s
CI / security (pull_request) Successful in 6m46s
CI / integration_tests (pull_request) Successful in 9m24s
CI / unit_tests (pull_request) Successful in 9m45s
CI / docker (pull_request) Successful in 1m12s
CI / e2e_tests (pull_request) Successful in 14m16s
CI / coverage (pull_request) Successful in 12m0s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Successful in 1h1m5s
to 2651e15854
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / security (pull_request) Successful in 59s
CI / quality (pull_request) Successful in 37s
CI / lint (pull_request) Successful in 3m35s
CI / build (pull_request) Successful in 22s
CI / helm (pull_request) Successful in 35s
CI / typecheck (pull_request) Successful in 4m25s
CI / unit_tests (pull_request) Successful in 4m19s
CI / integration_tests (pull_request) Successful in 4m1s
CI / docker (pull_request) Successful in 11s
CI / e2e_tests (pull_request) Successful in 10m42s
CI / coverage (pull_request) Successful in 9m42s
CI / status-check (pull_request) Successful in 2s
CI / lint (push) Successful in 23s
CI / typecheck (push) Successful in 50s
CI / quality (push) Successful in 53s
CI / security (push) Successful in 1m2s
CI / benchmark-regression (push) Has been skipped
CI / build (push) Successful in 40s
CI / helm (push) Successful in 43s
CI / integration_tests (push) Successful in 4m29s
CI / unit_tests (push) Successful in 5m7s
CI / docker (push) Successful in 1m20s
CI / e2e_tests (push) Successful in 11m58s
CI / coverage (push) Successful in 14m35s
CI / status-check (push) Successful in 1s
CI / benchmark-publish (push) Successful in 33m38s
CI / benchmark-regression (pull_request) Successful in 1h2m19s
2026-03-30 05:12:51 +00:00
Compare
hurui200320 dismissed freemo's review 2026-03-30 05:12:51 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

Author
Member

Thanks for the thorough review, Jeff.

Point 2 (@tdd_expected_fail removal): You're right — the @tdd_expected_fail tag was already absent on master before this branch was created. The PR description was misleading. I've updated it to accurately reflect that only a comment rewording was made in the feature file, not a tag removal. I've also corrected the tag name references from @tdd_bug/@tdd_bug_647 to @tdd_issue/@tdd_issue_647 to match what's actually in the file.

Point 3 (tag naming): The feature file uses @tdd_issue / @tdd_issue_647, which is actually the correct naming per CONTRIBUTING.md (lines 1190-1192). The three-tag system defined there uses @tdd_issue, @tdd_issue_<N>, and @tdd_expected_fail. Some older CHANGELOG entries reference @tdd_bug (a historical convention), but the authoritative specification in CONTRIBUTING.md uses @tdd_issue. No change needed here.

Branch has been rebased onto the latest master and force-pushed. The PR is now mergeable and all quality gates pass.


Note: This reply was generated by opencode.

Thanks for the thorough review, Jeff. **Point 2 (`@tdd_expected_fail` removal):** You're right — the `@tdd_expected_fail` tag was already absent on master before this branch was created. The PR description was misleading. I've updated it to accurately reflect that only a comment rewording was made in the feature file, not a tag removal. I've also corrected the tag name references from `@tdd_bug`/`@tdd_bug_647` to `@tdd_issue`/`@tdd_issue_647` to match what's actually in the file. **Point 3 (tag naming):** The feature file uses `@tdd_issue` / `@tdd_issue_647`, which is actually the correct naming per CONTRIBUTING.md (lines 1190-1192). The three-tag system defined there uses `@tdd_issue`, `@tdd_issue_<N>`, and `@tdd_expected_fail`. Some older CHANGELOG entries reference `@tdd_bug` (a historical convention), but the authoritative specification in CONTRIBUTING.md uses `@tdd_issue`. No change needed here. Branch has been rebased onto the latest master and force-pushed. The PR is now mergeable and all quality gates pass. --- *Note: This reply was generated by [opencode](https://github.com/anthropics/opencode).*
hurui200320 deleted branch bugfix/m3-container-resolve 2026-03-30 05:45:10 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core!1157
No description provided.