Skip to content

fix: skip header row in retire_user CSV - #38977

Open
rahulkanneri-2u wants to merge 1 commit into
openedx:masterfrom
rahulkanneri-2u:fix-skip-retire-user-csv-header
Open

fix: skip header row in retire_user CSV#38977
rahulkanneri-2u wants to merge 1 commit into
openedx:masterfrom
rahulkanneri-2u:fix-skip-retire-user-csv-header

Conversation

@rahulkanneri-2u

Copy link
Copy Markdown

Description

Updates the retire_user management command to skip a CSV header row when the first two columns are username,email or username,user_email.

This fixes a Stage retire_users_from_csv failure where the command treated the header row as a real user and failed with:

Could not find users with specified username and email address: [{'username': 'email'}]

Impact: Operators running the retirement management command with a CSV file can now use a CSV that includes a standard header row. No learner-facing UI impact.

Supporting information

Private Jira: BOMS-717

Testing instructions

  1. Create a CSV with a header row and one valid user:

    username,email
    <username>,<email>
  2. Run:

    python manage.py lms retire_user --user_file <path-to-file>
  3. Confirm the command skips the header row and processes the real user.

Automated coverage added:

  • Added a regression test for retire_user --user_file with a username,email header row.

Local verification:

  • Ran python -m py_compile on the touched command and test files.
  • Targeted pytest could not run locally because this environment is missing kombu during conftest.py import.

Deadline

None

Other information

This does not include the edx-internal cleanup that will eventually re-enable notifications. That can happen after this fix is deployed to Stage and the retire_users_from_csv job is confirmed passing.

No migrations, UI changes, or accessibility concerns.

@rahulkanneri-2u
rahulkanneri-2u requested a review from a team as a code owner August 12, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant