Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(github): support single-character issue prefixes (#7385)

Rogee18a85b8c7ffe
diff --git a/server/internal/handler/github.go b/server/internal/handler/github.go
index f2a100c2a5..b7b94b4c32 100644
--- a/server/internal/handler/github.go
+++ b/server/internal/handler/github.go
@@ -1033,7 +1033,7 @@ func (h *Handler) broadcastPRSnapshotApplied(ctx context.Context, prID pgtype.UU
// uppercase. Word boundary on the left prevents matching inside email-style
// strings (e.g. "abc@MUL-1") and the digit anchor on the right rules out
// version numbers like "v1.2-3".
-var identifierRe = regexp.MustCompile(`(?i)\b([a-z][a-z0-9]{1,9})-(\d+)\b`)
+var identifierRe = regexp.MustCompile(`(?i)\b([a-z][a-z0-9]{0,9})-(\d+)\b`)
// closingIdentifierRe extracts identifiers that appear immediately after a
// GitHub-style closing keyword ("close[sd]?", "fix(e[sd])?", "resolve[sd]?"),
@@ -1045,7 +1045,7 @@ var identifierRe = regexp.MustCompile(`(?i)\b([a-z][a-z0-9]{1,9})-(\d+)\b`)
// title prefixes like "MUL-1: ..." link the PR (via identifierRe) but
// never auto-close.
var closingIdentifierRe = regexp.MustCompile(
- `(?i)\b(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)[:\s]+([a-z][a-z0-9]{1,9})-(\d+)\b`,
+ `(?i)\b(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)[:\s]+([a-z][a-z0-9]{0,9})-(\d+)\b`,
)
// HandleGitHubWebhook (POST /api/webhooks/github) is GitHub's destination for
diff --git a/server/internal/handler/github_test.go b/server/internal/handler/github_test.go
index 52a685e21e..d04026024f 100644
--- a/server/internal/handler/github_test.go
+++ b/server/internal/handler/github_test.go
@@ -41,6 +41,11 @@ func TestExtractIdentifiers(t *testing.T) {
in: []string{"", "", "mul-1510/fix-login"},
want: []string{"MUL-1510"},
},
+ {
+ name: "single_character_prefix",
+ in: []string{"H-412: fix widget parity"},
+ want: []string{"H-412"},
+ },
{
name: "title_and_body",
in: []string{"Fix MUL-82", "Closes MUL-1510 and ABC-7", ""},
@@ -89,6 +94,11 @@ func TestExtractClosingIdentifiers(t *testing.T) {
in: []string{"", "Closes MUL-1"},
want: []string{"MUL-1"},
},
+ {
+ name: "single_character_prefix",
+ in: []string{"", "Closes H-412"},
+ want: []string{"H-412"},
+ },
{
name: "all_keyword_inflections",
in: []string{