Skip to content

fix: Remove contextLoader property from FederationOptions interface#445

Merged
dahlia merged 4 commits intofedify-dev:nextfrom
crohasang:feat-remove-contextloader
Sep 29, 2025
Merged

fix: Remove contextLoader property from FederationOptions interface#445
dahlia merged 4 commits intofedify-dev:nextfrom
crohasang:feat-remove-contextloader

Conversation

@crohasang
Copy link
Contributor

@crohasang crohasang commented Sep 25, 2025

Summary

Remove contextLoader property from FederationOptions interface (use contextLoaderFactory instead)

Related Issue

Changes

  • In fedify/src/federation/federation.ts, removed contextLoader property.

  • In fedify/src/federation/middleware.ts:

    • Removed deprecated contextLoader option handling and related warning messages from FederationImpl constructor
    • Added validation to require documentLoaderFactory and contextLoaderFactory when allowPrivateAddress or userAgent options are used
    • Simplified property initialization by using direct assignment this.contextLoaderFactory = options.contextLoaderFactory ?? this.documentLoaderFactory instead of complex conditional logic
    • Updated error messages to reference contextLoaderFactory instead of the old contextLoader option name
  • In fedify/src/federation/middleware.test.ts, updated test cases to use contextLoaderFactory instead of deprecated contextLoader option.

Additional Notes

  • Ran 'deno task test-all' and 'deno task check-all', all checks and tests passed.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @crohasang, 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 refines the FederationOptions interface by removing the deprecated contextLoader property, standardizing on contextLoaderFactory for improved flexibility and maintainability. It also enhances security by adding validation to prevent the use of custom document/context loaders when allowPrivateAddress or userAgent options are enabled, streamlining the API and improving the robustness of the federation implementation.

Highlights

  • Deprecated contextLoader removal: The contextLoader property has been removed from the FederationOptions interface, as it was deprecated in favor of contextLoaderFactory.
  • middleware.ts logic update: The FederationImpl constructor in middleware.ts no longer handles the deprecated contextLoader option, removing associated warning messages and simplifying property initialization.
  • Validation for allowPrivateAddress and userAgent: New validation ensures that documentLoaderFactory and contextLoaderFactory are not set when allowPrivateAddress or userAgent options are used, preventing potential security issues.
  • Test case updates: All relevant test cases in middleware.test.ts have been updated to utilize the contextLoaderFactory instead of the removed contextLoader option.
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 activitypub/compliance Specification compliance breaking change Breaking change component/federation Federation object related labels Sep 25, 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 effectively removes the deprecated contextLoader property and updates its usage to contextLoaderFactory. The changes are clean and consistent across the codebase, including the necessary updates to tests and documentation. The improved validation logic in middleware.ts is a welcome enhancement. I've added a couple of minor suggestions to further improve code maintainability and formatting.

@github-actions
Copy link
Contributor

The latest push to this pull request has been published to JSR and npm as a pre-release:

Package Version JSR npm
@fedify/fedify 2.0.0-pr.445.1694+d0c7cd75 JSR npm
@fedify/cli 2.0.0-pr.445.1694+d0c7cd75 JSR
@fedify/amqp 2.0.0-pr.445.1694+d0c7cd75 JSR npm
@fedify/cfworkers 2.0.0-pr.445.1694+d0c7cd75 JSR npm
@fedify/denokv 2.0.0-pr.445.1694+d0c7cd75 JSR
@fedify/elysia 2.0.0-pr.445.1694+d0c7cd75 npm
@fedify/express 2.0.0-pr.445.1694+d0c7cd75 JSR npm
@fedify/h3 2.0.0-pr.445.1694+d0c7cd75 JSR npm
@fedify/hono 2.0.0-pr.445.1694+d0c7cd75 JSR npm
@fedify/nestjs 2.0.0-pr.445.1694+d0c7cd75 npm
@fedify/next 2.0.0-pr.445.1694+d0c7cd75 npm
@fedify/postgres 2.0.0-pr.445.1694+d0c7cd75 JSR npm
@fedify/redis 2.0.0-pr.445.1694+d0c7cd75 JSR npm
@fedify/sqlite 2.0.0-pr.445.1694+d0c7cd75 JSR npm
@fedify/sveltekit 2.0.0-pr.445.1694+d0c7cd75 JSR npm
@fedify/testing 2.0.0-pr.445.1694+d0c7cd75 JSR npm

@github-actions
Copy link
Contributor

The docs for this pull request have been published:

https://a1756941.fedify.pages.dev

@dahlia dahlia added this to the Fedify 2.0 milestone Sep 26, 2025
Copy link
Member

@dahlia dahlia left a comment

Choose a reason for hiding this comment

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

Great!

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

Labels

activitypub/compliance Specification compliance breaking change Breaking change component/federation Federation object related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants