refactor(routes): move compare domain into routes/compare/ subpackage (#5660)

Slice 2i of the route-domain reorganization (#4082/#4071). Moves
compare_routes.py into routes/compare/, leaving a backward-compat
sys.modules shim at the old path. Pure file reorganization, no behavior
change.

The shim uses sys.modules replacement so the `import ... as cr` +
`monkeypatch.setattr(cr, "SessionLocal", ...)` / `"_owned_endpoint_by_url"`
/ `"_owned_endpoint_by_id"` pattern in test_endpoint_owner_scope_followup.py
reaches the canonical module.

Canonical module imports only from core/, src/, and routes.session_routes
(zero dependency on the legacy shim). One source-introspection test site
repointed: test_endpoint_owner_scope_followup.py (shared with other domains;
only the compare entry repointed here).

Adds tests/test_compare_routes_shim.py to pin the sys.modules shim
contract. Verified: compileall clean; targeted tests pass.
This commit is contained in:
Tal.Yuan
2026-07-21 18:40:09 +08:00
committed by GitHub
parent 833cdbd140
commit 483c42bb12
6 changed files with 411 additions and 363 deletions
+5
View File
@@ -0,0 +1,5 @@
"""Compare route domain package (slice 2i, #4082/#4071).
Contains compare_routes.py, migrated from the flat routes/ directory.
Backward-compat shim at routes/compare_routes.py re-exports from here.
"""