Skip to content

Conversation

Copy link

Copilot AI commented Jan 8, 2026

Summary

Implements backend validation to prevent public channel conflicts: maximum 3 public channels per app, and only one public channel per platform (iOS/Android/Electron). Users can now have either one universal default channel OR up to three platform-specific channels without ambiguity.

Implementation:

  • Validation logic (utils/supabase.ts): validatePublicChannels() runs pre-upsert, checks channel count and platform uniqueness, throws typed errors (max_public_channels, duplicate_platform_{ios|android|electron})
  • Channel API (public/channel/post.ts): Added electron field support to match iOS/Android pattern
  • Test coverage (channel_default_validation.test.ts): Valid configs (single multi-platform, three single-platform, mixed), invalid configs (4+ channels, platform duplicates), update scenarios
  • Documentation (docs/DEFAULT_CHANNEL_VALIDATION.md): Rules reference, error messages, migration guidance

Example validation:

// ✓ Valid: One universal channel
{ public: true, ios: true, android: true, electron: true }

// ✓ Valid: Three platform-specific
[
  { public: true, ios: true, android: false, electron: false },
  { public: true, ios: false, android: true, electron: false },
  { public: true, ios: false, android: false, electron: true }
]

// ✗ Invalid: Duplicate iOS in public channels
[
  { public: true, ios: true, ... },
  { public: true, ios: true, ... }  // throws duplicate_platform_ios
]

Private channels unaffected. Validation uses final channel state (merges update with existing values).

Test plan

  1. Run bun test:backend to verify validation test suite
  2. Create app with 3 public channels (different platforms) → succeeds
  3. Attempt 4th public channel → receives max_public_channels error
  4. Create 2 public channels with same platform → receives duplicate_platform_* error
  5. Update existing public channel to conflict → validation prevents

Screenshots

N/A - Backend validation only

Checklist

  • My code follows the code style of this project and passes bun run lint:backend && bun run lint.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • My change has adequate E2E test coverage.
  • I have tested my code manually, and I have provided steps how to reproduce my tests

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Jan 8, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 8, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

Copy link
Author

Copilot AI commented Jan 8, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 127.0.0.11
    • Triggering command: REDACTED, pid is -1 (packet block)
  • https://api.github.com/repos/supabase/cli/releases/latest
    • Triggering command: /home/REDACTED/.npm/_npx/aa8e5c70f9d8d161/node_modules/.bin/supabase supabase --version (http block)
  • npm.jsr.io
    • Triggering command: /usr/local/bin/node node /usr/local/bin/npm install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add Electron platform support for channels feat: enforce default channel validation (max 3, one per platform) Jan 8, 2026
Copilot AI requested a review from riderx January 8, 2026 04:26
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2026

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.

2 participants