Skip to content

Add Pub/Sub publisher for event notifications#131

Merged
eswan18 merged 5 commits into
mainfrom
feature/pubsub-publisher
Apr 7, 2026
Merged

Add Pub/Sub publisher for event notifications#131
eswan18 merged 5 commits into
mainfrom
feature/pubsub-publisher

Conversation

@eswan18
Copy link
Copy Markdown
Owner

@eswan18 eswan18 commented Apr 7, 2026

Summary

  • Install @google-cloud/pubsub dependency
  • Add lib/pubsub/client.ts with a publishEvent() helper that publishes BaseEvent messages to the forecasting Pub/Sub topic
  • Add GCP_PROJECT_ID (base configmap) and PUBSUB_TOPIC (per-env configmaps) to K8s config
  • Publish competition.member_added event when a user is added to a private competition (fire-and-forget)
  • Events use an optional notify field for email targets, keeping the schema general-purpose

The Pub/Sub topics, subscriptions, and IAM bindings already exist in the infra repo. The comms service is deployed and listening on these subscriptions with a matching competition.member_added email template.

Test plan

  • Verify npm run lint passes
  • Unit tests for publishEvent() (4 tests passing)
  • Deploy to staging and confirm pods start without errors
  • Add a member to a private competition and confirm the notification email arrives

🤖 Generated with Claude Code

eswan18 and others added 5 commits April 6, 2026 22:05
Install @google-cloud/pubsub and add a publishEvent() helper in
lib/pubsub/client.ts that publishes BaseEvent messages to the
forecasting Pub/Sub topic. Add GCP_PROJECT_ID and PUBSUB_TOPIC
env vars to K8s configmaps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…competition

Notifies the added user via Pub/Sub → comms email pipeline.
Fire-and-forget: failures are logged but don't block the action.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Matches the comms repo change — notify is now optional, making
events more general-purpose for non-email subscribers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Includes a link to the competition page so the email has a
"View Competition" button. Uses APP_BASE_URL from env.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@eswan18 eswan18 merged commit 94030e4 into main Apr 7, 2026
1 check passed
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.

1 participant