@devries-cameron20 / t3code-1 / commits / f0c1da3b5f
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(github): long period runs no longer freeze reference autolinking (#26177)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 27, 2026 at 16:24 UTC f0c1da3b5f478ca989383bba502ae5ca7a2c54d8
2 files changed +14 -1
packages/source-control-github/src/shared/referenceAutolinks.test.ts
+13
@@ -36,6 +36,19 @@ describe("gitHubReferenceAutolinks", () => {
36 );
37 });
38
39 + it("scans long runs of periods and dashes in linear time", () => {
40 + expect(linked(`${".".repeat(50_000)} ${".-".repeat(25_000)} #1`)).toEqual([
41 + ["#1", "https://github.com/team/repo/issues/1", "reference"],
42 + ]);
43 + });
44 +
45 + it("links references that follow punctuation", () => {
46 + expect(linked("(#5), owner.name/repo-x#3")).toEqual([
47 + ["#5", "https://github.com/team/repo/issues/5", "reference"],
48 + ["owner.name/repo-x#3", "https://github.com/owner.name/repo-x/issues/3", "reference"],
49 + ]);
50 + });
51 +
52 it("links against the repository's own host", () => {
53 expect(
54 gitHubReferenceAutolinks("See #5", "https://ghe.example.com/acme/web").map(({ url }) => url),
packages/source-control-github/src/shared/referenceAutolinks.ts
+1 -1
@@ -3,7 +3,7 @@ import type { ReferenceAutolink } from "@t3tools/source-control-core/shared/defi
3 // GitHub's autolinked references: `#12`, `repo#12` and `owner/repo#12`; a SHA of 7 to 40
4 // characters, optionally `repo@` or `owner/repo@` qualified; `@user` and `@org/team`.
5 const REFERENCE =
6 - /(?<![\w/\\])(?:([\w.-]+\/[\w.-]+|[\w-]+)?#([1-9]\d*)|(?:([\w.-]+\/[\w.-]+|[\w-]+)@)?([a-f\d]{7,40})(?![\w])|@([a-z\d](?:[a-z\d-]*[a-z\d])?(?:\/[a-z\d][a-z\d-]*)?))(?![\w])/giu;
6 + /(?<![\w./\\-])(?:([\w.-]+\/[\w.-]+|[\w-]+)?#([1-9]\d*)|(?:([\w.-]+\/[\w.-]+|[\w-]+)@)?([a-f\d]{7,40})(?![\w])|@([a-z\d](?:[a-z\d-]*[a-z\d])?(?:\/[a-z\d][a-z\d-]*)?))(?![\w])/giu;
7 const CANDIDATE = /[#@]|\b[a-f\d]{7,40}\b/iu;
8 const SHORT_SHA_LENGTH = 7;
9