10) Implement explicit startup DAG for resource initialization
- Created StartupDAG class to orchestrate startup stages with explicit dependencies - Defined 6 startup stages: WORKER_MODE → DATABASE → GEO_CACHE → HTTP_SESSION → SCHEDULER → TASKS - Each stage has prerequisites, error handling, and rollback support - Refactored startup_shared_resources() to use the DAG - Added StartupContext for resource tracking and failure management - Partial failures automatically roll back all completed resources in reverse order - Added health checks to verify all resources initialized successfully - Comprehensive test coverage: 15 DAG unit tests + 3 integration tests + 6 existing tests - Documented startup DAG in Architekture.md with detailed stage descriptions and failure modes This replaces implicit ordering with explicit dependency tracking, making lifecycle changes safe and failure modes predictable. Hidden order dependencies no longer exist. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,43 +1,3 @@
|
||||
## 8) Inconsistent modeling style (TypedDict vs Pydantic)
|
||||
- Where found:
|
||||
- [backend/app/services/jail_service.py](backend/app/services/jail_service.py)
|
||||
- [backend/app/models](backend/app/models)
|
||||
- Why this is needed:
|
||||
- Mixed validation/serialization behavior increases maintenance cost.
|
||||
- Goal:
|
||||
- Standardize model type usage by layer.
|
||||
- What to do:
|
||||
- Define when TypedDict is allowed.
|
||||
- Convert external-facing structures to Pydantic consistently.
|
||||
- Possible traps and issues:
|
||||
- Performance and strictness differences may alter runtime behavior.
|
||||
- Docs changes needed:
|
||||
- Add modeling conventions section.
|
||||
- Doc references:
|
||||
- [Docs/Backend-Development.md](Docs/Backend-Development.md)
|
||||
|
||||
---
|
||||
|
||||
## 9) Repository protocol coverage is incomplete
|
||||
- Where found:
|
||||
- [backend/app/repositories/protocols.py](backend/app/repositories/protocols.py)
|
||||
- [backend/app/repositories](backend/app/repositories)
|
||||
- Why this is needed:
|
||||
- Missing protocols reduce mockability and static contract checks.
|
||||
- Goal:
|
||||
- Full protocol coverage for repository interfaces.
|
||||
- What to do:
|
||||
- Add protocol definitions for missing repositories.
|
||||
- Validate implementation compatibility in tests/CI.
|
||||
- Possible traps and issues:
|
||||
- Protocol drift if methods evolve without synchronized updates.
|
||||
- Docs changes needed:
|
||||
- Add repository protocol checklist.
|
||||
- Doc references:
|
||||
- [Docs/Backend-Development.md](Docs/Backend-Development.md)
|
||||
|
||||
---
|
||||
|
||||
## 10) Startup sequence depends on implicit ordering
|
||||
- Where found:
|
||||
- [backend/app/startup.py](backend/app/startup.py)
|
||||
|
||||
Reference in New Issue
Block a user