mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-08-01 19:18:35 -04:00
88e0ce3037
Slice 2f of the route-domain reorganization (#4082/#4071, per specs/architecture-runtime-inventory.md §6.3). Moves note_routes.py into routes/note/, leaving a backward-compat sys.modules shim at the old path. Pure file reorganization, no behavior change. The shim uses sys.modules replacement (same pattern as the merged gallery #4903, research #4975, memory #5007, history #5090, and contacts #5227 slices) so that `import routes.note_routes`, `from routes.note_routes import X`, `importlib.import_module(...)`, and the `import ... as note_routes` + `monkeypatch.setattr(note_routes, "SessionLocal", ...)` pattern used by test_note_reminder_fire_scope.py / test_notes_fail_closed_auth.py all operate on the same module object the application uses. The canonical module does NOT depend on the shim — routes/note/note_routes.py imports only from core/, src/, and stdlib. The outbound email cross-domain imports (routes.email_routes._get_email_config, routes.email_helpers. _send_smtp_message) are function-local lazy imports that keep resolving through the email module's own path (email is not yet migrated). One source-introspection test site repointed to the new canonical path: - test_model_helper_owner_scope.py (shared with history; history entry already repointed in #5090, note entry repointed here) Adds tests/test_note_routes_shim.py to pin the sys.modules shim contract (legacy and canonical paths resolve to the same module object; monkeypatch via legacy alias reaches the canonical module). Verified: compileall clean; full suite 4487 passed, 3 skipped.
19 lines
777 B
Python
19 lines
777 B
Python
"""Backward-compat shim — canonical location is routes/note/note_routes.py.
|
|
|
|
This module is replaced in ``sys.modules`` by the canonical module object so
|
|
that ``import routes.note_routes``, ``from routes.note_routes import X``,
|
|
``importlib.import_module("routes.note_routes")``, and the
|
|
``import ... as note_routes`` + ``monkeypatch.setattr(note_routes, "SessionLocal",
|
|
...)`` pattern used by test_note_reminder_fire_scope.py /
|
|
test_notes_fail_closed_auth.py all operate on the *same* object the
|
|
application actually uses. Keeps existing import paths working after
|
|
slice 2f (#4082/#4071). Source-introspection tests read the canonical file
|
|
by path.
|
|
"""
|
|
|
|
import sys as _sys
|
|
|
|
from routes.note import note_routes as _canonical # noqa: F401
|
|
|
|
_sys.modules[__name__] = _canonical
|