feat(di): wire decision services #461

Merged
freemo merged 1 commit 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
All checks were successful
CI / lint (pull_request) Successful in 20s
CI / benchmark-publish (pull_request) Has been skipped
CI / quality (pull_request) Successful in 17s
CI / security (pull_request) Successful in 33s
CI / typecheck (pull_request) Successful in 58s
CI / build (pull_request) Successful in 28s
CI / integration_tests (pull_request) Successful in 3m25s
CI / benchmark-regression (pull_request) Successful in 25m35s
CI / unit_tests (pull_request) Successful in 29m40s
CI / docker (pull_request) Successful in 53s
CI / coverage (pull_request) Successful in 46m5s
to 120274da99
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 14s
CI / build (pull_request) Successful in 20s
CI / quality (pull_request) Successful in 22s
CI / typecheck (pull_request) Successful in 33s
CI / security (pull_request) Successful in 35s
CI / integration_tests (pull_request) Successful in 4m26s
CI / unit_tests (pull_request) Successful in 20m49s
CI / benchmark-regression (pull_request) Successful in 20m19s
CI / docker (pull_request) Successful in 1m2s
CI / coverage (pull_request) Successful in 48m2s
CI / lint (push) Successful in 12s
CI / quality (push) Successful in 16s
CI / build (push) Successful in 24s
CI / typecheck (push) Successful in 29s
CI / security (push) Successful in 30s
CI / benchmark-regression (push) Has been skipped
CI / integration_tests (push) Successful in 2m44s
CI / unit_tests (push) Successful in 11m56s
CI / benchmark-publish (push) Successful in 12m13s
CI / docker (push) Successful in 39s
CI / coverage (push) Successful in 37m29s
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
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

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