fix: add word boundary to LINK_REGEX to prevent false positive issue …#138
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughLINK_REGEX is updated to require a word boundary before closing keywords, and a one-time guarded DB migration recomputes links with both the old and new regexes to delete pr_issue_links rows that were false positives under the previous (boundaryless) pattern. ChangesIssue Link Detection Fix
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/lib/db.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. Comment |
|
The regex change fixes new parsing, but it does not repair already-persisted false-positive
Please add a safe cleanup/migration path for existing stale body-regex links, or otherwise explain why existing contaminated DBs are out of scope. Until then, |
The word-boundary regex fix only stops NEW bad links; existing rows created by the old boundaryless pattern (e.g. "bugfix MkDev11#42", "discloses MkDev11#42") persist because pr_issue_links is append-only and the per-repo backfill is gated on the table being empty. Add a one-shot data migration in getDb(), guarded by PRAGMA user_version so it runs exactly once per database file. For every cached PR it recomputes same-repo links under both the old (boundaryless) and new (fixed) patterns and deletes only the difference. GraphQL/sidebar links are untouched: a PR with no closing keyword yields an empty old-match set and is skipped entirely, and any link still produced by the fixed regex is retained.
|
I just added a one-time migration that re-scans cached PRs and removes the bad links the old regex created. |
|
Thank you, @MkDev11 ! |
Summary
Adds a
\bword boundary assertion before the closing-keyword group inLINK_REGEX(src/lib/pr-linking.ts) to prevent substrings likebugfix,hotfix, anddisclosesfrom triggering false-positive issue links that persist indefinitely in thepr_issue_linkstable.Related Issues
Closes #137
Type of Change
Testing
pnpm buildpassesChecklist
Summary by CodeRabbit