refactor(views): group per-module view modules into views packages - #865
Merged
Conversation
|
Warning Review limit reachedNext included review available in 17 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (70)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
pchopinet
force-pushed
the
refactor/views-packages
branch
from
August 28, 2026 09:30
4822f46 to
d4a5a01
Compare
Six modules had accumulated a flat sprawl of views_<topic>.py siblings at their root - thirteen of them in chat, ten in mail. Each now exposes a views/ package with an empty __init__.py and topic-named modules, matching the shape services/ and files/viewsets/ already use. Two files that mixed unrelated concerns were split along the separators their authors had already written: core/views.py into modules.py and search.py, calendar/views.py into calendars.py and events.py. vault keeps its flat pair - two files do not warrant a package.
pchopinet
force-pushed
the
refactor/views-packages
branch
from
August 28, 2026 09:33
d4a5a01 to
528db1f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Six modules had grown a flat sprawl of
views_<topic>.pyfiles at their root - thirteen inchat, ten inmail- which buried the module's actual entry points under a wall of near-identical filenames. Each now exposes aviews/package with an empty__init__.pyand topic-named modules, the same shapeservices/andfiles/viewsets/already use. No behaviour changes: every move is a rename plus the import-depth adjustment it forces.Changes
chat,mail,files,core,projectsandcalendareach gain aviews/package.vaultkeeps its flat pair, two files do not warrant a package.views.pyis renamed after what it actually holds (chat/views/conversations.py,mail/views/accounts.py,files/views/files.py);views/views.pyis never the answer.core/views.pyintomodules.py+search.py,calendar/views.pyintocalendars.py+events.py.projects/viewsets.pymoves toprojects/views/viewsets.pyso everything view-shaped sits together.files/viewsets/stays where it is, it holds mixins rather than views.views.pywhile it fits, aviews/package from the second module onward, neverviews_<topic>.pyat the module root.Testing
chat774,mail623,core232,projects889,calendar441, plususers,vault,notes,dashboard,ai,notificationsandimports: all green, andchatruns the exact same 774 tests as before the move.ruff checkandmanage.py checkclean.files(6) andcommon(4) fail identically on the base commit, verified by replaying those targets in a throwaway worktree atHEAD~1. Pre-existing Windows-only breakage (cp1252 decode in the palette lockstep test, trash directory layout), untouched here.One real regression surfaced and was fixed:
test_api_attachments.pypatchedworkspace.projects.viewsets.MAX_UPLOAD_BYTES, a path the move invalidated.Notes
Review focus is the import rewrites. Moving a view one directory deeper changes every relative import inside it, including the ~30 lazy ones sitting in function bodies to break cycles. Sibling views now import each other by module name (
from .conversations import _trigger_bot_response);from ..views import ...would resolve to the empty__init__.pyand fail.Keeping
__init__.pyempty is deliberate rather than incidental: a stale@patch("workspace.chat.views._trigger_bot_response")now raisesAttributeError, where a compatibility re-export would have bound the alias and left the real call site unmocked with the test still green.