fix: improve contributor fallback and author visibility - #64
beanbean9339 wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved fixture, contributor ordering, fallback-limit, and example-naming issues remain.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Improves GitHub contributor fallback, filtering, anonymous author discovery, and author visibility.
Changes:
- Expands automated-account filtering and contributor discovery.
- Adds pagination and historical commit-author scanning.
- Updates author visibility, tests, examples, and documentation.
File summaries
| File | Summary | Findings |
|---|---|---|
tests/services/githubImporter.test.js |
Adds regression coverage | Fixtures require updates for the new request shape. |
src/services/githubImporterContributors.js |
Filters and discovers contributors | Moderate (3 votes): fallback limits are no longer honored. |
src/services/githubImporter.js |
Integrates historical authors | Critical (1 vote): existing fixtures fail with per_page=100 URLs.Moderate (1 vote): commit-history authors override established contributor ordering. |
src/services/githubApi.js |
Adds pagination and anonymous-author parameters | No review findings. |
src/services/github.examples.js |
Updates importer examples | Nit (1 vote): rename the misleading exampleCustomContributorLimit export. |
src/components/MetadataForm.jsx |
Shows all authors by default | No review findings. |
src/App.jsx |
Removes fallback-limit configuration | No review findings. |
README.md |
Documents contributor behavior | No review findings. |
Review details
Suppressed comments (2)
src/services/github.examples.js:84
- This example is still exported as
exampleCustomContributorLimit, but the updated body no longer demonstrates or accepts a custom limit. The name now misleads callers about what the example does; rename the example (and any references) to describe contributor fallback authors instead.
* Example: Contributor fallback authors
* Includes all eligible human contributors when repository metadata has no authors.
*/
export async function exampleCustomContributorLimit() {
try {
const repoUrl = 'https://github.com/imageomics/OpenCite';
const { metadata, warnings } = await importGithubMetadata(repoUrl);
src/services/githubImporter.js:743
orderAuthorsByContributorRankranks authors by their position incontributorLookupAuthors; prependingcommitAuthorshere lets commit-history order override the existing co-author/contributor ranking. For a repository whose recent commit author is not the highest-ranked contributor, this changes the documented contributor ordering. Append the new commit-history entries after the existing lookup list so the prior ordering remains authoritative.
const contributorLookupAuthors = dedupeAuthors([
...commitAuthors,
...coAuthorAuthors,
...contributorResult.lookupAuthors.filter(Boolean),
- Files reviewed: 8/8 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const releaseData = Array.isArray(releaseList) && releaseList.length > 0 ? releaseList[0] : null; | ||
| const recentCommitPayload = await fetchOptionalJson( | ||
| buildGithubCommitListApiUrl(owner, repo, defaultBranch, 10), | ||
| buildGithubCommitListApiUrl(owner, repo, defaultBranch, 100), |
| } | ||
|
|
||
| return Math.min(Math.max(Math.trunc(rawLimit), 1), MAX_CONTRIBUTOR_FALLBACK_LIMIT); | ||
| return null; |
There was a problem hiding this comment.
🟡 Changes recommended
Address stale test mocks, unbounded API scans, and overly broad display-name filtering.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (3)
Previously missed (1) — in code that hasn't changed since the last review.
src/services/githubImporterContributors.js:226
- When an authentication token is present,
maxPagesisnull, so a long repository history is scanned one 100-commit request at a time until the end. A single import can therefore issue thousands of requests, consume the token's rate limit, and remain slow or fail; authenticated scans still need a finite safety cap and a warning when that cap is reached.
src/services/githubImporter.js:553
- This request-size change leaves several importer test fixtures matching only
commits?per_page=1&sha=main(for exampletests/services/githubImporter.test.js:759, 839, 898, 1087, 1671, 1817, and 1910). The importer now requestsper_page=100, so those tests fall through toUnexpected fetch URLbefore exercising the behavior; update all remaining mocks to accept the new URL (or make the mock branch accept both).
buildGithubCommitListApiUrl(owner, repo, defaultBranch, 100),
src/services/githubImporterContributors.js:385
- This applies the username heuristic to a verified GitHub profile display name, so legitimate human names such as
Anne-MarieorMcDonaldare discarded merely because they contain a hyphen or camel case, even when they differ from the login. Use the profile/login relationship to reject unusable handles without filtering valid display-name punctuation and casing.
if (profile?.name && !matchesGithubLoginName(profile.name, login, cleanString) && !isLikelyGithubUsername(profile.name, cleanString)) {
- Files reviewed: 8/8 changed files
- Comments generated: 1
- Review effort level: Lite
| warnings, | ||
| authToken = '', | ||
| contributorFallbackLimit = TOP_CONTRIBUTOR_FALLBACK_LIMIT, | ||
| contributorFallbackLimit = null, |
Summary
Closes #56
This pull request improves GitHub contributor fallback handling by ensuring automated accounts are excluded from citation authors and eligible human contributors are identified more reliably.
Changes
Testing
Related Issue
Closes #56