Skip to content

Conversation

@eyeinsky
Copy link
Collaborator

@eyeinsky eyeinsky commented Nov 25, 2025

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Nov 25, 2025
@eyeinsky eyeinsky force-pushed the ml/WPB-21768--scim-groups-pagination branch 2 times, most recently from aee32ca to d313e58 Compare November 26, 2025 17:19
@eyeinsky eyeinsky force-pushed the ml/WPB-21768--scim-groups-pagination branch from d313e58 to 9498a50 Compare December 4, 2025 15:50
@eyeinsky eyeinsky marked this pull request as ready for review December 4, 2025 15:51
@eyeinsky eyeinsky requested a review from a team as a code owner December 4, 2025 15:51
@battermann battermann requested a review from Copilot December 4, 2025 16:44
Copy link
Contributor

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

This PR adds pagination support to the SCIM API's GET /Groups and filter groups endpoints. Previously, these endpoints returned all groups in a single response. The implementation adds startIndex and count query parameters following the SCIM specification's 1-based index pagination model.

Key Changes:

  • Added startIndex and count parameters to SCIM group listing endpoints
  • Implemented offset-based pagination in the database layer using SQL OFFSET/LIMIT
  • Updated the internal Brig API to accept pagination parameters
  • Added comprehensive integration tests for pagination behavior

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
libs/hscim/src/Web/Scim/Class/Group.hs Extended GroupDB interface to accept startIndex and count parameters
libs/hscim/src/Web/Scim/Schema/ListResponse.hs Added toPage helper function for creating paginated responses
libs/hscim/src/Web/Scim/Server/Mock.hs Updated mock implementation to support pagination parameters
libs/wire-subsystems/src/Wire/ScimSubsystem.hs Updated type signature to include pagination parameters
libs/wire-subsystems/src/Wire/ScimSubsystem/Interpreter.hs Modified to construct ListResponse with correct pagination metadata
libs/wire-subsystems/src/Wire/UserGroupSubsystem.hs Extended GetGroupsInternal to accept startIndex and count
libs/wire-subsystems/src/Wire/UserGroupSubsystem/Interpreter.hs Implemented offset-based pagination using PaginationOffset
libs/wire-subsystems/src/Wire/UserGroupStore.hs Removed unused helper functions toSortBy and mkPaginationState
libs/wire-subsystems/src/Wire/UserGroupStore/Postgres.hs Added SQL offset clause and modified ORDER BY for offset pagination
libs/wire-subsystems/src/Wire/PaginationState.hs Added PaginationOffset constructor and updated paginationClause
libs/wire-subsystems/src/Wire/Postgres.hs Added offset query fragment helper function
libs/wire-subsystems/src/Wire/BrigAPIAccess.hs Updated GetGroupsInternal signature with pagination parameters
libs/wire-subsystems/src/Wire/BrigAPIAccess/Rpc.hs Added startIndex and count query parameters to HTTP request
libs/wire-subsystems/test/unit/Wire/MockInterpreters/UserGroupStore.hs Implemented offset-based pagination in mock with sorting logic
libs/wire-api/src/Wire/API/Routes/Internal/Brig.hs Added startIndex and count query parameters to route definition
services/brig/src/Brig/API/Internal.hs Updated handler to accept and pass through pagination parameters
services/spar/src/Spar/Scim/Group.hs Added Natural type conversions for pagination parameters
integration/test/Test/Spar.hs Added comprehensive pagination test with multiple pages
integration/test/API/Spar.hs Added filterScimUserGroupPaginate helper function

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

@eyeinsky eyeinsky force-pushed the ml/WPB-21768--scim-groups-pagination branch 2 times, most recently from a32e1c4 to 67b0c15 Compare December 12, 2025 07:24
- say directly what the pagination state is, don't go through a function
- `toSortBy` isn't used anywhere and won't fit with changes to PaginationState either
- inline `mkPaginationState`
.. by being lazy and just using Int32 in wire-server interfaces, as
this is what PageSize internally is anyway.
@eyeinsky eyeinsky force-pushed the ml/WPB-21768--scim-groups-pagination branch from 67b0c15 to 46e8534 Compare December 15, 2025 14:57
@eyeinsky eyeinsky requested review from a team as code owners December 16, 2025 09:08
@fisx
Copy link
Contributor

fisx commented Dec 17, 2025

I don't understand this error:

hscim> test/Test/Class/GroupSpec.hs:32:1: error: [GHC-66111] [-Wunused-imports, Werror=unused-imports]
hscim>     The import of ‘GHC.Stack’ is redundant
hscim>       except perhaps to import instances from ‘GHC.Stack’
hscim>     To import instances alone, use: import GHC.Stack()
hscim>    |
hscim> 32 | import GHC.Stack (HasCallStack)
hscim>    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

if it were a "normal" constraint, HasCallStack should be required by assertFailure, but i don't think that's how HasCallStack is discharged.

just switch off the warning in this module? 76d187b

@akshaymankar
Copy link
Member

I don't understand this error:

hscim> test/Test/Class/GroupSpec.hs:32:1: error: [GHC-66111] [-Wunused-imports, Werror=unused-imports]
hscim>     The import of ‘GHC.Stack’ is redundant
hscim>       except perhaps to import instances from ‘GHC.Stack’
hscim>     To import instances alone, use: import GHC.Stack()
hscim>    |
hscim> 32 | import GHC.Stack (HasCallStack)
hscim>    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

if it were a "normal" constraint, HasCallStack should be required by assertFailure, but i don't think that's how HasCallStack is discharged.

just switch off the warning in this module? 76d187b

The warning is about the import, not about a redundant constraint.

fisx and others added 7 commits December 18, 2025 11:29
.. as the arguments are already of the correct type.
- actually check startIndex defaulting when out of range
- remove separate test where startIndex and count are provided as this
  is already tested above
- add a second test with negative startIndex
- fix comments
@fisx fisx dismissed akshaymankar’s stale review December 19, 2025 13:06

we've taken care of all your suggestions 👍

@fisx fisx merged commit f55a39c into develop Dec 20, 2025
10 of 11 checks passed
@fisx fisx deleted the ml/WPB-21768--scim-groups-pagination branch December 20, 2025 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants