fix: detect that the signer search has more results - #8286
Merged
vitormattos merged 3 commits intoSep 7, 2026
Conversation
The limit was incremented before the mapper call and the extra row was then looked for beyond that same incremented limit. As IdentifyMethodMapper::searchByIdentifierValue() applies setMaxResults(), it can never return more rows than it was asked for, so the condition was never true: the plugin never reported more results and never removed the extra row it had asked for. A search with more signers than the page could show returned one item too many, and that item appeared again at the top of the next page, because the offset is applied in SQL. The mapper is still asked for one row beyond the page, and that row is now what tells the plugin there is more to show, in the same way AccountPhonePlugin and ContactPhonePlugin do it. The previous pagination test could not catch this: it returned 31 rows from a mapper call made with a limit of 26. The scenarios now stay within what the mapper can answer and cover the boundary, where the number of rows found is exactly the size of the page. Ref LibreSign#8053 Assisted-by: Claude Code:claude-opus-5 Signed-off-by: André Maia <andrefnkmm@gmail.com>
canValidateMethod() was private and had no caller anywhere in the project. It never ran, so no test and no mutant could reach it. Ref LibreSign#8053 Assisted-by: Claude Code:claude-opus-5 Signed-off-by: André Maia <andrefnkmm@gmail.com>
Infection showed that nothing asserted the label and the value offered for a signer, so the display name and the identifier could be dropped from the result item without any test noticing. It also showed that the search term itself was never written in a different case than the stored data, so lowercasing it was not covered on either side of the comparison. The scenarios now cover an identifier stored in another case, a search typed in another case, and a match by display name where both are written differently. Ref LibreSign#8053 Assisted-by: Claude Code:claude-opus-5 Signed-off-by: André Maia <andrefnkmm@gmail.com>
vitormattos
approved these changes
Sep 7, 2026
Member
|
/backport to stable35 |
Member
|
/backport to stable34 |
Member
|
/backport to stable33 |
Member
|
/backport to stable32 |
This was referenced Sep 7, 2026
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.
Related to: #8053
📝 Summary
Infection on
lib/Collaboration/Collaborators/SignerPlugin.phpreported 21 mutants, 6 escaped and a Covered MSI of 71%. One of them,>into>=on line 52, pointed at a real problem rather than a missing assertion.$limitwas incremented before the mapper call and the extra row was then looked for beyond that same incremented limit. AsIdentifyMethodMapper::searchByIdentifierValue()appliessetMaxResults(), it can never return more rows than it was asked for, socount($identifiers) > $limitwas never true: the plugin never reported more results and never removed the extra row it had asked for.What a user sees: a search with more signers than the page can show returns one item too many, and that item appears again at the top of the next page, because the offset is applied in SQL. The flag itself does not reach the API today —
IdentifyController::search()destructures[$result]and drops the second element returned by the collaborators search — so the visible part is the extra item and its repetition.The mapper is still asked for one row beyond the page, and that row is now what tells the plugin there is more to show, in the same way
AccountPhonePluginandContactPhonePluginalready do it.The old pagination test could not catch this: it returned 31 rows from a mapper call made with a limit of 26. The scenarios now stay within what the mapper can answer and cover the boundary, where the number of rows found is exactly the size of the page.
This PR also removes
canValidateMethod(). It was private and had no caller anywhere in the project, so it never ran and no mutant could reach it.The remaining escaped mutants were assertions missing from the tests: nothing checked the label and the value offered for a signer, and the search term was never written in a different case than the stored data, so lowercasing it was not covered on either side of the comparison.
The three commits are meant to be read in order: the fix with its regression test, the removal of the unused method, then the remaining test improvements.
🧪 How to test
Expected result:
To see the bug, check out the first commit and revert only
lib/Collaboration/Collaborators/SignerPlugin.php. Theone row more than the page can showscenario then fails with:Infection, scoped to this source file:
Expected result:
The classes around this one were run as well:
IdentifyControllerTest,ResultFormatterTest,ShareTypeResolverTestand the four collaborator plugins — 82 tests, 215 assertions, all passing. Psalm reports no error on the changed file.⚙️ API / Back‑end changes
SignerPlugin::canValidateMethod()was removed.✅ Checklist
php-cs-fixer,php -land psalm pass on the changed files.🤖 AI (if applicable)