Skip to content

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

Description

@kiannidev

Description

GET/POST /api/v1/miners/:githubId/pulls applies inconsistent time windows across PR states. MERGED PRs correctly use merged_at >= since. CLOSED (unmerged) PRs use created_at >= since, while the sibling /issues endpoint uses closed_at >= since for closed issues. Old PRs closed inside the scoring window but opened before since are omitted from miner pull results.

Steps to Reproduce

  1. Mirror a repo with a miner-authored PR: created_at = 60 days ago, closed_at = 5 days ago, state = CLOSED (not merged).
  2. Call GET /api/v1/miners/{authorId}/pulls?since= (ISO timestamp 30 days ago).
  3. Call GET /api/v1/miners/{authorId}/issues?since= (same timestamp).
  4. The closed issue appears (closed_at >= since); the closed PR does not (created_at < since).
  5. Repeat with POST .../pulls and since_by_repo — same filter in getPullRequestsByRepo.

Expected Behavior

CLOSED PRs should enter the window when closed_at >= since, matching issues and matching how MERGED uses merged_at.

Actual Behavior

(p.state = 'CLOSED' AND p.created_at >= $2)   -- should use closed_at

Environment

  • OS: Linux
  • Runtime/Node version: Node 20

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions