diff --git a/packages/das/src/api/miners/miners.service.ts b/packages/das/src/api/miners/miners.service.ts index 180953f..801d01b 100644 --- a/packages/das/src/api/miners/miners.service.ts +++ b/packages/das/src/api/miners/miners.service.ts @@ -202,6 +202,7 @@ export class MinersService { AND sp.pr_number = i.solved_by_pr -- Skip null-author solving PRs (no one to credit) AND sp.author_github_id IS NOT NULL + AND BTRIM(sp.author_github_id) <> '' -- Skip corrupted MERGED-without-merged_at shape AND NOT (sp.state = 'MERGED' AND sp.merged_at IS NULL) ) AS solving_pr diff --git a/packages/das/src/webhook/github-fetcher.service.ts b/packages/das/src/webhook/github-fetcher.service.ts index 88ad900..2ea4cda 100644 --- a/packages/das/src/webhook/github-fetcher.service.ts +++ b/packages/das/src/webhook/github-fetcher.service.ts @@ -784,7 +784,10 @@ export class GitHubFetcherService implements OnModuleInit { { repoFullName, prNumber: pr.number, - authorGithubId: String(pr.author?.databaseId ?? ""), + authorGithubId: + pr.author?.databaseId != null + ? String(pr.author.databaseId) + : null, authorLogin: pr.author?.login ?? null, authorAssociation: pr.authorAssociation ?? null, title: pr.title, diff --git a/packages/db/26_normalize_blank_pr_author_ids.sql b/packages/db/26_normalize_blank_pr_author_ids.sql new file mode 100644 index 0000000..3be1cd0 --- /dev/null +++ b/packages/db/26_normalize_blank_pr_author_ids.sql @@ -0,0 +1,7 @@ +-- Normalize legacy bad rows where unknown PR author IDs were stored as blanks. +-- Unknown author identity must be NULL so solver-credit filters can exclude it. + +UPDATE pull_requests +SET author_github_id = NULL +WHERE author_github_id IS NOT NULL + AND BTRIM(author_github_id) = '';