Context
src/scoring/pending-pr-scenarios.ts defines two small helpers used to filter a contributor's open PRs:
function sameRepoFullName(left: string, right: string): boolean {
return left.toLowerCase() === right.toLowerCase();
}
function sameLogin(value: string | null | undefined, login: string): boolean {
return Boolean(value && value.toLowerCase() === login.toLowerCase());
}
sameLogin's value && short-circuit exists specifically to handle PullRequestRecord.authorLogin, which is typed string | null | undefined in src/types.ts — a real case for ghost/deleted GitHub accounts whose author login can't be resolved. sameRepoFullName's .toLowerCase() normalization exists to handle repo full names that may differ only in case (e.g. GitHub is case-insensitive for owner/repo but stored values aren't guaranteed to be consistently cased).
Every test in test/unit/pending-pr-scenarios.test.ts that exercises loadContributorRepoOpenPrSignalRecords (which calls both helpers) sets authorLogin to a concrete string that either matches or differs from the target login only in content, never null/undefined, and never varies the case of repoFullName or login between the PR record and the query args. So:
- The
value && null/undefined-login short-circuit in sameLogin has no test proving a PR from a ghost/deleted account (authorLogin: null or undefined) is correctly excluded rather than throwing or matching by accident.
- The case-insensitive matching in both helpers has no test proving e.g.
"Entrius/allways-ui" matches "entrius/allways-ui", or a login differing only in case still matches.
Requirements
- Add a test case to
test/unit/pending-pr-scenarios.test.ts where one PullRequestRecord passed to loadContributorRepoOpenPrSignalRecords has authorLogin: null and another has authorLogin: undefined (if the type/fixture allows), both for the target login being searched for — assert neither is included in the result (i.e. sameLogin's short-circuit excludes them rather than matching or throwing).
- Add a test case with a
repoFullName on the PullRequestRecord that differs from the query's repoFullName argument only in letter case (e.g. record has "Acme/Widgets", query passes "acme/widgets") — assert it still matches and is included.
- Add a test case with an
authorLogin on the record that differs from the query's login argument only in letter case — assert it still matches and is included.
Deliverables
Test Coverage Requirements
This repo's Codecov patch gate requires 99%+ coverage of changed lines and branches. This issue is pure test-addition — cover both operands of sameLogin's value && short-circuit (truthy and falsy value) and the case-normalization behavior of both helpers.
Expected Outcome
sameRepoFullName's case-insensitive matching and sameLogin's null/undefined-login handling (including the ghost/deleted-account case) are backed by explicit tests, closing a real branch-coverage gap on logic that determines which of a contributor's open PRs are counted toward their pending-PR scenario signals.
Links & Resources
src/scoring/pending-pr-scenarios.ts — sameRepoFullName/sameLogin, end of file; loadContributorRepoOpenPrSignalRecords, top of file
src/types.ts — PullRequestRecord.authorLogin: string | null | undefined
test/unit/pending-pr-scenarios.test.ts — existing coverage
Context
src/scoring/pending-pr-scenarios.tsdefines two small helpers used to filter a contributor's open PRs:sameLogin'svalue &&short-circuit exists specifically to handlePullRequestRecord.authorLogin, which is typedstring | null | undefinedinsrc/types.ts— a real case for ghost/deleted GitHub accounts whose author login can't be resolved.sameRepoFullName's.toLowerCase()normalization exists to handle repo full names that may differ only in case (e.g. GitHub is case-insensitive for owner/repo but stored values aren't guaranteed to be consistently cased).Every test in
test/unit/pending-pr-scenarios.test.tsthat exercisesloadContributorRepoOpenPrSignalRecords(which calls both helpers) setsauthorLoginto a concrete string that either matches or differs from the target login only in content, nevernull/undefined, and never varies the case ofrepoFullNameorloginbetween the PR record and the query args. So:value &&null/undefined-login short-circuit insameLoginhas no test proving a PR from a ghost/deleted account (authorLogin: nullorundefined) is correctly excluded rather than throwing or matching by accident."Entrius/allways-ui"matches"entrius/allways-ui", or a login differing only in case still matches.Requirements
test/unit/pending-pr-scenarios.test.tswhere onePullRequestRecordpassed toloadContributorRepoOpenPrSignalRecordshasauthorLogin: nulland another hasauthorLogin: undefined(if the type/fixture allows), both for the target login being searched for — assert neither is included in the result (i.e.sameLogin's short-circuit excludes them rather than matching or throwing).repoFullNameon thePullRequestRecordthat differs from the query'srepoFullNameargument only in letter case (e.g. record has"Acme/Widgets", query passes"acme/widgets") — assert it still matches and is included.authorLoginon the record that differs from the query'sloginargument only in letter case — assert it still matches and is included.Deliverables
test/unit/pending-pr-scenarios.test.tscovering: nullauthorLogin, undefinedauthorLogin, case-differingrepoFullName, and case-differinglogin, each asserting the correct include/exclude outcome.Test Coverage Requirements
This repo's Codecov patch gate requires 99%+ coverage of changed lines and branches. This issue is pure test-addition — cover both operands of
sameLogin'svalue &&short-circuit (truthy and falsyvalue) and the case-normalization behavior of both helpers.Expected Outcome
sameRepoFullName's case-insensitive matching andsameLogin's null/undefined-login handling (including the ghost/deleted-account case) are backed by explicit tests, closing a real branch-coverage gap on logic that determines which of a contributor's open PRs are counted toward their pending-PR scenario signals.Links & Resources
src/scoring/pending-pr-scenarios.ts—sameRepoFullName/sameLogin, end of file;loadContributorRepoOpenPrSignalRecords, top of filesrc/types.ts—PullRequestRecord.authorLogin: string | null | undefinedtest/unit/pending-pr-scenarios.test.ts— existing coverage