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>
The talent graph's recruiter monetization was designed (Opportunity → Pilot →
Proof funnel) but never wired to charge. This adds the placement/candidate-unlock
revenue engine on top of the existing talent graph, charged through Creem (a
merchant-of-record with Turkey-based-seller payout support — the portfolio
standard used by bidstage/CalDesk), not Polar/Stripe.
Revenue gate: a recruiter (opportunity owner) unlocks a matched candidate's
contact + full evidence. Gating mirrors the referral gate (owner-only, no
self-unlock, candidate must have real matching evidence). The fee is charged via
a Creem checkout whose custom_price is the exact computed fee, and settled by the
signed checkout.completed webhook, which records the entitlement + receipt.
- Fee math (pure, configurable): flat unlock access fee (TALENT_UNLOCK_FEE_CENTS,
default $49) or a percentage placement success fee (rate + min/max clamps) when
a placement amount is supplied.
- New TalentPlacement model + migration: entitlement/receipt with a compound
unique key (opportunity, candidate, recruiter) for charge idempotency and a
unique providerOrderId; provider defaults to creem.
- Creem adapter (createCreemCheckout) mirroring the reviewed bidstage lib/creem.ts,
and a signed Creem webhook route (HMAC-SHA256, timing-safe) that settles
placements. Amount is revalidated against the quoted fee before unlocking.
- Routes: POST/GET /talent-graph/opportunities/:id/unlocks and gated
GET .../candidates/:candidateId/contact (402 until paid).
- Errors.paymentRequired (402) helper.
- Tests: fee math, gating, charge idempotency, and the signed webhook settlement
path (75 tests). Secrets are env-only (CREEM_API_KEY, CREEM_WEBHOOK_SECRET,
CREEM_PRODUCT_ID) — none committed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>