kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Bulk import applies an unchanged row only in part

Open rtibblesbot opened this issue 2 weeks ago • 2 comments

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Target branch: develop

Context

Part of #15792. Covers its existing-user scope items not in #15824 or #15867. Rebase onto #15925 and #15926: both change build_users_objects.

Observed behavior

On develop at 925b1cde07, an accepted row whose fields match the user's stored fields is only partly applied:

  • A soft-deleted user stays deleted.
  • New classes in ENROLLED_IN and ASSIGNED_TO are not added. Removals from ENROLLED_IN and ASSIGNED_TO still apply.

User-facing consequences

  • An admin cannot enrol existing users or assign them to classes by CSV without also changing another field.
  • A soft-deleted user named in the CSV stays deleted.

Steps to reproduce

In facility F, create learner ann with full name Ann and no gender, birth year or identifier, and class C1. Write a CSV with the header row and <ann's id>,ann,*,Ann,LEARNER,,,,C1,, then run kolibri manage bulkimportusers <file> --facility <F's id>. ann is not in C1.

Out of scope

  • Rejected rows: --delete deleting their user, full_clean() failures, rejected renames. #15824, PR #15925.
  • Renames and duplicate UUID rows: #15824.
  • USER_TYPE on unchanged rows, and removing facility roles: #15867, PR #15926.

Acceptance criteria

  • [ ] A row naming a soft-deleted user, with fields matching their stored fields, restores that user.
  • [ ] A row whose fields match its user's stored fields adds the classes in ENROLLED_IN and ASSIGNED_TO.
  • [ ] The #15792 repro tests test_restored_unchanged_soft_deleted_user_is_undeleted, test_unchanged_user_gets_new_enrollment and test_unchanged_user_gets_new_assignment pass.

References

AI usage

Claude Code split #15792 into sub-issues, traced each case through bulk_import.py at 925b1cde07, and drafted this one. I narrowed it to unchanged rows once #15925 and #15926 took the rest.

rtibblesbot avatar Nov 18 '26 01:11 rtibblesbot

Narrowed to unchanged rows. The rejected-row criteria moved to #15925, and USER_TYPE to #15867 (#15926).

rtibbles avatar Nov 24 '26 20:11 rtibbles

Body matches the narrowed scope; added PR #15926 to the USER_TYPE out-of-scope line.

rtibblesbot avatar Nov 24 '26 22:11 rtibblesbot