From 07c47826985ffb1b9511e8a3c1d5f999d8191228 Mon Sep 17 00:00:00 2001 From: "detail-app[bot]" <180357370+detail-app[bot]@users.noreply.github.com> Date: Fri, 25 Sep 2026 08:17:46 +0000 Subject: [PATCH 1/2] fix(github): accept PR-tab URLs (e.g. /files, /commits) in PR URL parser --- .../migration.sql | 6 ++++++ src/github/index.test.ts | 15 +++++++++++++++ src/github/index.ts | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 prisma/migrations/20260925120000_reset_blacklisted_pr_tab_urls/migration.sql diff --git a/prisma/migrations/20260925120000_reset_blacklisted_pr_tab_urls/migration.sql b/prisma/migrations/20260925120000_reset_blacklisted_pr_tab_urls/migration.sql new file mode 100644 index 0000000..5d5f0f5 --- /dev/null +++ b/prisma/migrations/20260925120000_reset_blacklisted_pr_tab_urls/migration.sql @@ -0,0 +1,6 @@ +UPDATE "Project" +SET "prDescriptionFetchedAt" = NULL, + "prShortDescription" = NULL +WHERE "prDescriptionFetchedAt" IS NOT NULL + AND "prShortDescription" IS NULL + AND "prUrl" ~ 'github\.com/[^/]+/[^/]+/pull/[0-9]+/'; diff --git a/src/github/index.test.ts b/src/github/index.test.ts index 59a8189..2c59611 100644 --- a/src/github/index.test.ts +++ b/src/github/index.test.ts @@ -57,11 +57,26 @@ function assertEqual(actual: T, expected: T, message: string): void { { owner: 'codeday', repo: 'labs-gql', number: 42 }, 'parses owner/repo/number from a pull request URL', ); + assertEqual( + parseGithubPullRequestUrl('https://github.com/codeday/labs-gql/pull/42/files'), + { owner: 'codeday', repo: 'labs-gql', number: 42 }, + 'parses a PR URL with a trailing tab segment (e.g. /files)', + ); + assertEqual( + parseGithubPullRequestUrl('https://github.com/codeday/labs-gql/pull/42/files/diff/abc123'), + { owner: 'codeday', repo: 'labs-gql', number: 42 }, + 'parses a PR URL with multiple trailing path segments (deep link)', + ); assertEqual( parseGithubPullRequestUrl('https://github.com/codeday/labs-gql/issues/42'), null, 'rejects an issue URL', ); + assertEqual( + parseGithubPullRequestUrl('https://github.com/codeday/labs-gql/issues/42/files'), + null, + 'rejects an issue URL with a trailing segment', + ); assertEqual( parseGithubPullRequestUrl('https://github.com/codeday/labs-gql'), null, diff --git a/src/github/index.ts b/src/github/index.ts index bf64e0e..2e21915 100644 --- a/src/github/index.ts +++ b/src/github/index.ts @@ -1,7 +1,7 @@ import fetch from 'node-fetch'; import config from '../config'; -const GITHUB_URL_RE = /^https?:\/\/(?:www\.)?github\.com\/([^/\s]+)\/([^/\s#?]+?)(?:\.git)?(?:\/(issues|pull)\/(\d+))?\/?(?:[?#].*)?$/i; +const GITHUB_URL_RE = /^https?:\/\/(?:www\.)?github\.com\/([^/\s]+)\/([^/\s#?]+?)(?:\.git)?(?:\/(issues|pull)\/(\d+)(?:\/[^/?#]+)*?)?\/?(?:[?#].*)?$/i; export interface GithubRepoRef { owner: string; From 6973637ad7fb1a175ec60e29e61901eb2d6c83f8 Mon Sep 17 00:00:00 2001 From: "detail-app[bot]" <180357370+detail-app[bot]@users.noreply.github.com> Date: Fri, 25 Sep 2026 08:23:41 +0000 Subject: [PATCH 2/2] fix(migration): scope PR-tab URL reset to github.com hosts with a tab segment Anchor the migration's prUrl match to github.com and require at least one path segment after the PR number, so plain pull// URLs (already parsed by the prior regex) and non-github hosts are not reset unnecessarily. --- .../20260925120000_reset_blacklisted_pr_tab_urls/migration.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prisma/migrations/20260925120000_reset_blacklisted_pr_tab_urls/migration.sql b/prisma/migrations/20260925120000_reset_blacklisted_pr_tab_urls/migration.sql index 5d5f0f5..076685f 100644 --- a/prisma/migrations/20260925120000_reset_blacklisted_pr_tab_urls/migration.sql +++ b/prisma/migrations/20260925120000_reset_blacklisted_pr_tab_urls/migration.sql @@ -3,4 +3,4 @@ SET "prDescriptionFetchedAt" = NULL, "prShortDescription" = NULL WHERE "prDescriptionFetchedAt" IS NOT NULL AND "prShortDescription" IS NULL - AND "prUrl" ~ 'github\.com/[^/]+/[^/]+/pull/[0-9]+/'; + AND "prUrl" ~ '^https?://(www\.)?github\.com/[^/]+/[^/]+/pull/[0-9]+/[^/?#]';