Skip to content

Enrich user companies from verified email domains#3891

Merged
rebelchris merged 11 commits into
mainfrom
codex/user-company-email-enrichment
May 21, 2026
Merged

Enrich user companies from verified email domains#3891
rebelchris merged 11 commits into
mainfrom
codex/user-company-email-enrichment

Conversation

@rebelchris

Copy link
Copy Markdown
Contributor

Summary

  • Add async UserCompany company enrichment for verified work email domains
  • Link existing companies by domain before calling Anthropic
  • Create new Company rows from domain-based enrichment and update UserCompany.companyId
  • Trigger enrichment from CDC while preserving the existing user-company-approved flow
  • Add helper and CDC tests for existing link/create/skip behavior

Verification

  • pnpm exec eslint src/common/companyEnrichment.ts src/workers/cdc/primary.ts tests/common/companyEnrichment.ts tests/workers/cdc/userCompanyEnrichment.ts
  • Focused Jest could not complete locally because database api_test does not exist
  • pnpm run build is currently blocked by unrelated @dailydotdev/schema Persona Quiz type errors in src/integrations/bragi/clients.ts and src/schema/users.ts

@pulumi

pulumi Bot commented May 20, 2026

Copy link
Copy Markdown

🍹 The Update (preview) for dailydotdev/api/prod (at 07ddbf7) was successful.

✨ Neo Explanation

This is a routine feature deployment adding a new async company enrichment pipeline for user work emails, backed by a new Pub/Sub subscription and the standard image rollout. ✅ Low Risk

This PR introduces automated company enrichment for UserCompany records. When a UserCompany is created without a companyId (or becomes verified), the CDC worker now publishes an api.v1.user-company-enrichment event instead of doing nothing. The new userCompanyEnrichment worker consumes that event, extracts the email domain, looks up or creates a matching Company record using Claude AI (Anthropic), and links it back to the UserCompany.

The infrastructure changes reflect this: a new GCP Pub/Sub subscription (api.user-company-enrichment) is created to back the new worker, and both migration jobs (DB + Clickhouse) are rotated to the new image SHA, which likely includes schema changes supporting this feature. All deployment/cronjob updates are routine image tag rollouts.

🔵 Info — The new enrichCompanyForUserCompany flow makes outbound HTTP requests to Anthropic and to each company's domain for validation. If ANTHROPIC_API_KEY is not set in the production secret, enrichment silently skips — confirm this env var is present if enrichment is intended to be active immediately. The Pub/Sub subscription will begin accumulating messages as soon as the CDC worker is deployed, so any lag in deploying the consumer worker could result in a backlog.

Resource Changes

    Name                                                       Type                                  Operation
+   vpc-native-api-db-migration-01dfda15                       kubernetes:batch/v1:Job               create
~   vpc-native-update-current-streak-cron                      kubernetes:batch/v1:CronJob           update
~   vpc-native-private-deployment                              kubernetes:apps/v1:Deployment         update
~   vpc-native-update-trending-cron                            kubernetes:batch/v1:CronJob           update
~   vpc-native-ws-deployment                                   kubernetes:apps/v1:Deployment         update
~   vpc-native-temporal-deployment                             kubernetes:apps/v1:Deployment         update
~   vpc-native-clean-zombie-user-companies-cron                kubernetes:batch/v1:CronJob           update
~   vpc-native-check-analytics-report-cron                     kubernetes:batch/v1:CronJob           update
~   vpc-native-squad-posts-analytics-refresh-cron              kubernetes:batch/v1:CronJob           update
~   vpc-native-expire-super-agent-trial-cron                   kubernetes:batch/v1:CronJob           update
~   vpc-native-calculate-top-readers-cron                      kubernetes:batch/v1:CronJob           update
~   vpc-native-hourly-notification-cron                        kubernetes:batch/v1:CronJob           update
~   vpc-native-clean-stale-user-transactions-cron              kubernetes:batch/v1:CronJob           update
~   vpc-native-user-profile-analytics-history-clickhouse-cron  kubernetes:batch/v1:CronJob           update
~   vpc-native-clean-gifted-plus-cron                          kubernetes:batch/v1:CronJob           update
~   vpc-native-post-analytics-clickhouse-cron                  kubernetes:batch/v1:CronJob           update
~   vpc-native-user-profile-analytics-clickhouse-cron          kubernetes:batch/v1:CronJob           update
~   vpc-native-clean-zombie-opportunities-cron                 kubernetes:batch/v1:CronJob           update
~   vpc-native-bg-deployment                                   kubernetes:apps/v1:Deployment         update
~   vpc-native-channel-digests-cron                            kubernetes:batch/v1:CronJob           update
~   vpc-native-rotate-daily-quests-cron                        kubernetes:batch/v1:CronJob           update
~   vpc-native-user-profile-updated-sync-cron                  kubernetes:batch/v1:CronJob           update
~   vpc-native-validate-active-users-cron                      kubernetes:batch/v1:CronJob           update
~   vpc-native-clean-zombie-users-cron                         kubernetes:batch/v1:CronJob           update
~   vpc-native-update-source-public-threshold-cron             kubernetes:batch/v1:CronJob           update
~   vpc-native-daily-digest-cron                               kubernetes:batch/v1:CronJob           update
~   vpc-native-rotate-weekly-quests-cron                       kubernetes:batch/v1:CronJob           update
~   vpc-native-clean-channel-highlights-cron                   kubernetes:batch/v1:CronJob           update
~   vpc-native-worker-job-deployment                           kubernetes:apps/v1:Deployment         update
~   vpc-native-personalized-digest-deployment                  kubernetes:apps/v1:Deployment         update
+   api-sub-api.user-company-enrichment                        gcp:pubsub/subscription:Subscription  create
~   vpc-native-clean-zombie-images-cron                        kubernetes:batch/v1:CronJob           update
~   vpc-native-update-tags-str-cron                            kubernetes:batch/v1:CronJob           update
~   vpc-native-update-highlighted-views-cron                   kubernetes:batch/v1:CronJob           update
~   vpc-native-clean-old-notifications-cron                    kubernetes:batch/v1:CronJob           update
~   vpc-native-post-analytics-history-day-clickhouse-cron      kubernetes:batch/v1:CronJob           update
~   vpc-native-channel-highlights-cron                         kubernetes:batch/v1:CronJob           update
~   vpc-native-user-posts-analytics-refresh-cron               kubernetes:batch/v1:CronJob           update
~   vpc-native-update-views-cron                               kubernetes:batch/v1:CronJob           update
-   vpc-native-api-db-migration-6afc1bba                       kubernetes:batch/v1:Job               delete
~   vpc-native-generic-referral-reminder-cron                  kubernetes:batch/v1:CronJob           update
... and 13 other changes

Comment thread src/workers/cdc/primary.ts Outdated
Comment thread .infra/Pulumi.adhoc.yaml Outdated
@rebelchris rebelchris requested a review from capJavert May 21, 2026 07:52
Comment thread src/common/companyEnrichment.ts Outdated
Comment thread src/common/companyEnrichment.ts
Comment thread src/workers/cdc/primary.ts Outdated
@rebelchris rebelchris merged commit ebf098d into main May 21, 2026
9 checks passed
@rebelchris rebelchris deleted the codex/user-company-email-enrichment branch May 21, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants