Skip to content

Add mandatory pagination and 3-char search minimum to FacilityUsernameViewSet#14823

Open
rtibblesbot wants to merge 2 commits into
learningequality:developfrom
rtibblesbot:issue-14820-93374d
Open

Add mandatory pagination and 3-char search minimum to FacilityUsernameViewSet#14823
rtibblesbot wants to merge 2 commits into
learningequality:developfrom
rtibblesbot:issue-14820-93374d

Conversation

@rtibblesbot
Copy link
Copy Markdown
Contributor

@rtibblesbot rtibblesbot commented Jun 6, 2026

Plan: Add mandatory pagination (default 10, max 20) and a 3-character minimum search requirement to FacilityUsernameViewSet, then update the sign-in page frontend to consume the new paginated response.

  • Write failing backend tests
  • Implement backend pagination and search validation
  • Write failing frontend tests for SignInPage
  • Implement frontend changes to consume paginated response

status

Summary

Add mandatory pagination to /api/auth/facilityusername/ — default page size 10, capped at 20 — and reject search params shorter than 3 characters with a 400. The sign-in page is updated to read usernames from data.results and determine listing-view eligibility from total_pages rather than num_users, so large facilities no longer transfer their full username list on facility selection.

References

Closes #14820

Reviewer guidance

  1. With a facility that has Allow learners to sign in with no password enabled, sign out and select the facility on the sign-in page. For a facility with ≤16 passwordless learners, the clickable user list should appear; for a larger one, it should not — the listing-view decision now comes from the API's total_pages, not num_users.
  2. On the username field, confirm the suggestions dropdown does not fire until 3 characters are typed.
  3. Risky area: FacilityUsernameViewSet.list() in kolibri/core/auth/api.py — the 400 short-search path bypasses DRF's normal filter pipeline; verify that super().list() still runs filters correctly for ≥3-char searches.

AI usage

Claude Code (autonomous agent mode) implemented this via TDD: wrote failing backend tests, implemented the FacilityUsernamePagination class and list() override, then wrote failing frontend tests and updated SignInPage to consume the paginated response. I reviewed the plan before execution and the diff after.


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Ran pre-flight CI checks (lint, format, tests) and verified all pass
  • Rebased onto the target branch and resolved any conflicts
  • Reorganized commit history into clean, logical commits
  • Audited the diff to ensure only issue-relevant files are changed
  • Built PR body from the repository's PR template with evidence blocks

rtibblesbot and others added 2 commits June 6, 2026 13:11
…eViewSet

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added DEV: backend Python, databases, networking, filesystem... APP: User Re: User app (sign-in, sign-up, user profile, etc.) DEV: frontend SIZE: medium labels Jun 6, 2026
@rtibblesbot rtibblesbot marked this pull request as ready for review June 6, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

APP: User Re: User app (sign-in, sign-up, user profile, etc.) DEV: backend Python, databases, networking, filesystem... DEV: frontend SIZE: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Paginate the facility username endpoint and require a minimum search length

1 participant