Skip to content

gha: backport — quote title to force exact-phrase search#30424

Open
andrewhsu wants to merge 2 commits intodevfrom
andrewhsu/devprod-4205-backport-issue-exact-title-match
Open

gha: backport — quote title to force exact-phrase search#30424
andrewhsu wants to merge 2 commits intodevfrom
andrewhsu/devprod-4205-backport-issue-exact-title-match

Conversation

@andrewhsu
Copy link
Copy Markdown
Member

@andrewhsu andrewhsu commented May 8, 2026

Summary

The existing-issue check in gh_issue_url() used GitHub's relevance-ranked full-text search:

search="[$BACKPORT_BRANCH] $ORIG_TITLE in:title"

That's not an exact title match — GitHub tokenizes the title (v25.3.x, dcv, Remove, DCV, …) and matches any open issue with overlapping tokens. When an unrelated backport issue for the same target branch is open, it can be picked up as a "duplicate," and the script silently skips creating a real tracking issue.

This actually happened on PR #30410: both v26.1.x and v25.3.x cherry-picks failed (expected), but only #30412 (v26.1.x) got a tracking issue. The v25.3.x search was matched by #30404 ([v25.3.x] tests: Remove DCV DT support), which shares the tokens v25.3.x, Remove, DCV. See the DEVPROD-4205 analysis for the full root-cause walkthrough.

The fix is to wrap the title in double quotes so GitHub treats it as an exact phrase.

Verification

$ gh issue list --state all --search '[v25.3.x] dcv: Remove DCV in:title' \
    --milestone v25.3.x-next --repo redpanda-data/redpanda --json number,title
[{"number":30404,"title":"[v25.3.x] tests: Remove DCV DT support"}]   # ← false positive

$ gh issue list --state all --search '"[v25.3.x] dcv: Remove DCV" in:title' \
    --milestone v25.3.x-next --repo redpanda-data/redpanda --json number,title
[]                                                                     # ← correct after fix

$ gh issue list --state all --search '"[v26.1.x] dcv: Remove DCV" in:title' \
    --milestone v26.1.x-next --repo redpanda-data/redpanda --json number,title
[{"number":30412,"title":"[v26.1.x] dcv: Remove DCV"}]                # ← exact match still found

DEVPROD-4205

Test plan

  • Wait for next failed backport to confirm the script creates a tracking issue.

Release Notes

  • none

The existing-issue check in gh_issue_url() used GitHub's relevance-ranked
full-text search ("[$branch] $title in:title"), which tokenizes the
title and matches any open issue that shares the keywords. When an
unrelated backport issue for the same target branch was open with
overlapping tokens, the search returned that issue and the script
silently skipped creating a new tracking issue.

Wrap the title in double quotes so GitHub treats it as an exact phrase.

Fixes DEVPROD-4205.
Copilot AI review requested due to automatic review settings May 8, 2026 17:52
@andrewhsu andrewhsu requested a review from a team as a code owner May 8, 2026 17:52
@andrewhsu andrewhsu requested review from PrzemekZglinicki and removed request for a team May 8, 2026 17:52
When create_issue.sh takes the "issue already exists" branch, it only
records the matched URL in $GITHUB_ENV. Nothing reaches the run log,
which made the DEVPROD-4205 false-positive invisible — the step ran for
under a second and produced no output, so the only sign that something
went wrong was the missing tracking issue.

Echo the message to stdout so the matched URL is visible in the workflow
run log.
@andrewhsu andrewhsu enabled auto-merge May 8, 2026 17:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the GitHub Actions backport workflow’s gh_issue_url() helper to reduce false positives when checking for an existing backport tracking issue by switching the issue-title search to an exact-phrase query.

Changes:

  • Quote the backport issue title in the GitHub search query (in:title) so GitHub uses phrase matching instead of token-based matching.
  • Prevent unrelated open backport issues on the same branch from being incorrectly treated as duplicates.

shift $((OPTIND - 1))

search=${search-"[$BACKPORT_BRANCH] $ORIG_TITLE in:title"}
search=${search-"\"[$BACKPORT_BRANCH] $ORIG_TITLE\" in:title"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants