Skip to content

fix(db): ignore closing keywords inside inline code spans - #4039

Merged
JSONbored merged 1 commit into
mainfrom
fix/linked-issue-codespan-false-positive
Jul 7, 2026
Merged

fix(db): ignore closing keywords inside inline code spans#4039
JSONbored merged 1 commit into
mainfrom
fix/linked-issue-codespan-false-positive

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • extractLinkedIssueNumbersWithOverflow scanned raw PR body text for closing keywords (Closes #N, Fixes #N, etc.) with no regard for markdown inline code spans.
  • This repo's own PR template checklist item literally contains the example text (e.g. \Closes feat(data): add contributor reconciliation reports #123`)`, so every PR that keeps that checklist line unedited spuriously linked to issue feat(data): add contributor reconciliation reports #123 — discovered while triaging why several unrelated JSONbored PRs were flagged with an "issue overlap" review blocker.
  • Fixed by stripping inline code spans before scanning. This also brings the extraction closer to GitHub's own native closing-keyword linker, which likewise does not treat backtick-wrapped text as a real directive.

No issue: found as a side effect of auditing other PRs' review-panel blockers; a one-line regex fix with a direct regression test didn't seem worth filing separately.

Test plan

  • npm run typecheck — clean
  • npx vitest run test/unit/db-parsers.test.ts — 44/44, including a new regression test reproducing the exact template-checklist false positive

extractLinkedIssueNumbersWithOverflow scanned raw PR body text for
"Closes #N"-style keywords with no regard for markdown code spans. This
repo's own PR template checklist contains the literal example text
"(e.g. `Closes #123`)", so every PR that keeps the unmodified checklist
item spuriously linked to issue #123 -- exactly the kind of linked-issue
misdetection this review stack needs to get right. GitHub's own native
closing-keyword linker does not treat backtick-wrapped text as a real
directive either, so stripping inline code spans before scanning also
brings this closer to GitHub's actual behavior.
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent did not find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 7, 2026
@loopover-orb

loopover-orb Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-07 12:43:08 UTC

2 files · 1 AI reviewer · 2 blockers · readiness 100/100 · CI green · clean

⏸️ Suggested Action - Manual Review

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • AI reviewers agree on a likely critical defect: Per this repo's contribution policy, every external contributor PR must close or clearly link an eligible open issue, and the PR description explicitly states none was filed ('No issue... didn't seem worth filing separately') — this needs a linked issue or an explicit maintainer waiver before merge. — Resolve the flagged defect, or override if the AI reviewers are mistaken, then re-run the gate.

Review summary
This fix strips markdown inline code spans (single backtick-delimited, non-multiline) from the PR body before scanning for closing keywords in extractLinkedIssueNumbersWithOverflow, which correctly stops the repo's own PR template checklist line `(e.g. \`Closes #123\`)` from spoofing a link to issue #123. The root cause is real and verified against the actual template file content, not a fabricated scenario, and the regression test reproduces the exact false-positive plus confirms a real Closes keyword elsewhere in the same body still counts. The change is narrowly scoped, low-risk, and matches GitHub's own native closing-keyword linker behavior; the only real gap is the missing issue link required for contributor PRs under this repo's contribution policy.

Blockers

  • Per this repo's contribution policy, every external contributor PR must close or clearly link an eligible open issue, and the PR description explicitly states none was filed ('No issue... didn't seem worth filing separately') — this needs a linked issue or an explicit maintainer waiver before merge.
Nits — 4 non-blocking
  • The strip-regex `/`[^`\n]*`/g` only handles single-backtick inline spans on one line; GFM double-backtick-escaped spans (`` `` contains ` backtick `` ``) and fenced ``` code blocks (which can also contain a literal 'Closes #N' example and span multiple lines) aren't stripped, so a similar false positive could still occur inside a fenced block — worth a follow-up if that pattern shows up in practice.
  • The replacement uses a single space rather than preserving span length/position; harmless here since only match indices from the stripped string are used, but worth a one-line comment if that assumption ever changes.
  • Consider extending the regression test with a fenced-code-block case (```...Closes feat(data): add contributor reconciliation reports #123...```) to confirm current scope/limits are intentional rather than accidental.
  • Link or open a tracking issue for this fix per repo convention, even if trivial, to satisfy the issue-scope requirement.

Concerns raised — review before merging

  • Per this repo's contribution policy, every external contributor PR must close or clearly link an eligible open issue, and the PR description explicitly states none was filed ('No issue... didn't seem worth filing separately') — this needs a linked issue or an explicit maintainer waiver before merge.
  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
Signal Result Evidence
Code review ❌ 2 blockers 1 reviewer
Linked issue ✅ Linked #123
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 51 registered-repo PR(s), 43 merged, 570 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 51 PR(s), 570 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, JavaScript, Ruby, Go, Kotlin, MDX, Shell
  • Official Gittensor activity: 51 PR(s), 570 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 7, 2026
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.58%. Comparing base (bb7f8ed) to head (8a305c4).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4039   +/-   ##
=======================================
  Coverage   93.58%   93.58%           
=======================================
  Files         382      382           
  Lines       35532    35533    +1     
  Branches    13028    13028           
=======================================
+ Hits        33251    33252    +1     
  Misses       1618     1618           
  Partials      663      663           
Files with missing lines Coverage Δ
src/db/repositories.ts 96.62% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit aaa2896 into main Jul 7, 2026
10 checks passed
@JSONbored
JSONbored deleted the fix/linked-issue-codespan-false-positive branch July 7, 2026 12:48
RealDiligent added a commit to RealDiligent/gittensory that referenced this pull request Jul 7, 2026
Port inline code-span stripping and qualified owner/repo#N scoping from
repositories.ts (JSONbored#4039/JSONbored#3862) into the MCP local-branch mirror and the
predicted-gate engine so template checklist text does not spuriously link
issue JSONbored#123 and branch-analysis gate predictions match server preflight.

Co-authored-by: Cursor <cursoragent@cursor.com>
RealDiligent added a commit to RealDiligent/gittensory that referenced this pull request Jul 7, 2026
Port inline code-span stripping and qualified owner/repo#N scoping from
repositories.ts (JSONbored#4039/JSONbored#3862) into the MCP local-branch mirror and the
predicted-gate engine so template checklist text does not spuriously link
issue JSONbored#123 and branch-analysis gate predictions match server preflight.

Co-authored-by: Cursor <cursoragent@cursor.com>
RealDiligent added a commit to RealDiligent/gittensory that referenced this pull request Jul 8, 2026
Port inline code-span stripping and qualified owner/repo#N scoping from
repositories.ts (JSONbored#4039/JSONbored#3862) into the MCP local-branch mirror and the
predicted-gate engine so template checklist text does not spuriously link
issue JSONbored#123 and branch-analysis gate predictions match server preflight.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant