fix: improve issue ID prefix extraction for word-like suffixes

Refine ExtractIssuePrefix to better distinguish hash IDs from English
words in multi-part issue IDs. Hash suffixes now require digits or be
exactly 3 chars, preventing "test", "gate", "part" from being treated
as hashes. This fixes prefix extraction for IDs like "vc-baseline-test".

Also updates git hooks to use -q flag and adds AGENTS.md documentation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-16 13:18:30 -08:00
parent c95bc6c21d
commit aed166fe85
9 changed files with 85 additions and 40 deletions

View File

@@ -43,18 +43,20 @@ func TestExtractIssuePrefixAllLetterHash(t *testing.T) {
}
}
// TestExtractIssuePrefixWordSuffix tests alphanumeric suffixes (GH#405 fix)
// With the GH#405 fix, all alphanumeric suffixes use last-hyphen extraction,
// even if they look like English words. This fixes multi-hyphen prefix parsing.
// TestExtractIssuePrefixWordSuffix tests word-like suffixes (bd-fasa regression)
// Word-like suffixes (4+ chars, no digits) use first-hyphen extraction because
// they're likely multi-part IDs where everything after first hyphen is the ID.
// This fixes bd-fasa regression where word-like suffixes were wrongly treated as hashes.
func TestExtractIssuePrefixWordSuffix(t *testing.T) {
// These should use last-hyphen extraction (alphanumeric = valid issue ID suffix)
// Word-like suffixes (4+ chars, no digits) should use first-hyphen extraction
// The entire part after first hyphen is the ID, not just the last segment
wordSuffixes := []struct {
issueID string
expected string
}{
{"vc-baseline-test", "vc-baseline"}, // GH#405: alphanumeric suffix uses last hyphen
{"vc-baseline-hello", "vc-baseline"}, // GH#405: alphanumeric suffix uses last hyphen
{"vc-some-feature", "vc-some"}, // GH#405: alphanumeric suffix uses last hyphen
{"vc-baseline-test", "vc"}, // bd-fasa: "baseline-test" is the ID, not "test"
{"vc-baseline-hello", "vc"}, // bd-fasa: "baseline-hello" is the ID
{"vc-some-feature", "vc"}, // bd-fasa: "some-feature" is the ID
}
for _, tc := range wordSuffixes {