Bulk import applies an unchanged row only in part
❌ 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_INandASSIGNED_TOare not added. Removals fromENROLLED_INandASSIGNED_TOstill 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:
--deletedeleting their user,full_clean()failures, rejected renames. #15824, PR #15925. - Renames and duplicate
UUIDrows: #15824. USER_TYPEon 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_INandASSIGNED_TO. - [ ] The #15792 repro tests
test_restored_unchanged_soft_deleted_user_is_undeleted,test_unchanged_user_gets_new_enrollmentandtest_unchanged_user_gets_new_assignmentpass.
References
build_users_objectsqueues only users whose fields changed._rungives classes only to queued users.
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.
Narrowed to unchanged rows. The rejected-row criteria moved to #15925, and USER_TYPE to #15867 (#15926).
Body matches the narrowed scope; added PR #15926 to the USER_TYPE out-of-scope line.