ui.home: HomeController ignores injected dependencies #23

Open
opened 2026-10-06 13:48:15 +00:00 by ffrauenberger · 0 comments
Owner

Severity: low (injection does not work, which makes the controller hard to test)

Where

  • app/ui/home_ui/home_controller.py:19-62

Problem

The constructor accepts detection_model, import_model, export_model and prediction_model and documents "If None is passed, a new instance is created". It then always creates new instances and ignores the arguments:

self.detection_model = DetectionModel()
self.import_model = ImportOperations()
self.export_model = ExportOperations()
self.prediction_model = PredictionModel()

Tests or extensions that inject mocks silently get the real implementations. The other controllers handle this correctly with if x is None: x = X().

Steps to reproduce

  1. Create HomeController(detection_model=mock_detection_model)
  2. Check controller.detection_model

Expected behavior

controller.detection_model is the injected mock.

Actual behavior

controller.detection_model is a new DetectionModel instance.

Fix

Use the same if x is None: x = X() pattern as the other controllers.


from issues/BUG-023-home-controller-ignores-injected-dependencies.md (code analysis of commit 6bcc646, 2026-10-03)

**Severity:** low (injection does not work, which makes the controller hard to test) ## Where - `app/ui/home_ui/home_controller.py:19-62` ## Problem The constructor accepts `detection_model`, `import_model`, `export_model` and `prediction_model` and documents *"If None is passed, a new instance is created"*. It then always creates new instances and ignores the arguments: ```python self.detection_model = DetectionModel() self.import_model = ImportOperations() self.export_model = ExportOperations() self.prediction_model = PredictionModel() ``` Tests or extensions that inject mocks silently get the real implementations. The other controllers handle this correctly with `if x is None: x = X()`. ### Steps to reproduce 1. Create `HomeController(detection_model=mock_detection_model)` 2. Check `controller.detection_model` ### Expected behavior `controller.detection_model` is the injected mock. ### Actual behavior `controller.detection_model` is a new `DetectionModel` instance. ## Fix Use the same `if x is None: x = X()` pattern as the other controllers. --- from `issues/BUG-023-home-controller-ignores-injected-dependencies.md` (code analysis of commit 6bcc646, 2026-10-03)
Sign in to join this conversation.
No milestone
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
ffrauenberger/ProcessIntel#23
No description provided.