fix(miners): sort pull requests by state-relevant timestamp - #194
Closed
Yurii214 wants to merge 1 commit into
Closed
fix(miners): sort pull requests by state-relevant timestamp#194Yurii214 wants to merge 1 commit into
Yurii214 wants to merge 1 commit into
Conversation
Use merged_at / closed_at / created_at for ORDER BY, since-window filtering, and keyset pagination on both GET and POST pull endpoints. Aligns paginated cursors with the same sort key (entrius#186). Fixes entrius#186
Contributor
Author
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.
Summary
merged_atfor MERGED,closed_atfor CLOSED,created_atfor OPEN).sincewindow filter (was incorrectly usingcreated_at).GET /miners/:id/pullsandPOST /miners/:id/pulls(per-repo path), so paginated pages stay ordered consistently.Shared SQL fragments (
PR_SORT_AT,PR_ORDER_BY,PR_SINCE_WINDOW*) keep the GET and POST paths identical.Why
Validators window PRs by
sinceand expect recently merged/closed work to rank above older OPEN PRs. Sorting everything bycreated_atmade stale-looking responses when a CLOSED PR had an oldcreated_atbut a recentclosed_at.What might break
created_atas the page key; clients mid-pagination may need to restart from the first page once. New cursors encode the state-relevant sort timestamp in the existing cursor field.Type of Change
Testing
npm run buildinpackages/dasnpm run lintinpackages/dasnpm run format:checkinpackages/dascreated_atand recentclosed_atnow sorts above older OPEN PRs when both are in the scoring windowFixes #186