[PLTFRM-1567] Fix corrupter roles querying when viewing the user list#101
Open
andrea-sdl wants to merge 6 commits into
Open
[PLTFRM-1567] Fix corrupter roles querying when viewing the user list#101andrea-sdl wants to merge 6 commits into
andrea-sdl wants to merge 6 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds resilience testing for handling corrupted user roles in the inactive users functionality. It introduces a new test class that runs all existing InactiveUsers tests with deliberately corrupted role data to ensure the system can handle database corruption scenarios gracefully.
Key Changes
- Added comprehensive test coverage for corrupted role data scenarios (missing 'name' keys, malformed 'capabilities')
- Integrated Role_Sanitizer into the inactive users module to handle role corruption at query time
- Implemented try-finally blocks to ensure Role_Sanitizer cleanup happens reliably
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/phpunit/test-inactive-users-corrupted.php | New test class that extends InactiveUsersTest and runs all tests with corrupted role data, including custom error handler to suppress expected warnings |
| modules/inactive-users/class-inactive-users.php | Integrated Role_Sanitizer calls into blocked users view and filter logic to handle corrupted roles when querying inactive users |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Description
NOTE: This PR has issues with the tests on a multisite environment. "as if" the fix isn't working. I can confirm it's working locally but can't figure out a way to make the unit tests work properly. Don't merge this PR until tests are fixed. Comments are welcome.
Followup to #99
While working on some new stuff, I noticed we were still having issues navigating the interface if we had broken roles, when using the Inactive User module in the "BLOCK" setting.
This PR adds additional corrupted roles fixes to this scenario to ensure everything works (and adds some tests to ensure we catch this )
Pre-review checklist
Please make sure the items below have been covered before requesting a review:
Pre-deploy checklist
Steps to Test