Skip to content

Conversation

@LianaHarris360
Copy link
Member

Summary

Previously when adding/removing users on the LOD, the syncing to the server would sometimes stop completely, with the error:

[python-devserver]   File "/Users/lianaharris/kolibri/kolibri/core/auth/tasks.py", line 450, in soud_sync_processing
[python-devserver]     execute_sync(Context(user_id, instance_id))
[python-devserver]   File "/Users/lianaharris/kolibri/kolibri/core/device/soud.py", line 389, in execute_sync
[python-devserver]     kwargs["facility"] = context.user.facility_id
[python-devserver]     raise self.model.DoesNotExist(
[python-devserver] kolibri.core.auth.models.FacilityUser.DoesNotExist: FacilityUser matching query does not exist.

Indicating that executing a sync for a user failed because the user did not exist. This occurred because, when an imported user was deleted, a server sync for that user was still queued. When the sync was executed, it failed, causing the syncing to stop. This issue has been resolved by removing the corresponding user SyncQueue object when deleting imported users.

  • Remove users queued syncing tasks when deleting imported users
  • Update DeleteImportedUserTestCase to have full database access to ensure the SyncQueue device model can be queried during testing

References

Fixes #13543

Reviewer guidance

  1. On device 1 setup a server with learners
  2. On device 2 setup a Learn-only device and import several learners
  3. Start removing or adding learners for a period of time
  4. The removed users syncing status on the full device should eventually say "Waiting to sync" and "Not recently synced"

@LianaHarris360 LianaHarris360 added the P0 - critical Priority: Release blocker or regression label Sep 2, 2025
@github-actions github-actions bot added DEV: backend Python, databases, networking, filesystem... SIZE: very small labels Sep 2, 2025
Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes make sense to me - and as we couldn't delete users from LoDs in 0.18 my first question of "Should we target this to the patch?" can be answered "No".

Just requires QA verification of the fix.

@AlexVelezLl
Copy link
Member

Code changes make sense to me - and as we couldn't delete users from LoDs in 0.18 my first question of "Should we target this to the patch?" can be answered "No".

@rtibbles You mean removing the SyncQueue objects in the delete facility process too? This PR modifies the _get_user_related_models function that was introduced in 0.19, so we wouldn't be able to target the next 0.18 patch

@rtibbles
Copy link
Member

rtibbles commented Sep 2, 2025

Yes - my point was that because this is a bug in unreleased functionality, we wouldn't need to put this in a patch (I just wanted to get my thought down in Github in case anyone else wondered the same).

@rtibbles
Copy link
Member

rtibbles commented Sep 2, 2025

The Mac test failures here have been fixed in the release-v0.18.x branch, but have not yet been merged up to develop.

@pcenov pcenov self-requested a review September 3, 2025 15:04
Copy link
Member

@pcenov pcenov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @LianaHarris360, I confirm that the error is fixed now and syncing is functioning correctly.

@LianaHarris360 LianaHarris360 merged commit 5511d32 into learningequality:develop Sep 4, 2025
51 of 52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DEV: backend Python, databases, networking, filesystem... P0 - critical Priority: Release blocker or regression SIZE: very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Manage users in LOD - Syncing to the servers stops for no obvious reason

4 participants