Skip to content

fix(miners): use closed_at for CLOSED PRs in pull request window filter#149

Open
Tet-9 wants to merge 1 commit into
entrius:testfrom
Tet-9:fix/139-closed-prs-use-closed-at
Open

fix(miners): use closed_at for CLOSED PRs in pull request window filter#149
Tet-9 wants to merge 1 commit into
entrius:testfrom
Tet-9:fix/139-closed-prs-use-closed-at

Conversation

@Tet-9
Copy link
Copy Markdown
Contributor

@Tet-9 Tet-9 commented May 30, 2026

Summary

getPullRequests and getPullRequestsByRepo in miners.service.ts were filtering CLOSED pull requests using created_at >= since, causing PRs that were closed within the scoring window but opened before since to be silently omitted from miner results.

Root Cause

Both query branches had an inconsistent condition for the CLOSED state:

-- 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:

  • MERGED PRs, which correctly use merged_at >= since
  • The sibling /issues endpoint, which correctly uses closed_at >= since for closed issues

Changes

  • packages/das/src/api/miners/miners.service.ts: fixed the CLOSED branch in both getPullRequests (GET path) and getPullRequestsByRepo (POST path) to use closed_at

Testing

Lint and build confirmed pre-existing failures in cache.module.ts are unrelated to this change. Only miners.service.ts was modified.

Fixes #139

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
@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 30, 2026
@Tet-9
Copy link
Copy Markdown
Contributor Author

Tet-9 commented May 30, 2026

@anderdc , if you could please check this out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] miners API: CLOSED pull requests filtered by created_at instead of closed_at

1 participant