Skip to content

Conversation

@zmofei
Copy link
Member

@zmofei zmofei commented Sep 10, 2025

This pull request refactors the PolicyPipeline API in src/utils/fetchRequest.ts to improve clarity and flexibility when managing fetch policies. The main changes include renaming the method for adding policies, introducing new methods for removing and listing policies, and updating usages to match the new method names. Additionally, the pipeline instance is now exported for broader access.

API improvements for policy management:

  • Renamed the method for adding policies from use to usePolicy in the PolicyPipeline class to make its purpose clearer.
  • Added removePolicy and listPolicies methods to PolicyPipeline to allow for easier modification and inspection of the pipeline's policies.

Usage and export updates:

  • Updated all calls to use the new usePolicy method instead of the old use method.
  • Exported the pipeline instance as systemFetchPipeline for use elsewhere in the codebase.

@zmofei zmofei marked this pull request as ready for review September 10, 2025 10:43
@zmofei zmofei requested a review from a team as a code owner September 10, 2025 10:43
Base automatically changed from feat/mcp-vitest-tshy to main September 10, 2025 13:26
this.policies.push(policy);
}

removePolicy(policy: FetchPolicy) {
Copy link
Contributor

Choose a reason for hiding this comment

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

you could have a polymorphic string | FetchPolicy as a parameter for remove, but having two methods is ok

@zmofei zmofei closed this Sep 10, 2025
@zmofei zmofei force-pushed the improve_fetch_request branch from 622fb34 to b1f2566 Compare September 10, 2025 14:00
@zmofei zmofei reopened this Sep 10, 2025
@zmofei zmofei merged commit cc1be9d into main Sep 10, 2025
1 check passed
@zmofei zmofei deleted the improve_fetch_request branch September 10, 2025 14:18
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