Skip to content

fix(predicted-gate): limit the duplicate check to open siblings#1522

Open
Dexterity104 wants to merge 2 commits into
JSONbored:mainfrom
Dexterity104:fix/predicted-gate-open-siblings
Open

fix(predicted-gate): limit the duplicate check to open siblings#1522
Dexterity104 wants to merge 2 commits into
JSONbored:mainfrom
Dexterity104:fix/predicted-gate-open-siblings

Conversation

@Dexterity104

Copy link
Copy Markdown
Contributor

Summary

The pre-submission gate predictor passed the full pull request snapshot into the duplicate detector. That snapshot comes from listPullRequests, which has no state filter, so closed and merged pull requests that shared a linked issue were treated as live competitors and raised duplicate_pr_risk. That finding blocks by default, so a contributor saw a predicted failure for a pull request the real gate would pass.

Every other gate path already compares against open siblings only: the live gate through listOtherOpenPullRequests, and the maintainer activation preview through an explicit state === "open" filter. The predictor now filters the snapshot to open siblings before building the advisory, which restores that parity and keeps the busy queue count honest. authorHistory still reads the full snapshot, because the first contribution grace counts depend on merged and closed rows.

A regression test places a merged sibling and a closed sibling that both share the linked issue, then asserts that no duplicate_pr_risk blocker appears in the predicted verdict.

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.
  • No issue is linked; the change is a small, self contained parity fix and the summary explains the rationale.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch needs at least 97% of the changed lines and branches, and the changed lines here measure 100%.
  • 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
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • The change touches only src/rules/predicted-gate.ts and its unit test. No workflow, Cloudflare Worker, MCP package, or UI surface is affected, so actionlint, test:workers, build:mcp, test:mcp-pack, the ui:* suite, and npm audit are left for the full npm run test:ci run before push.

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.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

Not applicable. This change has no visible UI, frontend, docs, or extension surface.

Notes

  • The live gate already compares against open siblings, so this corrects only the pre-submission predictor and leaves live merge and close behavior unchanged.

@Dexterity104 Dexterity104 requested a review from JSONbored as a code owner June 26, 2026 12:58
@superagent-security

Copy link
Copy Markdown

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

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 26, 2026
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.37%. Comparing base (b5d575e) to head (b555369).
⚠️ Report is 6 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1522   +/-   ##
=======================================
  Coverage   95.37%   95.37%           
=======================================
  Files         199      199           
  Lines       21546    21547    +1     
  Branches     7791     7791           
=======================================
+ Hits        20550    20551    +1     
  Misses        416      416           
  Partials      580      580           
Files with missing lines Coverage Δ
src/rules/predicted-gate.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored JSONbored added the gittensor:bug Gittensor-scored bug fix - worth 0.5x multiplier. label Jun 26, 2026
@gittensory-orb

gittensory-orb Bot commented Jun 27, 2026

Copy link
Copy Markdown

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 Gittensory review — blocked

2 files · 1 AI reviewers · no blockers · readiness 66/100 · CI failing · blocked

🛑 Blocked

Review summary
The fix filters `pullRequests` to `state === 'open'` before passing to `buildPullRequestAdvisory`, restoring parity with the live gate (`listOtherOpenPullRequests`) and the maintainer preview path. The `authorHistory` slice intentionally retains the full snapshot for first-contribution grace counts, and the inline comment documents that asymmetry precisely. The regression test exercises both the merged-sibling and closed-sibling cases in a single call and asserts both the absence of `duplicate_pr_risk` and the `success` conclusion — sufficient coverage for the parity gap being closed.

CI checks failing

  • validate
  • lint
Signal Result Evidence
Code review ✅ No blockers 1 reviewers, synthesized
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Review load ✅ 20/20 Readiness component derived from cached public PR metadata and labels; size label size:XS.
Validation evidence ❌ 5/25 Cached preflight status is hold.
Open PR queue ❌ 3/10 21 open PR(s), 9 likely reviewable, 12 unlinked.
Contributor context ✅ Confirmed Gittensor contributor Dexterity104; Gittensor profile; 94 PR(s), 11 issue(s).
Gate result ✅ Passing No configured blocker found.
Nits — 2 non-blocking
  • In `predicted-gate.ts`, the local variable `openPullRequests` is generic; `openSiblings` would better mirror both the PR description's framing and the `otherOpenPullRequests` parameter name it immediately feeds, making the intent self-evident to a future reader without needing the comment.
  • The filter `(otherPr) => otherPr.state === 'open'` is correct for the current `PullRequestRecord` state union, but as the type evolves (e.g. a future `'draft'` state that should also be excluded) a reader must remember to update this filter. If the codebase has or gains a shared `isOpenState()` predicate or equivalent type guard, using it here would make exhaustiveness verifiable at a glance.
Review context
  • Author: Dexterity104
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: TypeScript, Python, Rust, C++, Clojure, Go, HTML, JavaScript
  • Official Gittensor activity: 94 PR(s), 11 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Explain no-issue PR.
  • Fix blocker.
  • Expect slower review.
  • Refresh registry data or choose a registered active repo.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Review load = cached public PR metadata such as size labels, changed paths, and preflight status.
  • Open PR queue = repo-wide review pressure; it is not a PR quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
Review details

Generated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative.

The fix filters `pullRequests` to `state === 'open'` before passing to `buildPullRequestAdvisory`, restoring parity with the live gate (`listOtherOpenPullRequests`) and the maintainer preview path. The `authorHistory` slice intentionally retains the full snapshot for first-contribution grace counts, and the inline comment documents that asymmetry precisely. The regression test exercises both the merged-sibling and closed-sibling cases in a single call and asserts both the absence of `duplicate_pr_risk` and the `success` conclusion — sufficient coverage for the parity gap being closed.

Nits (2)

  • In `predicted-gate.ts`, the local variable `openPullRequests` is generic; `openSiblings` would better mirror both the PR description's framing and the `otherOpenPullRequests` parameter name it immediately feeds, making the intent self-evident to a future reader without needing the comment.
  • The filter `(otherPr) => otherPr.state === 'open'` is correct for the current `PullRequestRecord` state union, but as the type evolves (e.g. a future `'draft'` state that should also be excluded) a reader must remember to update this filter. If the codebase has or gains a shared `isOpenState()` predicate or equivalent type guard, using it here would make exhaustiveness verifiable at a glance.

🟩 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

@gittensory-orb gittensory-orb Bot added the gittensor Gittensor contributor context label Jun 27, 2026
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 - worth 0.5x multiplier. gittensor Gittensor contributor context size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants