[AZ-172] Complete distributed architecture implementation — update reports and state

Made-with: Cursor
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-03-31 06:40:31 +03:00
parent 9411103041
commit da32c2e6bd
5 changed files with 95 additions and 24 deletions
@@ -1,65 +0,0 @@
# Cleanup Obsolete Path-Based Code
**Task**: AZ-176_cleanup_obsolete_path_code
**Name**: Clean up obsolete path-based code and old methods
**Description**: Remove all code that relies on the old co-located architecture where the UI sends local file paths to the detection module.
**Complexity**: 1 point
**Dependencies**: AZ-173 (stream-based run_detect), AZ-174 (DB-driven config)
**Component**: Cleanup
**Jira**: AZ-176
**Parent**: AZ-172
## Problem
After implementing stream-based detection and DB-driven config, the old path-based code becomes dead code. It must be removed to avoid confusion and maintenance burden.
## Items to Remove
### `inference.pyx`
| Item | Reason |
|------|--------|
| `is_video(self, str filepath)` | Media type comes from upload metadata, not filesystem guessing |
| `for p in ai_config.paths: ...` loop in `run_detect` | Replaced by stream-based dispatch |
| `cv2.VideoCapture(<str>video_name)` with local path arg | Replaced by stream-based video processing |
| `cv2.imread(<str>path)` with local path arg | Replaced by bytes-based image processing |
| Old `run_detect` signature (if fully replaced) | Replaced by `run_detect_video` / `run_detect_image` |
### `ai_config.pxd`
| Item | Reason |
|------|--------|
| `cdef public list[str] paths` | Paths no longer part of config |
### `ai_config.pyx`
| Item | Reason |
|------|--------|
| `paths` parameter in `__init__` | Paths no longer part of config |
| `self.paths = paths` assignment | Paths no longer part of config |
| `data.get("paths", [])` in `from_dict` | Paths no longer part of config |
| `paths: {self.paths}` in `__str__` | Paths no longer part of config |
### `main.py`
| Item | Reason |
|------|--------|
| `AIConfigDto.paths: list[str]` field | Paths no longer sent by caller |
| `config_dict["paths"] = [tmp.name]` in `/detect` | Temp file path injection no longer needed |
## Acceptance Criteria
- [ ] No references to `paths` in `AIRecognitionConfig` or its Pydantic DTO
- [ ] No `cv2.VideoCapture(local_path)` or `cv2.imread(local_path)` calls remain
- [ ] No `is_video(filepath)` method remains
- [ ] All tests pass after removal
- [ ] No dead imports left behind
## File Changes
| File | Action | Description |
|------|--------|-------------|
| `src/inference.pyx` | Modified | Remove old methods and path-based logic |
| `src/ai_config.pxd` | Modified | Remove `paths` field declaration |
| `src/ai_config.pyx` | Modified | Remove `paths` from init, from_dict, __str__ |
| `src/main.py` | Modified | Remove `AIConfigDto.paths`, path injection |