fix: Remove documentLoader property from FederationOptions interface#393
fix: Remove documentLoader property from FederationOptions interface#393dahlia merged 5 commits intofedify-dev:nextfrom
Conversation
There was a problem hiding this comment.
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
documentLoaderproperty has been removed from theFederationOptionsinterface, enforcing the use ofdocumentLoaderFactoryfor creating JSON-LD document loaders. - Codebase Migration: All internal usages and configurations, including the
cliandmiddlewarecomponents, have been updated to utilize thedocumentLoaderFactoryandcontextLoaderFactorypatterns, ensuring a consistent approach to document loading. - Test Suite Updates: The test suite for
middlewarehas been thoroughly updated to reflect the new loader factory API, including adjustments to mock behaviors, assertions, and removal of obsolete checks related to the deprecateddocumentLoader. - Guard Refactoring: The
federationImplrefactoring includes the removal ofdocumentLoader-related guards forallowPrivateAddressanduserAgentoptions, 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
-
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. ↩
There was a problem hiding this comment.
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.
dahlia
left a comment
There was a problem hiding this comment.
There are conflicts on the CHANGES.md. Could you rebase your commits on the current next branch?
9c6d276 to
c7f00af
Compare
|
rebase completed! |
|
The docs for this pull request have been published: |
|
The latest push to this pull request has been published to JSR and npm as a pre-release:
|
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