refactor(auth): split app/auth.py — endpoints to app/routes/auth.py
R12 S2. app/auth.py (1154 lines) mixed the core auth surface with 18 HTTP endpoints on one /auth router. Split by dependency graph: - app/auth.py (223 lines) keeps ONLY the core surface other modules import (current_user, resolved_user_id, admin_user, require_*, has_*_scope, purge_user, count_admins, get_or_create_demo_user, google_enabled, is_allowed, operator_contact, optional_current_user) plus everything it transitively depends on. - app/routes/auth.py (883 lines, new) gets the router + all 18 endpoints + their endpoint-only helpers, importing the core surface from app.auth. - main.py includes auth_routes.router (was app.auth.router). - test_oauth_redirect imports _oauth_redirect_uri from its new home. The STAY/MOVE partition is driven by an AST scan of the COMPLETE external surface (every `from app.auth import` incl. multiline + `from app import auth; auth.X`), so no still-referenced symbol was moved. Behaviour-equivalent: every symbol relocated verbatim (get_source_segment equality), route set proven identical, no undefined names (symtable sweep). Gate: ruff clean (backend + scripts), pytest 193 passed.
This commit is contained in:
@@ -4,7 +4,7 @@ redirect the code); in local dev it honors a small allowlist of dev origins so a
|
||||
Vite server (:5173) returns to :5173."""
|
||||
from types import SimpleNamespace
|
||||
|
||||
from app import auth
|
||||
from app.routes import auth
|
||||
|
||||
|
||||
def _req(host):
|
||||
|
||||
Reference in New Issue
Block a user