find_referenced_groups: Fixes-keyword ID list spans newlines, linking wrong issues as fixed

Open Beginner friendly
#125,575 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@CodeAlex52 is already working on this.

Since Sep 30, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Start in src/sentry/utils/groupreference.py with _fixes_re, then trace Commit.find_referenced_groups() and PullRequest.find_referenced_groups() to understand how extracted IDs become resolved references. Add coverage for a fixes keyword followed by a newline and verify that same-line lists such as “Fixes A-1, B-2” still work, with no narrative IDs treated as fixed.

Written by the indexing model from the issue text.

Description

Product Area: Releases Waiting for: Product Owner

_fixes_re in src/sentry/utils/groupreference.py:

_fixes_re = re.compile(
    rf"\b{_fix_keywords}:?\s+([A-Za-z0-9_\-\s\,]+)\b",
    re.I,
)

The \s inside the ID-list character class also matches newlines, so the match swallows every line after the keyword, and _short_id_re then pulls short-ID-shaped tokens out of narrative prose. For example:

Fixes SENTRY-1
Backported from OTHER-456 for the release branch

The IDs treated as fixed come out as ['SENTRY-1', 'OTHER-456'], when only SENTRY-1 was meant.

This matters because Commit.find_referenced_groups() and PullRequest.find_referenced_groups() feed the resolved_in_commit / resolved_in_pull_request receivers, which create GroupLink(relationship=resolves) records. A phantom ID that happens to resolve to a real group in the org can then get auto-resolved by a release containing that commit. The \s was clearly intended for same-line separators like Fixes A-1, B-2, not newlines.

(find_fix_statements, used by the Seer RPC path, works per-line and is not affected.)

Observed on master at bb47162e (2026-09-25).

Dominant language
Python
Stars
45.7k
Forks
5k
Avg merge
1d 1h
Merged PRs (30d)
642

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from getsentry/sentry

All issues in getsentry/sentry

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.