Skip to content

[webhooks] additional action keywords#40

Open
capcom6 wants to merge 1 commit into
masterfrom
webhooks/additional-keyword
Open

[webhooks] additional action keywords#40
capcom6 wants to merge 1 commit into
masterfrom
webhooks/additional-keyword

Conversation

@capcom6

@capcom6 capcom6 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Commit messages now recognize more keyword forms, including singular verbs like “fix,” “resolve,” “close,” and “block.”
    • Keyword-based task references also now support the phrase “on hold.”
    • This improves automatic status updates and makes keyword-driven task links more reliable.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@capcom6, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a87aac62-9b2b-4a65-8c42-39576cc87c17

📥 Commits

Reviewing files that changed from the base of the PR and between 5a81c62 and afb9ef7.

📒 Files selected for processing (1)
  • internal/webhooks/domain.go
📝 Walkthrough

Walkthrough

Extended the commit-message keyword auto-transition logic in internal/webhooks/domain.go by adding single-verb keyword forms ("fix", "resolve", "close", "block") to the keywordActions mapping and broadening the keywordRefPattern regex to also match these forms plus the "on hold" phrase.

Changes

Keyword Auto-Transition Parsing

Layer / File(s) Summary
Keyword actions and reference pattern update
internal/webhooks/domain.go
Added "fix", "resolve", "close", and "block" entries to keywordActions mapping to existing statuses/verbs, and broadened keywordRefPattern to recognize these forms and the "on hold" phrase for #<number> reference matching.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the added webhook action keywords.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
internal/webhooks/domain.go (1)

46-46: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider deriving the regex from the keywordActions map keys to avoid manual sync.

The keyword list is duplicated between keywordActions (line 21) and keywordRefPattern (line 46). If a keyword is added to one but not the other, the regex may capture a keyword with no matching action (producing a zero-value KeywordAction{Status: ""}), or the map may contain an entry that never matches. Building the alternation from sorted(map.Keys(keywordActions)) at init time eliminates this risk.

♻️ Suggested refactor: build regex from map keys
 var keywordActions = map[string]KeywordAction{
 	"fix":      {Status: tasks.StatusResolved, Verb: verbResolved},
 	"fixes":    {Status: tasks.StatusResolved, Verb: verbResolved},
 	"fixed":    {Status: tasks.StatusResolved, Verb: verbResolved},
 	"resolve":  {Status: tasks.StatusResolved, Verb: verbResolved},
 	"resolves": {Status: tasks.StatusResolved, Verb: verbResolved},
 	"resolved": {Status: tasks.StatusResolved, Verb: verbResolved},
 	"close":    {Status: tasks.StatusClosed, Verb: verbClosed},
 	"closes":   {Status: tasks.StatusClosed, Verb: verbClosed},
 	"closed":   {Status: tasks.StatusClosed, Verb: verbClosed},
 	"block":    {Status: tasks.StatusOnHold, Verb: verbOnHold},
 	"blocks":   {Status: tasks.StatusOnHold, Verb: verbOnHold},
 	"blocked":  {Status: tasks.StatusOnHold, Verb: verbOnHold},
 	"on hold":  {Status: tasks.StatusOnHold, Verb: verbOnHold},
 }

+// buildKeywordPattern constructs the keyword alternation from keywordActions keys,
+// sorting by descending length so longer alternatives (e.g. "fixes") are tried
+// before shorter prefixes (e.g. "fix").
+func buildKeywordPattern() string {
+	keys := make([]string, 0, len(keywordActions))
+	for k := range keywordActions {
+		keys = append(keys, k)
+	}
+	sort.Sort(sort.Reverse(byLen(keys)))
+	return `(?i)\b(` + strings.Join(keys, "|") + `)\s+#(\d+)\b`
+}
+
+type byLen []string
+
+func (b byLen) Len() int           { return len(b) }
+func (b byLen) Less(i, j int) bool  { return len(b[i]) < len(b[j]) }
+func (b byLen) Swap(i, j int)      { b[i], b[j] = b[j], b[i] }
+
 var (
 	// ... other vars ...
-	keywordRefPattern = regexp.MustCompile(
-		`(?i)\b(fix|fixes|fixed|resolve|resolves|resolved|close|closes|closed|block|blocks|blocked|on hold)\s+#(\d+)\b`,
-	)
+	keywordRefPattern = regexp.MustCompile(buildKeywordPattern())
 )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/webhooks/domain.go` at line 46, The keyword list for issue
references is duplicated between keywordActions and keywordRefPattern, so update
the regex construction to derive its alternation from the keywordActions map
keys instead of hardcoding the keywords. Use the existing keywordActions symbol
to build keywordRefPattern at init time from sorted keys so both stay in sync
and every matched keyword always has a corresponding KeywordAction.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/webhooks/domain.go`:
- Line 46: Add parser coverage for the new reference keywords in domain parsing
so `ParsedReference.Status` and `ParsedReference.Verb` can’t regress unnoticed.
Update the tests around the reference parsing logic in
`ParsedReference`/`ParseReference` to include `fix`, `resolve`, `close`,
`block`, and `on hold` variants, asserting both the parsed status and verb for
each form. Keep the tests aligned with the keyword regex in `domain.go` so
future changes to that pattern are caught.

---

Nitpick comments:
In `@internal/webhooks/domain.go`:
- Line 46: The keyword list for issue references is duplicated between
keywordActions and keywordRefPattern, so update the regex construction to derive
its alternation from the keywordActions map keys instead of hardcoding the
keywords. Use the existing keywordActions symbol to build keywordRefPattern at
init time from sorted keys so both stay in sync and every matched keyword always
has a corresponding KeywordAction.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 42cd6531-4e9c-4a75-aafa-34f59065bdcc

📥 Commits

Reviewing files that changed from the base of the PR and between 8d80806 and 5a81c62.

📒 Files selected for processing (1)
  • internal/webhooks/domain.go

Comment thread internal/webhooks/domain.go
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

🤖 Pull request artifacts

Platform File
🐳 Docker GitHub Container Registry
🍎 Darwin arm64 backend_Darwin_arm64.tar.gz
🍎 Darwin x86_64 backend_Darwin_x86_64.tar.gz
🐧 Linux arm64 backend_Linux_arm64.tar.gz
🐧 Linux i386 backend_Linux_i386.tar.gz
🐧 Linux x86_64 backend_Linux_x86_64.tar.gz
🪟 Windows arm64 backend_Windows_arm64.zip
🪟 Windows i386 backend_Windows_i386.zip
🪟 Windows x86_64 backend_Windows_x86_64.zip

@capcom6 capcom6 added the ready PR is ready to merge label Jul 10, 2026
@capcom6 capcom6 force-pushed the webhooks/additional-keyword branch from 5a81c62 to afb9ef7 Compare July 14, 2026 01:31
@github-actions github-actions Bot removed the ready PR is ready to merge label Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant