Skip to content

fix(signals): recognize the qualified owner/repo#N closing-issue syntax - #3880

Merged
JSONbored merged 2 commits into
mainfrom
fix-linked-issue-qualified-syntax
Jul 7, 2026
Merged

fix(signals): recognize the qualified owner/repo#N closing-issue syntax#3880
JSONbored merged 2 commits into
mainfrom
fix-linked-issue-qualified-syntax

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • Fixes Linked-issue detector doesn't recognize the valid owner/repo#N closing-keyword syntax #3862.
  • The linked-issue detector that populates the stored pr.linkedIssues field (what the actual gate-close disposition reads — addPullRequestFindings in src/rules/advisory.ts) only matched GitHub's bare Closes #123 closing-keyword form, not the equally valid, fully-qualified Closes owner/repo#123 form. A PR whose only closing reference used the qualified form was scored "missing linked issue" and closed under the linked-issue-required policy, even though it correctly referenced a real, open issue — reproduced live on JSONbored/metagraphed#3797 and #3802.
  • A separate, already-correct implementation of the same qualified-form matching existed in src/signals/engine.ts (added for fix(mcp): word-boundary linked-issue closing keywords #1988), but was only used for pre-open preflight planning, not the post-open gate-evaluation path that actually decides to close a PR — the two implementations had drifted apart, which is exactly why the bug persisted despite fix(mcp): word-boundary linked-issue closing keywords #1988 having "already fixed" the qualified form once.
  • Consolidated to one implementation: src/db/repositories.ts now owns the canonical extractLinkedIssueNumbers/extractLinkedIssueNumbersWithOverflow, extended to accept a repoFullName and match owner/repo#N only when owner/repo case-insensitively equals the PR's own repo (a reference to a different repo closes an issue there, not here, and must not spoof a same-repo link). engine.ts's local duplicate is removed in favor of importing the canonical version — its 2 call sites needed no argument changes since the parameter order already matched.
  • All 7 call sites across 5 files updated to pass repoFullName (the compiler caught 2 I initially missed via tsc --noEmit, confirming there was no way to miss one silently).

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked an issue, or this is small enough that the summary explains why an issue is not needed.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage — verified via lcov: both branches (bare-form vs qualified-form vs cross-repo-qualified-form) of the new conditional show non-zero hit counts.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate (0 vulnerabilities)
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries — added a same-repo/cross-repo/mixed-form unit test plus an end-to-end regression test via upsertPullRequestFromGitHub reproducing the exact reported scenario (qualified-form-only body correctly populates linkedIssues).
  • Full npm run test:ci gate run locally end-to-end (green)

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests. — N/A.
  • API/OpenAPI/MCP behavior is updated and tested where needed. — no API/OpenAPI/MCP surface touched.
  • UI changes use live API data or real empty/error/loading states. — N/A, no UI changes.
  • Visible UI changes include a UI Evidence section. — N/A, no UI changes.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't 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

Important

🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪

🔍 Gittensory is reviewing…

AI analysis is in progress. This comment will update when the review is complete.

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

@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.57%. Comparing base (669b492) to head (16a3461).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3880   +/-   ##
=======================================
  Coverage   93.57%   93.57%           
=======================================
  Files         340      340           
  Lines       33518    33516    -2     
  Branches    12262    12262           
=======================================
- Hits        31365    31364    -1     
  Misses       1528     1528           
+ Partials      625      624    -1     
Files with missing lines Coverage Δ
src/db/repositories.ts 96.61% <100.00%> (+<0.01%) ⬆️
src/github/backfill.ts 96.89% <100.00%> (+0.08%) ⬆️
src/queue/processors.ts 94.53% <ø> (ø)
src/review/enrichment-wire.ts 99.31% <100.00%> (ø)
src/review/linked-issue-hard-rules.ts 98.11% <100.00%> (ø)
src/signals/engine.ts 97.46% <ø> (-0.01%) ⬇️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 7, 2026
JSONbored added 2 commits July 6, 2026 19:50
The linked-issue detector that populates the stored pr.linkedIssues
field (what the actual gate-close disposition reads) only matched
GitHub's bare `Closes #123` closing-keyword form, not the equally
valid, fully-qualified `Closes owner/repo#123` form. A PR whose only
closing reference used the qualified form was scored "missing linked
issue" and closed under the linked-issue-required policy, even though
it correctly referenced a real, open issue.

A separate, already-correct implementation of the same qualified-form
matching existed in signals/engine.ts (added for #1988), but was only
used for pre-open preflight planning, not the post-open gate-evaluation
path that actually decides to close a PR -- the two implementations had
drifted apart. Consolidated to one: db/repositories.ts now owns the
canonical extractLinkedIssueNumbers/extractLinkedIssueNumbersWithOverflow,
extended to accept a repoFullName and match owner/repo#N only when
owner/repo case-insensitively equals the PR's own repo (a reference to
a different repo closes an issue there, not here). engine.ts's local
duplicate is removed in favor of importing the canonical version.
@JSONbored
JSONbored force-pushed the fix-linked-issue-qualified-syntax branch from dec10db to 16a3461 Compare July 7, 2026 02:51
@JSONbored
JSONbored merged commit ac8414c into main Jul 7, 2026
10 checks passed
@JSONbored
JSONbored deleted the fix-linked-issue-qualified-syntax branch July 7, 2026 03:00
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.

Linked-issue detector doesn't recognize the valid owner/repo#N closing-keyword syntax

1 participant