refactor(routes): move compare domain into routes/compare/ subpackage#5660
Conversation
Slice 2i of the route-domain reorganization (odysseus-dev#4082/odysseus-dev#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.
|
Friendly ping for review 👋 This is slice 2i of the route-domain reorg, one of three parallel low-risk slices (the others: #5658 cleanup, #5659 admin_wipe). Only the compare domain moves — a single-file, 365-line domain — into Both points from your #4903 review are baked in (canonical doesn't depend on shim; shim regression test included). One source-introspection test site repointed ( @RaresKeY @alteixeira20 — would you mind taking a look when you have a moment? |
RaresKeY
left a comment
There was a problem hiding this comment.
LGTM. I reviewed the latest head against the prior route-domain move pattern. The compare implementation is preserved byte-for-byte under the new canonical package path, app registration uses that path, and the legacy shim keeps old imports resolving to the same module object. I did not find any author-actionable issues.
Validation
- Visible CI checks on this head passed.
- Focused isolated tests passed (17 tests), the canonical-first legacy import probe passed, and the changed Python files compiled successfully.
- I did not run a live application smoke test.
Summary
Slice 2i of the route-domain reorganization (Refs #4082 / #4071; inventory baseline in #4148). Moves the compare domain into
routes/compare/, keeping a backward-compatsys.modulesshim at the old path. Pure file reorganization, no behavior change.Follows the same pattern as the merged gallery (#4903), research (#4975), memory (#5007), history (#5090), contacts (#5227), and note (#5236) slices.
What moves
routes/compare_routes.py(365 lines)routes/compare/compare_routes.pyNew
routes/compare/__init__.pymarks the subpackage. Compare is a single-file, LOW-complexity domain.Backward compatibility
A backward-compat shim remains at
routes/compare_routes.py, usingsys.modulesreplacement so theimport ... as cr+monkeypatch.setattr(cr, "SessionLocal", ...)/"_owned_endpoint_by_url"/"_owned_endpoint_by_id"pattern intest_endpoint_owner_scope_followup.pyreaches the canonical module.The canonical module imports only from
core/,src/, androutes.session_routes— no dependency on the legacy shim.Test repoints (1 site)
One source-introspection test reads the compare source by file path. Repointed from
routes/compare_routes.py→routes/compare/compare_routes.py:test_endpoint_owner_scope_followup.py(shared with other domains; only the compare entry repointed here)Shim regression test
Adds
tests/test_compare_routes_shim.pyto pin thesys.modulesshim contract (same-object).How to test
Full suite: 4676 passed, 3 skipped, 0 failed.
Target branch
dev, notmain.Linked Issue
Follows the Phase 0 architecture refactor (#4082 / #4071) and the merged runtime inventory (#4148). One domain per PR per maintainer guidance.
Type of Change
Checklist
devfrom routes.compare_routes import ...paths keep working via shim