You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GitHub contributor counts measure commit activity, not authorship, and can include contributors from a project's inherited history. Instead of crediting contributors based on commit count alone, the importer now treats discovered contributors as candidates and lets users choose who to credit.
This branch includes the commits from #64 and #71, so those PRs can be closed once this PR merges.
What changed
Import options: Add "Authors to credit automatically" (0–50, default 5) and "Ignore contributions before" (date) to both import forms.
Candidate panel: Add a "GitHub author candidates" panel above the author list. Each row includes a checkbox to add or remove the person and an explanation of why they were surfaced, including source, commit count, last commit date, and activity since the cutoff.
Auto-credit rules:
Authors from CITATION.cff, .zenodo.json, and package metadata are preserved in their original order.
Only the top N contributors active within the cutoff window are credited automatically, along with anyone named in a Co-authored-by trailer.
Human names discovered only through commit history appear as candidates but are not credited automatically.
Importer API: Update importGithubMetadata to accept contributorSince and return authorCandidates. The commit URL builder also supports a since filter.
GitHub contributor counts are all-time. The cutoff is checked against only the scanned commit window (100 commits without a token, 1,000 with one), so a recent contributor outside that window may be flagged as having no recent commits.
Fork metadata is not used. GitHub's parent and source fields do not reliably indicate where independent development began, and many derived repositories are no longer recognized as forks.
A commit-hash cutoff is not implemented because it requires ancestry validation and introduces additional edge cases.
Testing
npm run test passes: 114 tests, including 5 new tests for candidate selection, the cutoff, and the since request.
npm run build passes.
Manual UI verification: Import a repository with a cutoff date and confirm that the candidate panel behaves as described.
This PR adds contributor selection to OpenCite’s GitHub importer, separating discovered candidates from automatically credited authors and giving users control over inherited repository history.
Changes:
Add automatic-credit limits, date-range controls, and a candidate selection panel.
Expand bounded commit-history discovery and filter contributor profiles before applying limits.
Document selection behavior and add focused regression tests.
File
Description
tests/services/githubImporter.test.js
Update commit-request fixtures for larger scans.
tests/services/contributorFallback.test.js
Test human-only limits and profile-request bounds.
tests/services/commitAuthors.test.js
Test commit-history pagination and name filtering.
tests/services/authorCandidates.test.js
Test candidate selection, matching, and date filters.
src/styles.css
Style import controls and candidate rows.
src/services/githubImporterContributors.js
Filter profiles, bound enrichment, and resolve date options.
src/services/githubImporterCommitAuthors.js
Discover authors through bounded commit scans.
src/services/githubImporterAuthorCandidates.js
Build candidates and determine automatic selection.
src/services/githubImporter.js
Integrate selection options and candidate results.
src/services/githubApi.js
Support commit pagination and date filters.
src/services/github.examples.js
Demonstrate contributor limits and date ranges.
src/components/AuthorCandidates.jsx
Add import controls and candidate checkboxes.
src/App.jsx
Connect candidate selection to author state.
README.md
Explain contributor selection and scan limitations.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved matching and filtering defects can misattribute or duplicate authors, while pagination and input-validation bugs can exhaust the API budget or apply unintended import cutoffs and credit limits.
Treat a blank fallback limit as an omitted import option
src/services/githubImporter.js:526
Passing contributorFallbackLimit: '' bypasses the default of 5 here, but resolveContributorFallbackLimit treats that empty value as its internal default of 50. An integration supplying a blank optional field consequently auto-credits up to 25 people without a token or 50 with one, rather than the documented 5. Treat an empty string as an omitted import option, as the UI already does.
Require matching first names for fuzzy author matching
The enrichment matcher treats John Smith and Jane Smith as the same person because their initials match. This can mark the wrong candidate as selected, prevent adding that person, or remove the other author when unchecked—even when an exact name match appears later in the list. Require matching first names for the fuzzy fallback so middle-initial variants still match without equating different fully spelled first names.
Exclude automated identities based on login as well as name
src/services/githubImporterCommitAuthors.js:14
A commit from a User account such as bot-builder with a human-looking name such as Jane Doe passes this filter, even though the contributor pipeline excludes that login. This reintroduces an automated account in the candidate panel. Apply the automated-identity check to the login as well as the name.
Reject underscore-separated handles as anonymous author names
src/services/githubImporterCommitAuthors.js:19
An anonymous commit author named name_handle passes this filter because only hyphenated handles are checked. normalizeAuthor then turns it into Name Handle, presenting an account identifier as a human author candidate despite #68's requirement to reject username-like values. Reject underscore-separated handles before humanizing the name.
Cap contributor-page requests independently of retained accounts
src/services/githubImporterContributors.js:159
This ceiling limits retained non-bot accounts, not contributor-page requests. Full bot-only pages leave contributors.length unchanged, so the loop can fetch arbitrarily many pages despite the 25/70 examination ceiling, consuming the unauthenticated API budget before the remaining import work runs. Add a separate page or raw-entry budget and report when it is exhausted, while continuing past automated accounts within that budget.
Reject impossible calendar dates instead of normalizing them
src/services/githubImporterContributors.js:193
An impossible plain date such as 2025-02-30 is normalized to March 2 by new Date rather than rejected. The importer consequently applies a different cutoff without emitting its invalid-date warning. Validate that the parsed calendar date matches the supplied YYYY-MM-DD value before returning it.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Inconsistent author identity matching can create duplicate authors that block export and incorrectly link checkbox selections across distinct candidates.
Changing an imported author's ORCID from its URL form to an accepted bare ID, such as 0000-0002-1825-0097, makes this helper treat the equivalent identifiers as different. The candidate then appears unchecked, and selecting it adds a duplicate author that blocks export. Reuse normalizeOrcid before comparing identifiers so both representations match.
Avoid ambiguous ORCID-less author matches across candidates
An imported author without an ORCID can match multiple candidates with different ORCIDs. For example, with one metadata author named Alex Smith and two Alex Smith candidates carrying distinct ORCIDs, this fallback returns index 0 for both—even with automatic credit set to zero. The panel consequently shows both selected, and unchecking either removes the shared author row and deselects the other. Check ambiguity across the candidate pool before binding an ORCID-bearing candidate to an ORCID-less author, and use the same unambiguous mapping for checkbox state and removal.
Merge candidates using the same middle-initial-tolerant identity matcher
Candidate merging only looks up the exact full name, while checkbox selection uses the middle-initial-tolerant matcher. A profile named Elizabeth G. Campolongo and a commit author named Elizabeth Campolongo therefore produce two rows, but both rows are checked for the same form author and toggling either changes both. Their source explanations also remain split. Use consistent identity matching when merging candidates, retaining the conflicting-ORCID safeguards, so these variants produce one combined-source row.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Active issues in author matching and ordering can create duplicate authors, let ambiguous initials control another contributor’s selection, and change credited author order.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #78, #56, and #68. Supersedes #64 and #71.
GitHub contributor counts measure commit activity, not authorship, and can include contributors from a project's inherited history. Instead of crediting contributors based on commit count alone, the importer now treats discovered contributors as candidates and lets users choose who to credit.
This branch includes the commits from #64 and #71, so those PRs can be closed once this PR merges.
What changed
CITATION.cff,.zenodo.json, and package metadata are preserved in their original order.Co-authored-bytrailer.importGithubMetadatato acceptcontributorSinceand returnauthorCandidates. The commit URL builder also supports asincefilter.Behavior changes to review
Limitations
parentandsourcefields do not reliably indicate where independent development began, and many derived repositories are no longer recognized as forks.Testing
npm run testpasses: 114 tests, including 5 new tests for candidate selection, the cutoff, and thesincerequest.npm run buildpasses.