feat(personal-context): generate & persist user personal context#4023
Conversation
Write-only integration with the personal-context-engine (PCE): - CDC on user-updated (portfolio change) triggers the website source - better-auth account.create.after hook triggers the github source, resolving the login via the GitHub API from the linked ba_account - shared requestPersonalContext helper upserts a pending row and publishes api.v1.generate-personal-context in one transaction - result worker persists profileText + boost/mute tags, guarded by a per-(userId,source) correlationId stale check - gated behind the opt-in personalContextEnabled remote config flag Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
🍹 The Update (preview) for dailydotdev/api/prod (at a6b8c60) was successful. Resource Changes Name Type Operation
~ vpc-native-materialize-monthly-best-post-archives-cron kubernetes:batch/v1:CronJob update
~ vpc-native-worker-job-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-clean-expired-better-auth-sessions-cron kubernetes:batch/v1:CronJob update
~ vpc-native-hourly-notification-cron kubernetes:batch/v1:CronJob update
~ vpc-native-post-analytics-history-day-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-user-profile-updated-sync-cron kubernetes:batch/v1:CronJob update
~ vpc-native-temporal-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-clean-channel-highlights-cron kubernetes:batch/v1:CronJob update
~ vpc-native-private-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-calculate-top-readers-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-images-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-tag-materialized-views-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-views-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-trending-cron kubernetes:batch/v1:CronJob update
~ vpc-native-sync-subscription-with-cio-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-current-streak-cron kubernetes:batch/v1:CronJob update
~ vpc-native-post-analytics-clickhouse-cron kubernetes:batch/v1:CronJob update
~ vpc-native-personalized-digest-cron kubernetes:batch/v1:CronJob update
~ vpc-native-channel-digests-cron kubernetes:batch/v1:CronJob update
- vpc-native-api-db-migration-5ff3281e kubernetes:batch/v1:Job delete
+ vpc-native-api-clickhouse-migration-7ac75367 kubernetes:batch/v1:Job create
~ vpc-native-daily-digest-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-zombie-user-companies-cron kubernetes:batch/v1:CronJob update
~ vpc-native-rotate-weekly-quests-cron kubernetes:batch/v1:CronJob update
~ vpc-native-channel-highlights-cron kubernetes:batch/v1:CronJob update
~ vpc-native-update-highlighted-views-cron kubernetes:batch/v1:CronJob update
~ vpc-native-clean-stale-user-transactions-cron kubernetes:batch/v1:CronJob update
~ vpc-native-materialize-yearly-best-post-archives-cron kubernetes:batch/v1:CronJob update
~ vpc-native-personalized-digest-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-clean-zombie-opportunities-cron kubernetes:batch/v1:CronJob update
+ api-sub-api.personal-context-generated gcp:pubsub/subscription:Subscription create
~ vpc-native-bg-deployment kubernetes:apps/v1:Deployment update
~ vpc-native-clean-zombie-users-cron kubernetes:batch/v1:CronJob update
~ vpc-native-subscription-anniversary-achievements-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-generic-referral-reminder-cron kubernetes:batch/v1:CronJob update
~ vpc-native-rotate-daily-quests-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
+ api-sub-api.github-account-linked-personal-context gcp:pubsub/subscription:Subscription create
... and 19 other changes |
|
@claude review |
|
Claude finished @capJavert's task in 2m 36s —— View job PR Review: Personal Context generation & persistenceNicely scoped write-only integration — the correlationId stale guard, feature-flag gating, transactional upsert+publish, and the test coverage across all three workers are all solid. A few things worth addressing before this grows further. Potential issues1. Entity vs migration column-type mismatch ( 2. Event published inside the DB transaction, before commit — in
Consider committing first, then publishing (outsource the publish to after the 3. Suggestions4. Duplicated GitHub-token lookup — the raw 5. Redundant index — 6. Tag data duplicated — 7. Stale fields on re-request — the upsert in Nits
Overall this is clean and well-tested. Items 1 and 2 are the ones I'd resolve before merge. |
- align UserPersonalContext.userId with user.id (varchar(36)) to avoid entity/migration drift - commit the pending row before publishing generate-personal-context (was inside a transaction) so PCE can't receive a request before the row exists; publish failure self-heals via trigger-message retry - drop the redundant userId index (composite PK already covers it) - remove dedicated boostTags/muteTags columns; tags live only in context.ranking_signals to avoid duplication/drift - githubAccountLinked: mark the source failed on a GitHub API error instead of nacking and retrying forever (revoked/expired token) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@claude review again 3. and 4. and 7. are fine |
|
Claude finished @capJavert's task in 1m 8s —— View job Re-review — personal contextRe-reviewed the current branch. Items 3, 4, 7 acknowledged as fine per your call — skipped. The remaining items from the first pass are all resolved:
Nothing new surfaced in the delta — the |
Write-only integration with the personal-context-engine (PCE):