Repository navigation
Conversation
Fix the Unified Search provider so pagination terminates correctly and returns stable results. - Validate the cursor (null, int or digits-only string) and the limit before any database access - Fetch one extra row to know if a next page exists, and return complete() instead of always returning paginated() - Apply the SQL offset directly instead of deriving a fractional page - Order by created_at then id so equal timestamps give a stable order Related issue: LibreSign#9067 Type: Bug fix - [x] Validate cursor and limit in FileSearchProvider::search() - [x] Return complete() when no next page exists - [x] Use setFirstResult/setMaxResults in getFilesToSearchProvider() - [x] Add id as ordering tie-breaker - [x] Add unit tests for the provider contract - [x] Add database tests for ordering and offset Signed-off-by: KMS <243513302+AlyNotMe@users.noreply.github.com>
YvesCesar
left a comment
There was a problem hiding this comment.
Thanks for the PR! I reviewed and tested it locally on MySQL:
tests/php/Unit/Search/FileSearchProviderTest.php: 21 tests passingtests/php/Integration/Db/SignRequestMapperSearchPaginationTest.php: 5 tests passing- Running the same tests against the previous code fails, so they really cover the fix.
Cursor validation, the limit + 1 next-page detection and the f.id tie-breaker all look correct to me. No changes requested from my side.
|
Thanks for the review, @YvesCesar, and thanks @vitormattos for assigning me! About the failing PHPUnit integration jobs: they are all the same One more thing: I'm a Node.js backend developer looking for my first Thanks again for your time! |
Closes #9067
What
complete()whenthere is none and
paginated()only when more rows remainsetFirstResult/setMaxResults)instead of deriving a fractional page number
idas a tie-breaker aftercreated_atso equal timestamps keepa stable order. The shared query builder is untouched, so other file
lists keep their current sorting
Tests
input), limit + 1 request, empty/partial/exact-limit/next-page cases,
and the extra row is never returned
duplicates or gaps, offset not a multiple of the limit, limit respected
composer test:unit,composer test:integration(new test),composer cs:checkandcomposer psalmlocally