## 38) History archive query paths may need explicit indexing plan - Where found: - [backend/app/db.py](backend/app/db.py) - [backend/app/repositories/history_archive_repo.py](backend/app/repositories/history_archive_repo.py) - Why this is needed: - Large archive datasets can degrade filter/sort performance. - Goal: - Add indexes aligned with real query patterns. - What to do: - Benchmark common history queries. - Add migration with targeted indexes. - Possible traps and issues: - Extra indexes increase write cost and DB size. - Docs changes needed: - Add DB performance/indexing section for history. - Doc references: - [Docs/Backend-Development.md](Docs/Backend-Development.md) - https://www.sqlite.org/queryplanner.html --- ## 39) No explicit DI container strategy for backend service graph - Where found: - [backend/app/dependencies.py](backend/app/dependencies.py) - [backend/app/services](backend/app/services) - Why this is needed: - Dependency construction and lifecycle are partly implicit. - Goal: - Define a clear dependency wiring pattern for services and repositories. - What to do: - Create service composition root pattern and document usage. - Possible traps and issues: - Over-engineering if container abstraction is too heavy for current size. - Docs changes needed: - Add dependency wiring chapter. - Doc references: - [Docs/Architekture.md](Docs/Architekture.md) --- ## 40) Frontend and backend observability are not aligned - Where found: - [backend/app/main.py](backend/app/main.py) - [frontend/src](frontend/src) - Why this is needed: - Backend uses structured logging while frontend error telemetry is mostly local and ad-hoc. - Goal: - Define unified error telemetry and correlation approach. - What to do: - Introduce frontend error reporting pipeline and request correlation IDs. - Possible traps and issues: - PII/sensitive payload leakage risk in client-side telemetry. - Docs changes needed: - Add observability and privacy-safe logging guidelines. - Doc references: - [Docs/Architekture.md](Docs/Architekture.md) - [Docs/Web-Development.md](Docs/Web-Development.md)