Skip to content

refactor(routes): move cleanup domain into routes/cleanup/ subpackage#5658

Merged
RaresKeY merged 1 commit into
odysseus-dev:devfrom
ydonghao:refactor/routes-cleanup-to-subdir
Jul 21, 2026
Merged

refactor(routes): move cleanup domain into routes/cleanup/ subpackage#5658
RaresKeY merged 1 commit into
odysseus-dev:devfrom
ydonghao:refactor/routes-cleanup-to-subdir

Conversation

@ydonghao

Copy link
Copy Markdown
Contributor

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-compat sys.modules shim 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

From To
routes/cleanup_routes.py (60 lines) routes/cleanup/cleanup_routes.py

New routes/cleanup/__init__.py marks the subpackage. Cleanup is a single-file, LOW-complexity domain with zero internal routes/ coupling.

Backward compatibility

A backward-compat shim remains at routes/cleanup_routes.py, using sys.modules replacement so string-targeted monkeypatch.setattr("routes.cleanup_routes.*", ...) in test_cleanup_owner_scope.py reaches 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.py to pin the sys.modules shim contract (same-object).

How to test

python -m compileall routes/cleanup/ routes/cleanup_routes.py app.py
python -m pytest tests/ -q

Target branch

  • This PR targets dev, not main.

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

  • Refactor / cleanup

Checklist

  • I searched open issues and open PRs — this is not a duplicate
  • This PR targets dev
  • My changes are limited to the scope described above — no unrelated refactors
  • No runtime behavior changes (pure file move + import shim)
  • Backward-compatible: old from routes.cleanup_routes import ... paths keep working via shim

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.
@github-actions github-actions Bot added the ready for review Description complete — ready for maintainer review label Jul 21, 2026
@ydonghao

Copy link
Copy Markdown
Contributor Author

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 routes/ coupling — into routes/cleanup/ behind the same sys.modules shim as all previous slices.

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 RaresKeY left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@RaresKeY
RaresKeY merged commit 8f0eaf8 into odysseus-dev:dev Jul 21, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review Description complete — ready for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants