feat(di): wire decision services #461

Merged
freemo merged 1 commits from feature/m4-decision-di into master 2026-02-27 03:22:22 +00:00
Owner

Summary

Creates DecisionService application-layer service, wires it into the DI container, and injects it into PlanLifecycleService so strategize/execute phases automatically record decisions.

Changes

DecisionService (application/services/decision_service.py)

  • New 210-line service wrapping DecisionRepository with UnitOfWork transaction management
  • Methods: record_decision, get_decision, get_decisions_for_plan, get_decision_tree, get_path_to_root, mark_superseded, list_by_type
  • Full structlog logging for all operations

DI Container Wiring (application/container.py)

  • DecisionService registered as Factory provider
  • PlanLifecycleService registered as Factory with DecisionService injected

PlanLifecycleService Integration

  • Optional decision_service parameter added to constructor
  • start_strategize automatically records strategy_choice decision
  • start_execute automatically records implementation_choice decision
  • Decision recording failures are caught and logged (never block phase transitions)

Documentation

  • New docs/reference/di.md with full provider table, registration details, and usage examples

Tests

  • Behave: 5 scenarios in features/decision_di_wiring.feature (all pass)
  • Robot: 2 smoke tests in robot/decision_di_wiring_smoke.robot (all pass)
  • ASV: 3 benchmarks in benchmarks/decision_di_bench.py

Quality Gates

  • lint: PASS
  • typecheck: PASS (0 errors, 0 warnings)
  • unit_tests: PASS
  • integration_tests: PASS

Closes #173

## Summary Creates `DecisionService` application-layer service, wires it into the DI container, and injects it into `PlanLifecycleService` so strategize/execute phases automatically record decisions. ## Changes ### DecisionService (`application/services/decision_service.py`) - New 210-line service wrapping `DecisionRepository` with UnitOfWork transaction management - Methods: `record_decision`, `get_decision`, `get_decisions_for_plan`, `get_decision_tree`, `get_path_to_root`, `mark_superseded`, `list_by_type` - Full structlog logging for all operations ### DI Container Wiring (`application/container.py`) - `DecisionService` registered as `Factory` provider - `PlanLifecycleService` registered as `Factory` with `DecisionService` injected ### PlanLifecycleService Integration - Optional `decision_service` parameter added to constructor - `start_strategize` automatically records `strategy_choice` decision - `start_execute` automatically records `implementation_choice` decision - Decision recording failures are caught and logged (never block phase transitions) ### Documentation - New `docs/reference/di.md` with full provider table, registration details, and usage examples ### Tests - **Behave**: 5 scenarios in `features/decision_di_wiring.feature` (all pass) - **Robot**: 2 smoke tests in `robot/decision_di_wiring_smoke.robot` (all pass) - **ASV**: 3 benchmarks in `benchmarks/decision_di_bench.py` ## Quality Gates - lint: PASS - typecheck: PASS (0 errors, 0 warnings) - unit_tests: PASS - integration_tests: PASS Closes #173
freemo force-pushed feature/m4-decision-di from d551132da4 to 120274da99 2026-02-27 02:33:43 +00:00 Compare
freemo scheduled this pull request to auto merge when all checks succeed 2026-02-27 02:33:58 +00:00
freemo merged commit 120274da99 into master 2026-02-27 03:22:22 +00:00
freemo deleted branch feature/m4-decision-di 2026-02-27 03:22:22 +00:00
freemo added the
State
Completed
label 2026-03-04 00:58:45 +00:00
Sign in to join this conversation.
No Reviewers
No Label
State
Completed
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cleveragents/cleveragents-core#461