Introduce explicit ApplicationContext and remove raw request.app.state usage
This commit is contained in:
@@ -121,6 +121,7 @@ Reference: `Docs/Refactoring.md` for full analysis of each issue.
|
||||
- Issue: The backend currently relies on raw `app.state` access in routers, tasks, and dependencies, which hides contract boundaries and allows arbitrary mutable state to leak into the framework layer.
|
||||
- Propose: Define a dedicated `ApplicationContext` / runtime context object for shared resources such as `settings`, `http_session`, `scheduler`, and runtime caches. Provide it through explicit FastAPI dependencies and remove direct `request.app.state` reads outside a small bootstrap boundary.
|
||||
- Test: Verify the new context can satisfy existing dependencies, and add a static check or test ensuring no backend module directly accesses `request.app.state` except through the new context provider.
|
||||
- Status: completed
|
||||
|
||||
17. Resolve runtime configuration before creating shared startup resources
|
||||
- Goal: Ensure startup resources are initialized using the effective runtime settings, not stale bootstrap defaults.
|
||||
|
||||
Reference in New Issue
Block a user