Skip to content

Vb 6479 add sort order to paged results#366

Merged
Dhiraj Shetty (dhirajshettymoj) merged 11 commits intomainfrom
VB-6479-add-sort-order-to-paged-results
Mar 12, 2026
Merged

Vb 6479 add sort order to paged results#366
Dhiraj Shetty (dhirajshettymoj) merged 11 commits intomainfrom
VB-6479-add-sort-order-to-paged-results

Conversation

@dhirajshettymoj
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a deterministic tie-break sort to contact search pagination to prevent duplicate/missing records across pages (VB-6479), and introduces integration coverage + supporting test data to validate correct paging + ordering.

Changes:

  • Append contactId as a final sort field when searching contacts to ensure stable pagination.
  • Update unit test expectations for native-query sort conversion to include contact_id.
  • Add a new integration test suite (with supporting Flyway test migration data) to verify paging returns all expected results for multiple sort directions/fields.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/main/kotlin/uk/gov/justice/digital/hmpps/personalrelationships/service/ContactSearchService.kt Forces a stable sort by appending contactId to the requested sort before paging.
src/test/kotlin/uk/gov/justice/digital/hmpps/personalrelationships/service/ContactSearchServiceTest.kt Updates assertions so native sort conversion includes the added contact_id tiebreaker.
src/test/kotlin/uk/gov/justice/digital/hmpps/personalrelationships/integration/resource/SearchContactsPaginationIntegrationTest.kt New integration tests validating 5-page retrieval and ordering for lastName/dateOfBirth asc/desc.
src/main/resources/migrations/test/V2026.03.11.1__VB_6479_example_contacts_data.sql Adds 50 deterministic contacts (IDs 2001–2050) used by the new pagination integration tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

…hips/service/ContactSearchService.kt

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…hips/integration/resource/SearchContactsPaginationIntegrationTest.kt

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ple_contacts_data.sql

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@dhirajshettymoj Dhiraj Shetty (dhirajshettymoj) merged commit f5e0b23 into main Mar 12, 2026
9 of 10 checks passed
@dhirajshettymoj Dhiraj Shetty (dhirajshettymoj) deleted the VB-6479-add-sort-order-to-paged-results branch March 12, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants