Skip to content

Fix getIssues WHERE to use state-aware lookback timestamps - #4

Merged
anderdc merged 2 commits into
mainfrom
test
Apr 27, 2026
Merged

Fix getIssues WHERE to use state-aware lookback timestamps#4
anderdc merged 2 commits into
mainfrom
test

Conversation

@anderdc

@anderdc anderdc commented Apr 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Brings getIssues to parity with the recent getPullRequests fix in c275848. Issues now use the same state-aware lookback pattern as PRs.

Before:
```sql
WHERE i.author_github_id = $1
AND i.created_at >= $2
```

After:
```sql
WHERE i.author_github_id = $1
AND (
(i.state = 'OPEN' AND i.created_at >= $2)
OR (i.state = 'CLOSED' AND i.closed_at >= $2)
)
```

Why

The asymmetry was caught during validator-side review: an issue authored 40 days ago and closed yesterday is missed by the current query, even though the symmetric PR (opened 40 days ago, merged yesterday) is now correctly returned by /pulls after c275848.

Concrete impact for the validator: a miner who solves a long-standing issue with a recent PR has the solving PR fetched and scored via OSS, but the issue itself is invisible to issue discovery, so the miner doesn't get discovery credit for solving it.

Behavior

  • OPEN issues: filtered by created_at — stale never-closed issues drop off (matches OPEN PR semantics)
  • CLOSED issues: filtered by closed_at — late-closed long-stale issues still surface (matches MERGED PR semantics)

Test plan

  • Manual: hit /api/v1/miners/:gh/issues?since=<date> against a miner with an issue created >35 days ago and closed within the window — confirm it appears
  • Manual: hit the same with an OPEN issue created >35 days ago — confirm it does NOT appear
  • Spot-check existing OPEN/CLOSED issues in window still return as before

anderdc added 2 commits April 27, 2026 13:44
Mirrors the c275848 fix on getPullRequests. CLOSED issues filter on
closed_at instead of created_at so an issue authored before the lookback
window but closed within it (e.g. a long-standing bug solved yesterday)
still appears in the discovery response. OPEN issues stay on created_at
to match OPEN PR semantics — stale never-closed issues drop off.
@anderdc
anderdc merged commit 5e5cae1 into main Apr 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant