Eliminate direct app.state access from routers

This commit is contained in:
2026-04-10 19:15:37 +02:00
parent ff92733f90
commit 2157502670
4 changed files with 74 additions and 22 deletions

View File

@@ -20,6 +20,7 @@ Reference: `Docs/Refactoring.md` for full analysis of each issue.
- Issue: Several routers still read or mutate `app.state` directly, including `setup.py` and `config.py`, which breaks the intended separation of concerns and makes handlers harder to test.
- Propose: Refactor routers to consume explicit dependencies for required values and actions, and move all direct state mutations into services or dedicated state managers.
- Test: Ensure all router handlers compile without requiring direct `app.state` access and existing endpoint tests still pass.
- Status: completed
3. Replace process-local session cache with a pluggable abstraction
- Goal: Make session validation consistent across multi-worker deployments by replacing the module-level in-memory cache with an injectable cache backend.