fix(user_status): stabilise the user_status#59535
Open
miaulalala wants to merge 4 commits intomasterfrom
Open
Conversation
8eec494 to
361fc17
Compare
Contributor
Author
|
/backport to stable33 |
Contributor
Author
|
/backport to stable32 |
…m list methods The background cleanup job operated on all rows including backups: - clearOlderThanClearAt() deleted backup rows with expired clear_at, destroying saved statuses before they could be restored - clearStatusesOlderThan() overwrote backup statuses to OFFLINE, corrupting saved DND/away states Additionally, findAll() leaked backup rows into user-facing lists, and findAllRecent() filtered backups via slow LIKE pattern instead of the is_backup column. Add is_backup=false filter to all four methods. AI-Assisted-By: Claude Opus 4.6 Signed-off-by: Anna Larch <anna@nextcloud.com>
UserDeletedListener only called removeUserStatus(), leaving backup status rows (prefixed _userId) orphaned in the database forever. AI-Assisted-By: Claude Opus 4.6 Signed-off-by: Anna Larch <anna@nextcloud.com>
Multiple code paths in StatusService silently swallowed failures, making it impossible to debug status reliability issues. Add debug logging for: backup creation conflicts, aborted automated status changes, failed revert operations, and concurrent insert conflicts. AI-Assisted-By: Claude Opus 4.6 Signed-off-by: Anna Larch <anna@nextcloud.com>
… queries - testFindAllExcludesBackups: verify findAll() doesn't return backup rows - testFindAllRecentExcludesBackups: verify findAllRecent() excludes backups - testClearOlderThanClearAtPreservesBackups: verify backup rows survive clear_at cleanup - testClearStatusesOlderThanPreservesBackups: verify backup statuses aren't overwritten to OFFLINE by age-based cleanup - testHandleWithCorrectEvent: verify removeBackupUserStatus() is also called when a user is deleted AI-Assisted-By: Claude Opus 4.6 Signed-off-by: Anna Larch <anna@nextcloud.com>
361fc17 to
7db0863
Compare
CarlSchwan
approved these changes
Apr 10, 2026
| ->where($qb->expr()->isNotNull('clear_at')) | ||
| ->andWhere($qb->expr()->lte('clear_at', $qb->createNamedParameter($timestamp, IQueryBuilder::PARAM_INT))); | ||
| ->andWhere($qb->expr()->lte('clear_at', $qb->createNamedParameter($timestamp, IQueryBuilder::PARAM_INT))) | ||
| ->andWhere($qb->expr()->eq('is_backup', $qb->createNamedParameter(false, IQueryBuilder::PARAM_BOOL))); |
Member
There was a problem hiding this comment.
Also backups that are in the past should be cleared?
| $qb->expr()->eq('status', $qb->createNamedParameter(IUserStatus::ONLINE)) | ||
| )); | ||
| )) | ||
| ->andWhere($qb->expr()->eq('is_backup', $qb->createNamedParameter(false, IQueryBuilder::PARAM_BOOL))); |
Member
There was a problem hiding this comment.
Also backups that are in the past should be cleared?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
user_statusbackup mechanism (saves/restores status during calls, calendar events, OOO) had several bugs causing unreliable status restoration.Bugs fixed
1. Background job actively destroys backups (most critical)
clearOlderThanClearAt()deleted backup rows with expiredclear_atclearStatusesOlderThan()overwrote backup statuses to OFFLINEis_backup=falsefilter to both queries2. Backup rows leaked into user-facing queries
findAll()returned backup rows (prefixed_userId) to callersfindAllRecent()filtered via slowLIKE '_%'instead ofis_backupcolumnis_backup=falsetofindAll(), replacedLIKEwithis_backupcheck infindAllRecent()3. User deletion orphaned backups
UserDeletedListeneronly removed active status, leaving backup rows foreverremoveBackupUserStatus()4. Silent failures with no logging
null/falsewith zero loggingdebuglogging to 4 silent failure paths inStatusServiceTests added
Checklist
3. to review, feature component)stable32)AI (if applicable)