From 975226a7e7b828b6d81c5c2fd4c0f8d2383b8b71 Mon Sep 17 00:00:00 2001 From: anderdc Date: Sun, 10 May 2026 17:59:47 -0500 Subject: [PATCH] feat(miners): unbound OPEN issues when since is omitted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When `since` is provided, behavior is unchanged: OPEN created on/after, CLOSED closed on/after — the scoring window. When `since` is omitted, the response now returns all currently-OPEN issues with no time bound and no CLOSED history. Callers asking for "current open-issue load" no longer need a synthetic epoch-since workaround that pulls a full all-time payload. Lets the validator's open-issue spam-multiplier count old still-open issues that fall outside the scoring lookback window — the gap called out in entrius/gittensor#929 / PR #930. --- packages/das/src/api/miners/miners.controller.ts | 14 +++++++++----- packages/das/src/api/miners/miners.service.ts | 6 +++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/das/src/api/miners/miners.controller.ts b/packages/das/src/api/miners/miners.controller.ts index befa9f1..61288eb 100644 --- a/packages/das/src/api/miners/miners.controller.ts +++ b/packages/das/src/api/miners/miners.controller.ts @@ -37,21 +37,25 @@ export class MinersController { @ApiOperation({ summary: "Issues authored by a miner", description: - "Returns every issue the miner has authored since the given date, " + - "including current labels with actor attribution and the PR number " + - "(if any) that solved the issue.", + "Returns issues the miner has authored, with current labels (actor " + + "attribution) and any solving PR. When `since` is provided, returns " + + "OPEN issues created on/after that date plus CLOSED issues closed " + + "on/after that date (scoring window). When `since` is omitted, " + + "returns all currently-OPEN issues with no time bound and no CLOSED " + + "history (open-issue load counting).", }) @ApiParam({ name: "githubId", description: "GitHub user ID (numeric)" }) @ApiQuery({ name: "since", required: false, description: - "ISO timestamp. Defaults to 35 days ago (midnight UTC) if omitted.", + "ISO timestamp. When omitted, the response contains all currently-" + + "OPEN issues with no time bound and no CLOSED history.", }) async getIssues( @Param("githubId") githubId: string, @Query("since") since?: string, ): Promise { - return this.miners.getIssues(githubId, MinersService.resolveSince(since)); + return this.miners.getIssues(githubId, since ?? null); } } diff --git a/packages/das/src/api/miners/miners.service.ts b/packages/das/src/api/miners/miners.service.ts index e4f1619..180953f 100644 --- a/packages/das/src/api/miners/miners.service.ts +++ b/packages/das/src/api/miners/miners.service.ts @@ -124,10 +124,10 @@ export class MinersService { async getIssues( githubId: string, - since: string, + since: string | null, ): Promise<{ github_id: string; - since: string; + since: string | null; generated_at: string; issues: unknown[]; }> { @@ -208,7 +208,7 @@ export class MinersService { FROM issues i WHERE i.author_github_id = $1 AND ( - (i.state = 'OPEN' AND i.created_at >= $2) + (i.state = 'OPEN' AND ($2::timestamptz IS NULL OR i.created_at >= $2)) OR (i.state = 'CLOSED' AND i.closed_at >= $2) ) ORDER BY i.created_at DESC