Skip to content

fix(miner): self-review-context never supplies recent-merged-PR history, contradicting its own "same fidelity" claim - #8969

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
phamngocquy:miner/issue-8852
Jul 26, 2026
Merged

fix(miner): self-review-context never supplies recent-merged-PR history, contradicting its own "same fidelity" claim#8969
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
phamngocquy:miner/issue-8852

Conversation

@phamngocquy

Copy link
Copy Markdown
Contributor

Summary

self-review-context.ts claimed "SAME fidelity" as the live gate but passed an empty recentMergedPullRequests array into buildIssueQualityReport, so issues already fixed by a recently merged PR were invisible to duplicate/collision detection in the miner's local self-review preview.

This change fetches recently merged PRs via the existing GitHub client and wires them into buildIssueQualityReport, matching the live gate behavior.

Deliverables

  • self-review-context.ts passes a real recentMergedPullRequests array (fetched via the same GitHub client this module already uses for issues/pullRequests) into buildIssueQualityReport
  • A test asserting a candidate issue matching a recently-merged PR is correctly flagged as a likely-duplicate/collision by self-review-context's output, where it previously would not have been

Test plan

  • npm run typecheck
  • npm test -- test/unit/miner-self-review-context.test.ts (45 tests)

Fixes #8852

Made with Cursor

…ry, contradicting its own "same fidelity" claim

Fixes JSONbored#8852
@phamngocquy
phamngocquy requested a review from JSONbored as a code owner July 26, 2026 14:35
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.63%. Comparing base (b723ba8) to head (b11a75e).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8969      +/-   ##
==========================================
+ Coverage   90.56%   90.63%   +0.07%     
==========================================
  Files          96       97       +1     
  Lines       22490    22690     +200     
  Branches     3884     3971      +87     
==========================================
+ Hits        20367    20566     +199     
  Misses       1945     1945              
- Partials      178      179       +1     
Flag Coverage Δ
backend 99.50% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/loopover-miner/lib/self-review-context.ts 99.50% <100.00%> (ø)

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

loopover-orb Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-26 14:49:32 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This fixes a real bug: self-review-context.ts previously passed empty arrays for recentMergedPullRequests to both buildCollisionReport and buildIssueQualityReport, so an open issue already fixed by a merged PR was invisible to the miner's local duplicate/collision detection while the live gate would have caught it. The fix adds fetchRecentMergedPullRequestRecords (closed pulls sorted by updated desc, filtered to merged_at set) and toRecentMergedPullRequestRecord mirroring the host's mapping, then wires the result into both report builders. The new regression test directly exercises the fixed path (an issue matching a recently-merged PR now flags status 'do_not_use' with a 'merged PR' warning), and a second test confirms closed-but-unmerged/malformed PR payloads are correctly filtered out.

Nits — 5 non-blocking
  • fetchRecentMergedPullRequestRecords (self-review-context.ts:~414) fetches ALL closed pulls via full pagination (maxPages up to 10 x perPage) with no bound comparable to the host's MERGED_PR_FILE_HYDRATION_BATCH_SIZE cap, which could be a heavier GitHub API cost for repos with large closed-PR history, though this mirrors the existing open-PR fetch pattern so it's consistent with current conventions.
  • toRecentMergedPullRequestRecord and fetchRecentMergedPullRequestRecords (self-review-context.ts:390,408) use `any` parameter types consistent with the rest of the file's loose typing, but this continues a pattern worth tightening file-wide at some point.
  • The renamed test at test/unit/miner-self-review-context.test.ts:234 obscures the diff's intent slightly ('...without bounty inputs') but accurately reflects the new behavior since recentMerged is no longer empty.
  • Consider capping fetchRecentMergedPullRequestRecords's page count or adding a smaller maxPages override for this call site to bound the added GitHub API cost, if repos with very large closed-PR histories become a concern.
  • Since the file is now ~554 lines, consider whether the fetch* helper functions (open issues/PRs/recent-merged) could be extracted to a shared module mirroring src/db/repositories.ts's organization, though this is optional given the file's existing structure.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8852
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: 1 registered-repo PR(s), 0 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor phamngocquy; Gittensor profile; 1 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The PR fetches recently-merged closed PRs via the GitHub client, maps them into the shape buildIssueQualityReport/buildCollisionReport expect, and wires them into both calls in place of the hardcoded empty array, with a regression test showing a candidate issue matching a merged PR now gets flagged as a duplicate/collision.

Review context
  • Author: phamngocquy
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 1 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
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.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 987f7ce into JSONbored:main Jul 26, 2026
8 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 26, 2026
7 tasks
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(miner): self-review-context never supplies recent-merged-PR history, contradicting its own "same fidelity" claim

1 participant