Skip to content

test(scoring): cover pending-pr-scenarios' sameLogin/sameRepoFullName match branches#8505

Closed
shin-core wants to merge 1 commit into
JSONbored:mainfrom
shin-core:test/pending-pr-scenarios-samelogin-samerepo-8329
Closed

test(scoring): cover pending-pr-scenarios' sameLogin/sameRepoFullName match branches#8505
shin-core wants to merge 1 commit into
JSONbored:mainfrom
shin-core:test/pending-pr-scenarios-samelogin-samerepo-8329

Conversation

@shin-core

Copy link
Copy Markdown
Contributor

What & why

Closes #8329.

loadContributorRepoOpenPrSignalRecords (src/scoring/pending-pr-scenarios.ts) filters a repo's open PRs by sameLogin — which short-circuits a null/undefined authorLogin via Boolean(value && value.toLowerCase() === login.toLowerCase()) — and sameRepoFullName (case-insensitive). Neither branch had direct coverage, and the repo's patch gate counts branches.

What's added (test-only — no source change)

Two tests extending the existing loader test in test/unit/pending-pr-scenarios.test.ts:

  • null/undefined author excluded: PRs with authorLogin: null and authorLogin: undefined are dropped by sameLogin's short-circuit (not matched, not thrown on) — asserted by mocking the per-PR review fetch and confirming only the target login's own PR (feat(mcp): add local workspace intelligence v2 #70) is loaded (listPullRequestReviews called exactly once, for feat(mcp): add local workspace intelligence v2 #70).
  • case-insensitive repo match: a PullRequestRecord whose repoFullName is "Entrius/Allways-UI" still matches the query "entrius/allways-ui"sameRepoFullName lowercases both.

loadContributorRepoOpenPrSignalRecords's logic is untouched — this is coverage for existing, correct code.

Validation

  • test/unit/pending-pr-scenarios.test.ts: 19 tests pass (17 existing + 2 new); typecheck clean; git diff --check clean.
  • Coverage-catch verified: making sameRepoFullName case-sensitive fails the case test, proving it exercises that branch.
  • Branched off current main, mergeable-clean.

…epo match branches

loadContributorRepoOpenPrSignalRecords filters open PRs by sameLogin (which
short-circuits a null/undefined authorLogin via Boolean(value && ...)) and
sameRepoFullName (case-insensitive), but neither branch was directly covered.
Add two tests extending the existing loader test: (1) PRs with authorLogin null
and undefined are excluded (not matched or thrown on), asserting only the target
login's PR is loaded; (2) a repoFullName differing from the query only in letter
case still matches. No source change -- coverage for existing, correct logic.
@shin-core
shin-core requested a review from JSONbored as a code owner July 24, 2026 15:58
@superagent-security superagent-security Bot added the contributor:flagged Contributor flagged for review by trust analysis. label Jul 24, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

🚨 Contributor flagged. Click here for more info: Superagent Dashboard

@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 24, 2026
@loopover-orb

loopover-orb Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-24 16:43:48 UTC

1 file · 1 AI reviewer · no blockers · CI failing · blocked

🛑 Suggested Action - Fix Blockers

Review summary
This is a pure test-addition PR closing #8329, adding two unit tests to cover the previously-untested null/undefined authorLogin short-circuit and case-insensitive repoFullName match branches in loadContributorRepoOpenPrSignalRecords. The tests correctly exercise real, reachable branches (not fabricated states) by mocking listPullRequestReviews and asserting exact call counts/arguments, which genuinely proves the sameLogin short-circuit and sameRepoFullName lowercasing behave as claimed. No source changes are made, and the diff is fully consistent with its stated intent.

Nits — 4 non-blocking
  • The inline comments restate what the assertions already show (e.g. test/unit/pending-pr-scenarios.test.ts:466-468) — could be trimmed since the test names and expects are already self-explanatory.
  • Both new tests mock listCheckSummaries but never assert on it or on pullRequestChecks length, so that mock's necessity isn't verified beyond preventing an unmocked-call failure.
  • Consider asserting `records.pullRequestChecks` length in the new tests too, mirroring the existing 'loads cached reviews and checks' test just above, for symmetry.
  • Since CI shows validate/validate-tests-merge failing with no detail and the branch is 5 commits behind main, rebase onto latest main before re-checking those failures — they're plausibly unrelated to this diff.

CI checks failing

  • validate
  • validate-tests-merge
Flagged checks (non-blocking)
  • Contributor trust — Contributor flagged for review

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 #8329
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: 63 registered-repo PR(s), 30 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor shin-core; Gittensor profile; 63 PR(s), 0 issue(s).
Improvement ℹ️ Insufficient signal risk: clean · value: insufficient-signal · LLM: minor
Linked issue satisfaction

Partially addressed
The PR adds solid tests for the null/undefined authorLogin short-circuit and for case-insensitive repoFullName matching, but the issue explicitly also requires a test case where an authorLogin differs from the query login only in case (to prove sameLogin's case-insensitive branch), which this diff does not add.

Review context
  • Author: shin-core
  • 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: 63 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 <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> 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 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-tests-merge)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor:flagged Contributor flagged for review by trust analysis. gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add test coverage for pending-pr-scenarios.ts's null-login and case-insensitive matching branches

1 participant