refactor(routes): move note domain into routes/note/ subpackage#5236
Conversation
Slice 2f of the route-domain reorganization (odysseus-dev#4082/odysseus-dev#4071, per specs/architecture-runtime-inventory.md §6.3). Moves note_routes.py into routes/note/, leaving a backward-compat sys.modules shim at the old path. Pure file reorganization, no behavior change. The shim uses sys.modules replacement (same pattern as the merged gallery odysseus-dev#4903, research odysseus-dev#4975, memory odysseus-dev#5007, history odysseus-dev#5090, and contacts odysseus-dev#5227 slices) so that `import routes.note_routes`, `from routes.note_routes import X`, `importlib.import_module(...)`, and the `import ... as note_routes` + `monkeypatch.setattr(note_routes, "SessionLocal", ...)` pattern used by test_note_reminder_fire_scope.py / test_notes_fail_closed_auth.py all operate on the same module object the application uses. The canonical module does NOT depend on the shim — routes/note/note_routes.py imports only from core/, src/, and stdlib. The outbound email cross-domain imports (routes.email_routes._get_email_config, routes.email_helpers. _send_smtp_message) are function-local lazy imports that keep resolving through the email module's own path (email is not yet migrated). One source-introspection test site repointed to the new canonical path: - test_model_helper_owner_scope.py (shared with history; history entry already repointed in odysseus-dev#5090, note entry repointed here) Adds tests/test_note_routes_shim.py to pin the sys.modules shim contract (legacy and canonical paths resolve to the same module object; monkeypatch via legacy alias reaches the canonical module). Verified: compileall clean; full suite 4487 passed, 3 skipped.
|
Friendly ping for review 👋 Slice 2f of the route-domain reorg, same pattern as the merged gallery (#4903), research (#4975), memory (#5007), history (#5090), and contacts (#5227) slices. Only the note domain moves — a single-file domain (915 lines, zero internal Both points from your #4903 review are baked in from the start here too:
CI is fully green (pytest 4487 passed). Happy to address any feedback. @RaresKeY @alteixeira20 — would you mind taking a look when you have a moment? |
…afts Per the search-before-staging rule, each affected draft now states complements/conflicts vs merged and in-flight upstream work (see upstream-recon-2026-07-07.md): tool-parsing (odysseus-dev#5033/odysseus-dev#5275/odysseus-dev#5199), provider hosts + native-tool toggle (odysseus-dev#4729/odysseus-dev#5206), injection header + guard benchmark (odysseus-dev#4991), GGUF include filter (odysseus-dev#5136/odysseus-dev#5137), ntfy/note refactor (odysseus-dev#5208/odysseus-dev#5236), skills + teacher volatility (odysseus-dev#5261/odysseus-dev#5215/odysseus-dev#4962). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Quick reminder: I tried to take another look at head This is not a code finding. Source review did not proceed because the head could not be prepared against the current target branch. |
Resolves conflicts after upstream commits d16b849 (odysseus-dev#5420, harden attachment lifecycle) and 4901a96 (odysseus-dev#5208, sanitize ntfy Title header) touched routes/note_routes.py and app.py: - app.py: keep canonical import path (routes.note.note_routes) + preserve upstream's new upload_handler kwarg on setup_note_routes(). - routes/note/note_routes.py (canonical): updated to upstream version (937 lines, includes attachment hardening + ntfy sanitize changes). - routes/note_routes.py (shim): kept as the 18-line sys.modules replacement. No behavior change from the merge itself — upstream functional changes are preserved verbatim in the canonical location; the migration structure (shim + subpackage) is unchanged. Verified: compileall clean; full suite 4608 passed, 3 skipped.
|
Quick update — this branch was behind dev and had merge conflicts. I've resolved them in 05556e8: Upstream commits #5420 (attachment lifecycle hardening) and #5208 (ntfy Title sanitize) touched
No behavior change from the merge. CI re-ran green (pytest 4608 passed, 0 failed). Ready for review when you have a moment. |
|
Hi @RaresKeY — following up on your earlier note: the conflicts you flagged in |
RaresKeY
left a comment
There was a problem hiding this comment.
Thanks for the update. I checked the latest head: the note implementation is preserved under the canonical package path, application registration keeps the existing setup arguments, and the legacy shim keeps old and new imports on the same module object. I did not find any author-actionable issues.
Validation
- Visible CI checks on this head passed.
- Focused isolated tests passed (33 tests), and the changed Python files compiled successfully.
- I did not run the full test suite or a live application smoke test.
Summary
Slice 2f of the route-domain reorganization (Refs #4082 / #4071; inventory baseline in #4148,
specs/architecture-runtime-inventory.md§6.3). Moves the note domain out of the flatroutes/directory into a newroutes/note/subpackage, keeping the flatroutes/directory intact for all other domains.Follows the same pattern as the merged slices: gallery (#4903), research (#4975), memory (#5007), history (#5090), contacts (#5227). No behavior change. Pure file reorganization.
What moves
routes/note_routes.py(915 lines)routes/note/note_routes.pyNew
routes/note/__init__.pymarks the subpackage. Note is a single-file domain (§4) with zero internalroutes/coupling at module top (imports onlycore/,src/, stdlib). Two function-local lazy imports fromroutes.email_*(for email-based reminders) keep resolving through the email module's own path — unaffected by this migration.Backward compatibility
A backward-compat shim remains at
routes/note_routes.py. It usessys.modulesreplacement (same pattern as all previous slices) so the legacy import path and the canonical path resolve to the same module object:This is required because
test_note_reminder_fire_scope.pyandtest_notes_fail_closed_auth.pyuseimport routes.note_routes as note_routesfollowed bymonkeypatch.setattr(note_routes, "SessionLocal", ...)— for those patches to take effect at runtime, the legacy module object and the canonical one must be identical.The canonical module does not depend on the shim —
routes/note/note_routes.pyimports only fromcore/,src/, and stdlib.Test repoints (1 site)
One source-introspection test reads the note source by file path. Repointed from
routes/note_routes.py→routes/note/note_routes.py:test_model_helper_owner_scope.py_function_sourcepath arg (shared with history; history entry already repointed in #5090)Shim regression test
Adds
tests/test_note_routes_shim.pyto pin thesys.modulesshim contract:routes.note_routesand canonicalroutes.note.note_routesresolve to the same module objectHow to test
Full suite: 4487 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.note_routes import ...paths keep working via shim