1 Commits

Author SHA1 Message Date
2431ac08f9 feat(talent): backfill real contribution evidence via GraphQL at sync time
The talent graph's `github_activity` evidence was written only by the GitHub
App webhook, so a new user's contribution-trajectory evidence stayed empty
until an owner configured a webhook and it fired — an ops dependency, not real
first-run data. Backfill it from the GitHub GraphQL contributionsCollection.

- githubContributionsService: pure `mapContributionsToActivities` turns real
  commit/PR/review/issue contributions into RepositoryActivity rows, scoped to
  the user's managed repositories (RepositoryManager), attributed to their
  GitHub identity (actorLogin), deduped by a deterministic eventId that mirrors
  the webhook delivery-id discipline. `harvestContributionEvidence` fetches via
  octokit.graphql (no new dependency) and deduped-inserts with skipDuplicates.
  Injectable db + graphql client so it is unit tested without Postgres/GitHub.
- githubController.syncProjects: run the backfill after project sync, non-fatal
  (a harvest failure never breaks the primary sync), and report the counts.

This makes contribution evidence real and immediate after login with no
GitHub-App-webhook ops dependency and no fabricated seed data.

Tests: mapping (all 4 contribution types), managed-repo scoping, identity
attribution, deterministic-id dedupe, malformed/empty input, and the harvester
no-op / happy-path / graphql-failure paths. 20 new assertions across 10 tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-06 10:35:09 +03:00