You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
Move FacilityUserViewSet, DeletedFacilityUserViewSet, and PublicFacilityUserViewSet — already migrated to the serializer-derived pattern in #14327 — from kolibri/core/auth/api.py into kolibri/core/auth/viewsets/facility_user.py, with their serializers inline. This is the first move under the File Organization convention in #14036 and pilots the move workflow for the rest of the migration sub-issues.
Complexity: Low Target branch: develop
Context
PublicFacilityUserViewSet, FacilityUserViewSet, and DeletedFacilityUserViewSet live in kolibri/core/auth/api.py; their serializers — FacilityUserSerializer (which nests FacilityUserRoleSerializer for roles), DeletedFacilityUserSerializer, and PublicFacilityUserSerializer — live in kolibri/core/auth/serializers.py. These were migrated to the serializer-derived pattern in #14327, so this is a pure relocation with no serialization changes.
BaseSignUpViewSet in api.py also uses FacilityUserSerializer; it imports from the new module until its own move.
The Change
Create the kolibri/core/auth/viewsets/ package (empty __init__.py) and move the three viewsets and their serializers into kolibri/core/auth/viewsets/facility_user.py, serializers above the viewsets that use them, as a pure-move commit. Update imports in api.py, api_urls.py, and anywhere else that references the moved classes.
Moving code breaks GitHub blame (local git blame -C -C still works), so digest the history the move obscures:
Run blame over the code being moved; flag hunks whose purpose isn't evident from the code or tests (odd guards, magic orderings, special cases).
Chase each flagged hunk to its originating PR/issue; where the rationale is non-obvious and load-bearing, carry it forward as a code comment citing the reference.
Where the rationale turns out to be obsolete, flag the code for removal — but as a pure move, this PR should not remove it; raise it for follow-up instead.
How to Get There
The moved endpoints are exercised at /api/auth/facilityuser/, /api/auth/deletedfacilityuser/, and /api/public/facilityuser/ (the latter routed via kolibri/core/public/api_urls.py).
Out of Scope
Any change to serialization behavior or API response shape — this is a pure move
Moving other auth viewsets or serializers — they follow in their own sub-issues
Removing obsolete code found during blame digestion — flag for follow-up instead
Acceptance Criteria
kolibri/core/auth/viewsets/facility_user.py contains FacilityUserViewSet, DeletedFacilityUserViewSet, and PublicFacilityUserViewSet plus their serializers (FacilityUserSerializer, FacilityUserRoleSerializer, DeletedFacilityUserSerializer, PublicFacilityUserSerializer), serializers above the viewsets
Moved classes removed from api.py/serializers.py, with all references updated (auth/api_urls.py, public/api_urls.py, BaseSignUpViewSet, tests)
The relocation lands as a pure-move commit, separate from import updates
Existing API tests pass unchanged
Benchmark comparison passes for all three viewsets (data hash match + no performance regression)
Comments citing the originating PR/issue added where blame digestion found non-obvious, load-bearing rationale
Testing
Run the benchmark for each of the three viewsets, baseline with the old dotted path, comparison with the new one:
Likewise for DeletedFacilityUserViewSet and PublicFacilityUserViewSet.
All three comparisons must pass (identical output hash, no regression); include the before/after output in the PR description.
Benchmark data setup: populate a facility with users via kolibri manage generateuserdata.
AI usage
Drafted with AI assistance (Claude Code) from an interactive design discussion, section by section, with review and final edits by @rtibbles. File locations, serializer relationships, routes, and benchmark comparison behavior were verified against the codebase during drafting.
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
Move
FacilityUserViewSet,DeletedFacilityUserViewSet, andPublicFacilityUserViewSet— already migrated to the serializer-derived pattern in #14327 — fromkolibri/core/auth/api.pyintokolibri/core/auth/viewsets/facility_user.py, with their serializers inline. This is the first move under the File Organization convention in #14036 and pilots the move workflow for the rest of the migration sub-issues.Complexity: Low
Target branch: develop
Context
PublicFacilityUserViewSet,FacilityUserViewSet, andDeletedFacilityUserViewSetlive inkolibri/core/auth/api.py; their serializers —FacilityUserSerializer(which nestsFacilityUserRoleSerializerforroles),DeletedFacilityUserSerializer, andPublicFacilityUserSerializer— live inkolibri/core/auth/serializers.py. These were migrated to the serializer-derived pattern in #14327, so this is a pure relocation with no serialization changes.BaseSignUpViewSetinapi.pyalso usesFacilityUserSerializer; it imports from the new module until its own move.The Change
Create the
kolibri/core/auth/viewsets/package (empty__init__.py) and move the three viewsets and their serializers intokolibri/core/auth/viewsets/facility_user.py, serializers above the viewsets that use them, as a pure-move commit. Update imports inapi.py,api_urls.py, and anywhere else that references the moved classes.Moving code breaks GitHub blame (local
git blame -C -Cstill works), so digest the history the move obscures:How to Get There
The moved endpoints are exercised at
/api/auth/facilityuser/,/api/auth/deletedfacilityuser/, and/api/public/facilityuser/(the latter routed viakolibri/core/public/api_urls.py).Out of Scope
api.pyorserializers.py— that happens in the final issue touching these files (Migrate FacilityUsernameViewSet to serializer-derived values pattern #14303)Acceptance Criteria
kolibri/core/auth/viewsets/facility_user.pycontainsFacilityUserViewSet,DeletedFacilityUserViewSet, andPublicFacilityUserViewSetplus their serializers (FacilityUserSerializer,FacilityUserRoleSerializer,DeletedFacilityUserSerializer,PublicFacilityUserSerializer), serializers above the viewsetsapi.py/serializers.py, with all references updated (auth/api_urls.py,public/api_urls.py,BaseSignUpViewSet, tests)Testing
python integration_testing/scripts/viewset_serialization_benchmark.py \ kolibri.core.auth.api.FacilityUserViewSet \ --inherit-kolibri-home -o facility_user_baseline.json # ... move ... python integration_testing/scripts/viewset_serialization_benchmark.py \ kolibri.core.auth.viewsets.facility_user.FacilityUserViewSet \ --inherit-kolibri-home --compare facility_user_baseline.jsonDeletedFacilityUserViewSetandPublicFacilityUserViewSet.kolibri manage generateuserdata.AI usage
Drafted with AI assistance (Claude Code) from an interactive design discussion, section by section, with review and final edits by @rtibbles. File locations, serializer relationships, routes, and benchmark comparison behavior were verified against the codebase during drafting.