fix(miners): use closed_at for CLOSED PRs in pull request window filter#149
Open
Tet-9 wants to merge 1 commit into
Open
fix(miners): use closed_at for CLOSED PRs in pull request window filter#149Tet-9 wants to merge 1 commit into
Tet-9 wants to merge 1 commit into
Conversation
Both getPullRequests and getPullRequestsByRepo were filtering CLOSED pull requests by created_at >= since, causing PRs closed within the scoring window but opened before it to be omitted from miner results. Fix both query branches to use closed_at >= since for CLOSED state, consistent with how merged_at is used for MERGED and how the sibling issues endpoint already handles closed issues. Fixes entrius#139
Contributor
Author
|
@anderdc , if you could please check this out |
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
getPullRequestsandgetPullRequestsByRepoinminers.service.tswere filteringCLOSEDpull requests usingcreated_at >= since, causing PRs that were closed within the scoring window but opened beforesinceto be silently omitted from miner results.Root Cause
Both query branches had an inconsistent condition for the
CLOSEDstate:-- Before (incorrect)
OR (p.state = 'CLOSED' AND p.created_at >= $2)
-- After (correct)
OR (p.state = 'CLOSED' AND p.closed_at >= $2)
This is inconsistent with:
MERGEDPRs, which correctly usemerged_at >= since/issuesendpoint, which correctly usesclosed_at >= sincefor closed issuesChanges
packages/das/src/api/miners/miners.service.ts: fixed theCLOSEDbranch in bothgetPullRequests(GET path) andgetPullRequestsByRepo(POST path) to useclosed_atTesting
Lint and build confirmed pre-existing failures in
cache.module.tsare unrelated to this change. Onlyminers.service.tswas modified.Fixes #139