Skip to content

fix: Remove documentLoader property from FederationOptions interface#393

Merged
dahlia merged 5 commits intofedify-dev:nextfrom
crohasang:feat-remove-api
Sep 3, 2025
Merged

fix: Remove documentLoader property from FederationOptions interface#393
dahlia merged 5 commits intofedify-dev:nextfrom
crohasang:feat-remove-api

Conversation

@crohasang
Copy link
Contributor

@crohasang crohasang commented Aug 30, 2025

Summary

Remove documentLoader property from FederationOptions interface (use documentLoaderFactory instead)

Related Issue

Changes

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

  • In cli/src/inbox.tsx, switched the inbox command to the loader factory API by replacing the deprecated documentLoader with documentLoaderFactory/contextLoaderFactory and reusing a single instance from getDocumentLoader(), with no functional changes.

  • In fedify/src/federation/middleware.ts, refactored federationImpl to replace the deprecated documentLoader with documentLoaderFactory, drop the documentLoader-related allowPrivateAddress/userAgent guard, and route loader creation through factories with no intended behavior change.

  • In fedify/src/federation/middleware.test.ts, migrated tests to the loader factory API (documentLoaderFactory), removed the obsolete allowPrivateAddress+documentLoader assertion, fixed ctx.documentLoader expectations, split mocks (/auth-check vs /object) to avoid URL collisions, and used a rejecting loader in the first context to ensure null on lookup.

  • Updated versions in deno.json and package.json from 1.9.0 to 2.0.0.

Additional Notes

  • Ran 'deno task test', all checks and tests passed.
  • When I tried to run 'deno task test', I removed the '--doc' option in deno.json because an error occurred in next/README.md.

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.

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 focuses on cleaning up the API by removing a deprecated property and migrating all relevant code to use the recommended factory pattern for creating document loaders. This change improves the consistency and maintainability of the codebase, preparing it for future enhancements in how external documents are handled, without introducing any functional changes to the application's behavior.

Highlights

  • API Modernization: The deprecated documentLoader property has been removed from the FederationOptions interface, enforcing the use of documentLoaderFactory for creating JSON-LD document loaders.
  • Codebase Migration: All internal usages and configurations, including the cli and middleware components, have been updated to utilize the documentLoaderFactory and contextLoaderFactory patterns, ensuring a consistent approach to document loading.
  • Test Suite Updates: The test suite for middleware has been thoroughly updated to reflect the new loader factory API, including adjustments to mock behaviors, assertions, and removal of obsolete checks related to the deprecated documentLoader.
  • Guard Refactoring: The federationImpl refactoring includes the removal of documentLoader-related guards for allowPrivateAddress and userAgent options, streamlining the initialization logic.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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.

@github-actions github-actions bot added breaking change Breaking change component/cli CLI tools related priority/high High priority issues type/refactor Code refactoring labels Aug 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 effectively removes the deprecated documentLoader property from the FederationOptions interface and refactors all its usages to the documentLoaderFactory API. The changes are consistent across the codebase, including updates to the CLI, core federation logic, and tests. The test suite has been properly migrated to reflect these changes. My only feedback is a minor formatting suggestion for the CHANGES.md file to improve its readability.

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.

There are conflicts on the CHANGES.md. Could you rebase your commits on the current next branch?

@crohasang
Copy link
Contributor Author

rebase completed!

@github-actions
Copy link
Contributor

github-actions bot commented Aug 31, 2025

The docs for this pull request have been published:

https://afe683c9.fedify.pages.dev

@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2025

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.393.1513+eed3f9a5 JSR npm
@fedify/cli 2.0.0-pr.393.1513+eed3f9a5 JSR
@fedify/amqp 2.0.0-pr.393.1513+eed3f9a5 JSR npm
@fedify/cfworkers 2.0.0-pr.393.1513+eed3f9a5 JSR npm
@fedify/denokv 2.0.0-pr.393.1513+eed3f9a5 JSR
@fedify/elysia 2.0.0-pr.393.1513+eed3f9a5 npm
@fedify/express 2.0.0-pr.393.1513+eed3f9a5 JSR npm
@fedify/h3 2.0.0-pr.393.1513+eed3f9a5 JSR npm
@fedify/hono 2.0.0-pr.393.1513+eed3f9a5 JSR npm
@fedify/nestjs 2.0.0-pr.393.1513+eed3f9a5 npm
@fedify/next 2.0.0-pr.393.1513+eed3f9a5 npm
@fedify/postgres 2.0.0-pr.393.1513+eed3f9a5 JSR npm
@fedify/redis 2.0.0-pr.393.1513+eed3f9a5 JSR npm
@fedify/sqlite 2.0.0-pr.393.1513+eed3f9a5 JSR npm
@fedify/sveltekit 2.0.0-pr.393.1513+eed3f9a5 JSR npm
@fedify/testing 2.0.0-pr.393.1513+eed3f9a5 JSR npm

@dahlia dahlia merged commit 3d4a040 into fedify-dev:next Sep 3, 2025
10 checks passed
@dahlia dahlia mentioned this pull request Sep 3, 2025
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Breaking change component/cli CLI tools related priority/high High priority issues type/refactor Code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants