Conversation
- Use two-phase query in findByProjectIdBridgeSecretV2: first get page of distinct CR ids (with DENSE_RANK), then fetch full data for those ids so each page returns exactly N change requests (not N commit rows). - Add tie-breaker to DENSE_RANK (ORDER BY createdAt DESC, id) so identical createdAt no longer produces duplicate ranks and variable page sizes. - Cap page ids and returned approvals at limit so page size is always correct even with ties or replica quirks.
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
Greptile OverviewGreptile SummaryThis PR fixes pagination issues and enhances search functionality for the secret approval request list (V2). Key Changes:
Issues Found:
Confidence Score: 3/5
Important Files Changed
|
backend/src/ee/services/secret-approval-request/secret-approval-request-dal.ts
Outdated
Show resolved
Hide resolved
varonix0
approved these changes
Jan 29, 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.
Context
Before: The change requests (CR) list had (1) pagination issues—total count and page size could be wrong because
DENSE_RANK()used onlycreatedAt, so ties produced more thanlimitrows per page and inconsistent totals; (2) search only supported author, environment, and policy path—not folder path or secret name.After:
DENSE_RANK() OVER (ORDER BY "createdAt" DESC, id)and a single total count; then we load full rows only for those IDs. Results are capped atlimitandtotalCountmatches the distinct CR count.requestFolderPathfromSecretFolder.name) and secret key (secretKeyfrom commit rows). The search filter includes path and secret name (e.g. “path”, “policy path or secret name” in the placeholder).Screenshots
N/A (backend + small placeholder text change).
Steps to verify the change
Type
Checklist
type(scope): short description.