Skip to content

refactor(routes): move vault domain into routes/vault/ subpackage#5686

Open
ydonghao wants to merge 1 commit into
odysseus-dev:devfrom
ydonghao:refactor/routes-vault-to-subdir
Open

refactor(routes): move vault domain into routes/vault/ subpackage#5686
ydonghao wants to merge 1 commit into
odysseus-dev:devfrom
ydonghao:refactor/routes-vault-to-subdir

Conversation

@ydonghao

@ydonghao ydonghao commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Slice of the route-domain reorganization (Refs #4082 / #4071; inventory baseline in #4148). Moves the vault domain into routes/vault/, keeping a backward-compat sys.modules shim at the old path. Pure file reorganization, no behavior change.

One of three parallel low-risk slices (#5685 search, #5686 vault, #5687 webhook). Follows the same pattern as all previous merged slices (gallery #4903 through compare #5660).

What moves

From To
routes/vault_routes.py routes/vault/vault_routes.py

New routes/vault/__init__.py marks the subpackage. The canonical module does NOT depend on the shim — imports only from core/, src/, services/, and stdlib (zero internal routes/ coupling).

Backward compatibility

A backward-compat shim remains at routes/vault_routes.py, using sys.modules replacement so all legacy import paths (import, from...import, importlib, monkeypatch.setattr) resolve to the same module object the application uses.

How to test

python -m compileall routes/vault/ routes/vault_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

  • Bug fix
  • New feature
  • Breaking change
  • Refactor / cleanup
  • Documentation only
  • CI / tooling / configuration

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 import paths keep working via shim

Slice 2k of the route-domain reorganization (odysseus-dev#4082/odysseus-dev#4071). Moves
vault_routes.py into routes/vault/, 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 vr` +
`monkeypatch.setattr(vr, "VAULT_FILE", ...)` / `"_find_bw"` pattern in
test_vault_password_not_in_argv.py reaches the canonical module. The
`__file__`-based source introspection (line 93) automatically resolves
to the canonical file path.

Zero source-introspection landmines requiring path edits. Canonical
module imports only from core/, src/, and stdlib (zero internal routes/
coupling).
@github-actions github-actions Bot added the needs work PR description incomplete — please update before review label Jul 22, 2026
@github-actions github-actions Bot added ready for review Description complete — ready for maintainer review and removed needs work PR description incomplete — please update before review labels Jul 22, 2026
@ydonghao

Copy link
Copy Markdown
Contributor Author

Friendly ping for review 👋

This is one of three parallel low-risk slices (#5685 search, #5686 vault, #5687 webhook). Only the vault domain moves — a single-file, 242-line domain with zero internal routes/ coupling — into routes/vault/ 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). CI fully green.

@RaresKeY @alteixeira20 — would you mind taking a look when you have a moment?

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.

1 participant