Skip to content

test(scoring): cover sameLogin/sameRepoFullName edge cases in pending-pr-scenarios - #8484

Closed
xfodev wants to merge 1 commit into
JSONbored:mainfrom
xfodev:fix/pending-pr-scenarios-null-login-coverage-8329
Closed

test(scoring): cover sameLogin/sameRepoFullName edge cases in pending-pr-scenarios#8484
xfodev wants to merge 1 commit into
JSONbored:mainfrom
xfodev:fix/pending-pr-scenarios-null-login-coverage-8329

Conversation

@xfodev

@xfodev xfodev commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

loadContributorRepoOpenPrSignalRecords (src/scoring/pending-pr-scenarios.ts) filters a contributor's open PRs via two helpers whose edge branches had no coverage:

  • sameLogin(value, login) — its value && short-circuit handles PullRequestRecord.authorLogin being null/undefined (ghost/deleted GitHub accounts). No test proved such a PR is excluded rather than matching by accident or throwing on null.toLowerCase().
  • sameRepoFullName / sameLogin case-insensitivity — no test proved case-differing repo/login values still match.

Add three tests (mirroring the existing loadContributorRepoOpenPrSignalRecords test's vi.spyOn harness): null + undefined authorLogin are excluded via the short-circuit; a repoFullName differing only in case still matches; an authorLogin differing only in case still matches.

Pure test-addition — no production code changed.

Tests

test/unit/pending-pr-scenarios.test.ts — +3 tests (20 pass). Covers both operands of sameLogin's value && (falsy null/undefined + truthy case-differing) and both helpers' .toLowerCase() normalization.

Validation

  • test/unit/pending-pr-scenarios.test.ts green (20/20).
  • Test-only change (no src/** diff); no secret/wallet/hotkey/trust/reward terms.

Closes #8329

…-pr-scenarios (JSONbored#8329)

loadContributorRepoOpenPrSignalRecords filters a contributor's open PRs via
sameLogin (whose `value &&` short-circuit handles a null/undefined authorLogin
from ghost/deleted accounts) and sameRepoFullName (case-insensitive). Neither
the falsy-authorLogin branch nor the case-normalization was exercised. Add three
tests: PRs with null/undefined authorLogin are excluded (short-circuit, no throw
on the null .toLowerCase()); a repoFullName differing only in case still matches;
an authorLogin differing only in case still matches. No production code changed.

Closes JSONbored#8329
@xfodev
xfodev requested a review from JSONbored as a code owner July 24, 2026 15:03
@loopover-orb

loopover-orb Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

LoopOver closed this because @xfodev has 3 open pull requests, above this repository's configured limit of 2. Close or merge an existing one to open a new one. This is an automated maintenance action.

@loopover-orb loopover-orb Bot closed this Jul 24, 2026
@loopover-orb loopover-orb Bot added the mod:warning Gittensor contributor context label Jul 24, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:warning Gittensor contributor context

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