Skip to content

Conversation

@sij411
Copy link
Contributor

@sij411 sij411 commented Dec 30, 2025

Summary

Makes subscriptionHandler a required option in the relay package instead of optional.

Rationale

The previous design had a critical flaw: when subscriptionHandler was omitted, the relay would default to rejecting all subscription requests. This created a confusing situation where:

  • Relays appeared to start and run successfully
  • Users would receive no error messages
  • All subscription attempts would silently fail

This made debugging very difficult, as there was no indication that the relay was non-functional.

Breaking Changes

  • RelayOptions.subscriptionHandler is now required (not optional)
  • All relay creations must include a subscriptionHandler

Users must now explicitly define their subscription policy:

  • For open relays: subscriptionHandler: async () => true
  • For restricted relays: implement custom approval logic

This forces users to consciously decide on their relay's access control policy and prevents silent failures.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @sij411, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness and clarity of the relay package by making the subscriptionHandler a required configuration option. This change eliminates a previous design flaw where relays would silently fail to process subscription requests if no handler was provided, leading to confusing and hard-to-debug behavior. By enforcing an explicit subscription policy, the system ensures that relay operators are always aware of and define how their relays manage incoming subscriptions, preventing unexpected rejections and improving overall system predictability.

Highlights

  • Required subscriptionHandler: The subscriptionHandler option in the relay package is now mandatory, ensuring that all relay creations explicitly define their subscription approval logic.
  • Preventing Silent Failures: This change addresses a critical flaw where omitting the subscriptionHandler would lead to silent rejections of all subscription requests, making debugging difficult.
  • Explicit Policy Definition: Users are now forced to consciously decide on their relay's access control policy, either by providing an open handler (async () => true) or implementing custom approval logic.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@issues-auto-labeler issues-auto-labeler bot added breaking change Breaking change component/federation Federation object related component/relay Relay related (@fedify/relay) difficulty/intermediate Intermediate level labels Dec 30, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request makes the subscriptionHandler a required configuration option for relay servers. The changes include updating the RelayOptions interface to mark subscriptionHandler as mandatory, modifying the LitePubRelay and MastodonRelay implementations to directly invoke the handler without an optional check, and updating all test cases to provide a default subscriptionHandler that always approves subscriptions. The README.md documentation has also been revised to reflect this new requirement, provide examples for open relays and custom logic, and include a link to the comprehensive manual, alongside a minor formatting correction.

sij411 and others added 2 commits December 30, 2025 17:52
The subscriptionHandler option is now required instead of optional.
This prevents the confusing situation where relays appear to work
but silently reject all subscriptions.

Users must now explicitly define their subscription policy:
- For open relays: `subscriptionHandler: async () => true`
- For restricted relays: implement custom approval logic

Breaking changes:
- RelayOptions.subscriptionHandler is now required (not optional)
- All relay creations must include a subscriptionHandler

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

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
The example code in the JSDoc comment was missing the now-required
subscriptionHandler option, causing TypeScript compilation to fail.

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

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Files with missing lines Coverage Δ
packages/relay/src/factory.ts 100.00% <ø> (ø)
packages/relay/src/litepub.ts 85.24% <100.00%> (-0.12%) ⬇️
packages/relay/src/mastodon.ts 68.05% <100.00%> (-0.44%) ⬇️
packages/relay/src/types.ts 90.00% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dahlia dahlia merged commit c066f02 into fedify-dev:next Dec 30, 2025
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Breaking change component/federation Federation object related component/relay Relay related (@fedify/relay) difficulty/intermediate Intermediate level

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants