Skip to content

Feat/issue 78 contributor selection - #82

Open
beanbean9339 wants to merge 15 commits into
mainfrom
feat/issue-78-contributor-selection
Open

beanbean9339 wants to merge 15 commits into
mainfrom
feat/issue-78-contributor-selection

Conversation

@beanbean9339

Copy link
Copy Markdown
Collaborator

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

  • 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.
  • From Fix contributor fallback limit when automated accounts are present #64: Only eligible human contributors count toward the limit. Automated accounts and profiles without usable display names are skipped, and request windows are bounded.
  • From Discover human author names from bounded commit history #71: Bound commit-history author discovery to 100 commits without a token and 1,000 commits with a token.

Behavior changes to review

Limitations

  • 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Selection limits, date cutoffs, and identity handling can still produce incorrect author lists.

7 open issues
What changed in this PR

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.

Review effort: Balanced

Comment thread src/services/githubImporter.js Resolved
Comment thread src/services/githubImporter.js Resolved
Comment thread README.md Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

1 open issue
6 previously missed issues

In code that hasn't changed since last review

Medium severity 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.

Medium severity Require matching first names for fuzzy author matching

src/​services/​githubImporterAuthorCandidates.js:34

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.

Medium severity 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.

Medium severity 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.

Medium severity 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.

Medium severity 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.

7 resolved since last review

Review effort: Balanced

…handling for empty limits and author matching

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

1 open issue
3 previously missed issues

In code that hasn't changed since last review

Medium severity Normalize ORCIDs before comparing imported authors

src/​services/​githubImporterAuthorCandidates.js:9

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.

Medium severity Avoid ambiguous ORCID-less author matches across candidates

src/​services/​githubImporterAuthorCandidates.js:38

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.

Medium severity Merge candidates using the same middle-initial-tolerant identity matcher

src/​services/​githubImporterAuthorCandidates.js:100

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.

1 resolved since last review

Review effort: Balanced

@beanbean9339 beanbean9339 added the enhancement New feature or request label Nov 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Author matching still conflates ambiguous initial-based identities and fails to recognize explicitly added ORCID-less candidates, causing incorrect selection, unintended removals, and duplicate author entries.

2 open issues
1 resolved since last review

Review effort: Balanced

dependabot Bot and others added 5 commits November 9, 2026 12:57
Bumps [source-map-js](https://github.com/7rulnik/source-map-js) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/7rulnik/source-map-js/releases)
- [Changelog](https://github.com/7rulnik/source-map-js/blob/main/CHANGELOG.md)
- [Commits](7rulnik/source-map-js@v1.2.1...v1.2.2)

---
updated-dependencies:
- dependency-name: source-map-js
  dependency-version: 1.2.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 8.2.2 to 8.3.5.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.3.5/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 8.3.5
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [fast-uri](https://github.com/fastify/fast-uri) from 3.1.7 to 3.1.9.
- [Release notes](https://github.com/fastify/fast-uri/releases)
- [Commits](fastify/fast-uri@v3.1.7...v3.1.9)

---
updated-dependencies:
- dependency-name: fast-uri
  dependency-version: 3.1.9
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@beanbean9339
beanbean9339 requested a balanced review from Copilot November 9, 2026 18:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

3 open issues
2 resolved since last review

Review effort: Balanced

This branch has not been deployed

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

Labels

enhancement New feature or request

Projects

None yet

2 participants