refactor(routes): move cleanup domain into routes/cleanup/ subpackage#5658
Conversation
Slice 2g of the route-domain reorganization (odysseus-dev#4082/odysseus-dev#4071). Moves cleanup_routes.py into routes/cleanup/, leaving a backward-compat sys.modules shim at the old path. Pure file reorganization, no behavior change. The shim uses sys.modules replacement so string-targeted monkeypatch.setattr("routes.cleanup_routes.*", ...) in test_cleanup_owner_scope.py reaches the canonical module. Canonical module imports only from src/ and stdlib (zero internal routes/ coupling). Zero source-introspection landmines. Adds tests/test_cleanup_routes_shim.py to pin the sys.modules shim contract. Verified: compileall clean; targeted tests pass.
|
Friendly ping for review 👋 This is slice 2g of the route-domain reorg, one of three parallel low-risk slices (the others: #5659 admin_wipe, #5660 compare). Only the cleanup domain moves — a single-file, 60-line domain with zero internal Both points from your #4903 review are baked in (canonical doesn't depend on shim; shim regression test included). Zero source-introspection landmines. CI fully green (pytest 4676 passed). @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 checked the latest head against the prior route-domain move pattern and the linked architecture cleanup context. The moved cleanup route implementation is byte-for-byte preserved under the canonical package path, app registration uses that path, and the legacy routes.cleanup_routes shim keeps old imports and monkeypatch-based owner-scope tests on the same module object.
Validation looked solid: GitHub checks are green, the focused cleanup owner/shim tests and changed-file compile checks pass, the app mounts both cleanup routes through the canonical module, and I did not find any blocking issues.
Summary
Slice 2g of the route-domain reorganization (Refs #4082 / #4071; inventory baseline in #4148). Moves the cleanup domain into
routes/cleanup/, 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/cleanup_routes.py(60 lines)routes/cleanup/cleanup_routes.pyNew
routes/cleanup/__init__.pymarks the subpackage. Cleanup is a single-file, LOW-complexity domain with zero internalroutes/coupling.Backward compatibility
A backward-compat shim remains at
routes/cleanup_routes.py, usingsys.modulesreplacement so string-targetedmonkeypatch.setattr("routes.cleanup_routes.*", ...)intest_cleanup_owner_scope.pyreaches the canonical module.The canonical module imports only from
src/and stdlib — no dependency on the legacy shim.Test repoints
Zero source-introspection landmines. No test reads this file by path.
Shim regression test
Adds
tests/test_cleanup_routes_shim.pyto pin thesys.modulesshim contract (same-object).How to test
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.cleanup_routes import ...paths keep working via shim