Repository navigation
Link the issues a pull request names in its description - #184
Conversation
Identifiers were only read from the branch name and the title, so a pull request whose description says "Fixes NOV-172" linked nothing. That is where people put it, and it is what GitHub's own closing keywords key off, so the common case was the one that did not work. Evidence from production: 568 pull_request deliveries processed, and zero git links, across four watched repositories whose branches are named after the change rather than the issue. The webhook payload's body was not even parsed. It is now, capped at 64k, null coalesced to empty, and fed to the same extractor alongside the branch and title.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughGitHub pull request normalization now preserves nullable bodies as strings. Issue identifier extraction scans the body in addition to the branch and title. Tests cover identifiers found only in descriptions and descriptions without identifiers. ChangesGitHub body issue linking
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Reading the whole body for bare identifiers was too blunt. A pull request template carrying "Fixes ENG-3" as its example, a code block demonstrating a branch name, or a quoted reply would each have linked a stranger's issue, moved it to In Progress, and notified everybody watching it. The branch and the title keep matching a bare identifier, because both are short and deliberate. The description now needs a linking keyword, the set GitHub already trains people on plus a few Linear uses, and is read with fenced blocks, inline code, html comments and quoted lines stripped first. Eight unit tests on the extractor and two on the event path, covering each shape that would previously have produced a false link.
| export function withoutNonProse(text: string): string { | ||
| return text | ||
| .replace(/```[\s\S]*?```/g, ' ') | ||
| .replace(/~~~[\s\S]*?~~~/g, ' ') | ||
| .replace(/`[^`\n]*`/g, ' ') | ||
| .replace(/<!--[\s\S]*?-->/g, ' ') | ||
| .split('\n') | ||
| .filter((line) => !/^\s*>/.test(line)) | ||
| .join('\n'); | ||
| } |
There was a problem hiding this comment.
Indented code declarations still link
When a pull request description contains an indented Markdown code block such as Fixes ENG-3, withoutNonProse leaves the declaration intact, so declaredIssueIdentifiers links the pull request to that issue and can transition the unrelated issue's workflow state.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/shared/src/utils/index.ts
Line: 171-180
Comment:
**Indented code declarations still link**
When a pull request description contains an indented Markdown code block such as ` Fixes ENG-3`, `withoutNonProse` leaves the declaration intact, so `declaredIssueIdentifiers` links the pull request to that issue and can transition the unrelated issue's workflow state.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
The gap, measured
The GitHub integration is wired end to end and working. Production has 2 installations, 26 repositories discovered, 5 linked to projects, 4 watched, and the webhook has processed 568
pull_requestdeliveries, 1090check_suite, and 4475check_run.It has produced zero issue links.
The reason is narrow.
applyGithubEventreads issue identifiers from exactly two places:The branch name and the title. Not the description. And the webhook payload's
bodywas never parsed off the wire at all, so it could not have been read even by accident.That means "Fixes NOV-172" written in a pull request description links nothing, which is both where people actually put it and what GitHub's own closing keywords key off. The four watched repositories name branches after the change rather than the issue, so nothing has ever matched.
The change
bodyis parsed (capped at 64k, null coalesced to empty), carried onNormalizedPullRequest, and fed to the same extractor alongside the branch and title. No new permission is needed: the body arrives in the webhook payload that is already being delivered.Tests
Two in
apply.test.ts, both watched failing first:bodyfrom the extractor input fails exactly this one.Full services suite: 503 pass, 0 fail. Typecheck and every
verifyguard clean.Greptile Summary
The PR parses pull request descriptions and limits issue linking to keyword-based declarations outside several non-prose Markdown constructs. The current cleanup remains incomplete for indented Markdown code blocks.
Confidence Score: 4/5
The PR is not yet safe to merge because declarations inside indented Markdown code blocks can still link and transition unrelated issues.
The attempted context-sensitive extraction leaves a standard Markdown code-block form unfiltered, so the previously reported incorrect-linking behavior remains reachable.
Files Needing Attention: packages/shared/src/utils/index.ts, packages/services/src/github/apply.ts
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR A[GitHub webhook] --> B[Normalize pull request body] B --> C[Remove recognized non-prose Markdown] C --> D[Extract keyword-based issue declarations] D --> E[Load matching issues] E --> F[Create PR links and transition issue state] G[Indented code block] -->|Not removed| DPrompt To Fix All With AI
Reviews (2): Last reviewed commit: "fix(github): only link issues a descript..." | Re-trigger Greptile