Skip to content

fix: skip email notifications for system bundles (unknown, builtin)#1401

Merged
riderx merged 1 commit into
mainfrom
riderx/fix-bundle-email-spam
Jan 8, 2026
Merged

fix: skip email notifications for system bundles (unknown, builtin)#1401
riderx merged 1 commit into
mainfrom
riderx/fix-bundle-email-spam

Conversation

@riderx
Copy link
Copy Markdown
Member

@riderx riderx commented Jan 8, 2026

Summary

  • Skip email and LogSnag notifications when "unknown" or "builtin" bundles are created
  • These system bundles are auto-created when a new app is made and should not trigger user emails
  • The last_version update on the apps table still happens normally

Test plan

  • Create a new app in Capgo
  • Verify no emails are sent for "unknown" and "builtin" bundles
  • Verify emails still work normally when uploading a real bundle

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Reduced unnecessary email notifications for internal bundle types, improving notification relevance and reducing inbox clutter.
    • Enhanced notification tracking with improved metadata organization.

✏️ Tip: You can customize this high-level summary in your review settings.

When an app is created, two system bundles are automatically created:
"unknown" and "builtin". These were triggering email notifications to
users saying they uploaded a bundle, which is incorrect and confusing.

This fix skips both email and LogSnag notifications for these special
system bundle names while still allowing the last_version update.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 8, 2026

📝 Walkthrough

Walkthrough

A single trigger function was modified to conditionally skip email and LogSnag notifications for bundle types named 'unknown' or 'builtin', while enriching notification payloads with additional metadata (app_id, bundle_name, bundle_id, owner_org) when notifications are sent.

Changes

Cohort / File(s) Summary
Notification Filtering & Enrichment
supabase/functions/_backend/triggers/on_version_create.ts
Added SKIP_EMAIL_BUNDLE_NAMES constant to filter notifications by bundle type; wrapped LogSnag and email notification logic in conditional check; enriched notification payloads with app_id, bundle_name, bundle_id, owner_org; added notify: false parameter to LogSnag calls

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 Hop, hop! Notifications now skip with grace,
For 'unknown' and 'builtin'—their quiet place,
But when the right bundles dance into view,
LogSnag and emails get their richer brew! 📧✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: skipping email notifications for system bundles (unknown, builtin).
Description check ✅ Passed The description covers the summary and test plan sections but test plan items are unchecked and the checklist is missing from the provided description.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e782b20 and 67c9a86.

📒 Files selected for processing (1)
  • supabase/functions/_backend/triggers/on_version_create.ts
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit inference engine (CLAUDE.md)

Use single quotes and no semicolons per @antfu/eslint-config

Files:

  • supabase/functions/_backend/triggers/on_version_create.ts
supabase/functions/_backend/**

📄 CodeRabbit inference engine (CLAUDE.md)

Backend logic should be organized in supabase/functions/_backend/ with subdirectories for plugins, private endpoints, public endpoints, triggers, and utilities

Files:

  • supabase/functions/_backend/triggers/on_version_create.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use TypeScript strict mode with path aliases mapping ~/ to src/

Files:

  • supabase/functions/_backend/triggers/on_version_create.ts
supabase/functions/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Supabase Edge Functions use Deno runtime

Files:

  • supabase/functions/_backend/triggers/on_version_create.ts
supabase/functions/_backend/**/*.{ts,js}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

supabase/functions/_backend/**/*.{ts,js}: Backend code must be placed in supabase/functions/_backend/ as shared code deployed to Cloudflare Workers (API/Plugin/Files workers), Supabase Edge Functions, and other platforms
Use createHono from utils/hono.ts for all Hono framework application initialization and routing
All database operations must use getPgClient() or getDrizzleClient() from utils/pg.ts for PostgreSQL access during active migration to Cloudflare D1
All Hono endpoint handlers must accept Context<MiddlewareKeyVariables> and use c.get('requestId'), c.get('apikey'), and c.get('auth') for request context
Use structured logging with cloudlog({ requestId: c.get('requestId'), message: '...' }) for all backend logging
Use middlewareAPISecret for internal API endpoints and middlewareKey for external API keys; validate against owner_org in the apikeys table
Check c.get('auth')?.authType to determine authentication type ('apikey' vs 'jwt') in backend endpoints
Use Drizzle ORM query patterns with schema from postgress_schema.ts for all database operations; use aliasV2() for self-joins or multiple table references

Files:

  • supabase/functions/_backend/triggers/on_version_create.ts
supabase/functions/**/*.{ts,js}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Backend ESLint must pass before commit; run bun lint:backend for backend files

Files:

  • supabase/functions/_backend/triggers/on_version_create.ts
🧠 Learnings (4)
📚 Learning: 2025-12-23T02:53:12.055Z
Learnt from: CR
Repo: Cap-go/capgo PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T02:53:12.055Z
Learning: Applies to cloudflare_workers/api/index.ts : API Worker (port 8787) routes: `/bundle`, `/app`, `/device`, `/channel`, `/private/*`, `/triggers`

Applied to files:

  • supabase/functions/_backend/triggers/on_version_create.ts
📚 Learning: 2025-12-23T02:53:12.055Z
Learnt from: CR
Repo: Cap-go/capgo PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T02:53:12.055Z
Learning: Applies to supabase/functions/_backend/**/*.{ts,js} : Use `createHono` from `utils/hono.ts` for all Hono framework application initialization and routing

Applied to files:

  • supabase/functions/_backend/triggers/on_version_create.ts
📚 Learning: 2025-12-23T02:53:12.055Z
Learnt from: CR
Repo: Cap-go/capgo PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-23T02:53:12.055Z
Learning: Applies to supabase/functions/_backend/**/*.{ts,js} : All Hono endpoint handlers must accept `Context<MiddlewareKeyVariables>` and use `c.get('requestId')`, `c.get('apikey')`, and `c.get('auth')` for request context

Applied to files:

  • supabase/functions/_backend/triggers/on_version_create.ts
📚 Learning: 2026-01-08T00:40:00.524Z
Learnt from: CR
Repo: Cap-go/capgo PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-08T00:40:00.524Z
Learning: Applies to **/{api,server,src/server,backend}/**/*.{ts,tsx,js} : Never use the Supabase admin SDK (with service key) for user-facing APIs. Always use the client SDK with user authentication so RLS policies are enforced. The admin SDK should only be used for internal operations (triggers, CRON jobs, etc.), and when unavoidable, sanitize all user inputs carefully to prevent PostgREST query injection.

Applied to files:

  • supabase/functions/_backend/triggers/on_version_create.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Run tests
🔇 Additional comments (3)
supabase/functions/_backend/triggers/on_version_create.ts (3)

11-12: LGTM! Clear constant definition.

The constant is well-named and the comment clearly explains its purpose.


38-57: LGTM! Correct implementation with beneficial improvements.

The conditional logic correctly skips notifications for system bundles while maintaining the last_version update. The additional metadata (app_id, bundle_name, bundle_id) enriches the notification payloads, and notify: false appropriately prevents push notifications for system events.


25-26: The bundle names in this codebase are consistently stored and used in lowercase ('unknown' and 'builtin') throughout the system. Evidence from database operations, service logic in src/services/versions.ts, and tests all confirm lowercase usage without any uppercase variants. The includes() check is correct.

Likely an incorrect or invalid review comment.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jan 8, 2026

@riderx riderx merged commit 9499dd4 into main Jan 8, 2026
11 checks passed
@riderx riderx deleted the riderx/fix-bundle-email-spam branch January 8, 2026 21:07
Dalanir pushed a commit that referenced this pull request Jan 12, 2026
…1401)

When an app is created, two system bundles are automatically created:
"unknown" and "builtin". These were triggering email notifications to
users saying they uploaded a bundle, which is incorrect and confusing.

This fix skips both email and LogSnag notifications for these special
system bundle names while still allowing the last_version update.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
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