Skip to content

filter: clean up unnecessary redundancy - #46835

Merged
wbpcode merged 2 commits into
envoyproxy:mainfrom
wbpcode:dev-extra-context-scope
Aug 21, 2026
Merged

filter: clean up unnecessary redundancy#46835
wbpcode merged 2 commits into
envoyproxy:mainfrom
wbpcode:dev-extra-context-scope

Conversation

@wbpcode

@wbpcode wbpcode commented Aug 20, 2026

Copy link
Copy Markdown
Member

Commit Message: filter: clean up unnecessary redundancy
Additional Description:

Another step to unify all three types of HTTP filter factories (downstream, upstream, route).

No behavior changes, won’t break out-of-tree extensions and only a purely cleanup to reduce unnecessary redundancy.
We will finally migrate all our in-tree extensions to use the UnifiedFactoryBase, then we could gradually deprecate the redundant interfaces. (I made a huge commit locally that has proved it works perfectly, although need some changes to composite. This is first piece of that)

Risk Level: low
Testing: n/a.
Docs Changes: n/a.
Release Notes: n/a.
Platform Specific Features: n/a.

Signed-off-by: wbpcode <wbphub@gmail.com>
Comment thread envoy/server/filter_config.h Outdated
Signed-off-by: wbpcode <wbphub@gmail.com>
@wbpcode
wbpcode requested a lite review from Copilot August 20, 2026 15:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR continues the Envoy HTTP filter factory unification work by introducing a new UnifiedFactoryBase and migrating a set of in-tree HTTP filters away from redundant legacy factory entrypoints, using a richer ExtraFactoryContext to carry per-call state.

Changes:

  • Add Extensions::HttpFilters::Common::UnifiedFactoryBase to centralize downstream/upstream factory creation and validation via ExtraFactoryContext.
  • Extend Server::Configuration::ExtraFactoryContext (scope/init manager/is_upstream) and add isUnifiedFilter()/upstream createHttpFilterFactoryFromProto() hooks to differentiate unified vs legacy factories.
  • Migrate many HTTP filters from ExceptionFreeFactoryBase/DualFactoryBase to UnifiedFactoryBase and delete now-redundant delegating implementations; update a few call sites to use the new extra context plumbing.

Reviewed changes

Copilot reviewed 55 out of 55 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/extensions/filters/http/ext_authz/config_test.cc Updates test setup around validation visitor usage for unified factory path.
source/server/generic_factory_context.h Adjusts GenericFactoryContextImpl ctor(s) to accept optional scope/init manager via OptRef.
source/server/generic_factory_context.cc Updates ctor implementations and initManager() assertion for OptRef storage.
source/extensions/filters/http/common/factory_base.h Introduces UnifiedFactoryBase and uses ExtraFactoryContext::create(...) for unified entrypoints.
envoy/server/filter_config.h Extends ExtraFactoryContext and adds unified-filter differentiation (isUnifiedFilter) plus upstream createHttpFilterFactoryFromProto API.
source/extensions/filters/http/sse_to_metadata/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/sse_to_metadata/config.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/set_filter_state/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/set_filter_state/config.cc Removes redundant legacy factory implementation; uses ExtraFactoryContext for validation/scope/init manager when building GenericFactoryContextImpl.
source/extensions/filters/http/proto_message_extraction/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/proto_message_extraction/config.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/original_src/original_src_config_factory.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/original_src/original_src_config_factory.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/on_demand/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/on_demand/config.cc Deletes redundant delegating factory implementation; uses extra_context.visitor for validation.
source/extensions/filters/http/mcp/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/mcp/config.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/mcp_json_rest_bridge/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/mcp_json_rest_bridge/config.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/header_mutation/config.h Migrates dual filter factory to UnifiedFactoryBase and removes redundant dual factory entrypoint.
source/extensions/filters/http/header_mutation/config.cc Deletes redundant dual factory implementation.
source/extensions/filters/http/grpc_web/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/grpc_web/config.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/grpc_json_reverse_transcoder/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/grpc_json_reverse_transcoder/config.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/grpc_http1_reverse_bridge/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/grpc_http1_reverse_bridge/config.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/grpc_http1_bridge/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/grpc_http1_bridge/config.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/grpc_field_extraction/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/grpc_field_extraction/config.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/file_system_buffer/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/file_system_buffer/config.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/ext_authz/config.h Migrates to UnifiedFactoryBase and removes redundant legacy delegation.
source/extensions/filters/http/dynamic_forward_proxy/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/dynamic_forward_proxy/config.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/custom_response/factory.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/custom_response/factory.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/connect_grpc_bridge/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/connect_grpc_bridge/config.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/compressor/config.cc Updates GenericFactoryContextImpl construction to match new init-manager OptRef signature.
source/extensions/filters/http/cdn_loop/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/cdn_loop/config.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/cache/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/cache/config.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/cache_v2/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/cache_v2/config.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/buffer/config.h Migrates dual filter factory to UnifiedFactoryBase and removes redundant dual factory entrypoint.
source/extensions/filters/http/buffer/config.cc Deletes redundant dual factory implementation.
source/extensions/filters/http/body_size_limit/config.h Migrates dual filter factory to UnifiedFactoryBase and removes redundant dual factory entrypoint.
source/extensions/filters/http/body_size_limit/config.cc Deletes redundant dual factory implementation.
source/extensions/filters/http/alternate_protocols_cache/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/alternate_protocols_cache/config.cc Deletes redundant delegating factory implementation.
source/extensions/filters/http/a2a/config.h Migrates to UnifiedFactoryBase and removes redundant legacy factory override.
source/extensions/filters/http/a2a/config.cc Deletes redundant delegating factory implementation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread envoy/server/filter_config.h
Comment thread test/extensions/filters/http/ext_authz/config_test.cc
Comment thread source/extensions/filters/http/set_filter_state/config.cc

@ravenblackx ravenblackx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Love to approve PRs that are more deletion than addition. :)

}

/**
* @return bool true if this filter is a unified filter who implements

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
* @return bool true if this filter is a unified filter who implements
* @return bool true if this filter is a unified filter that implements

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If CI is happy, I will ignore this and update the grammar at follow up PRs. :)

@wbpcode

wbpcode commented Aug 21, 2026

Copy link
Copy Markdown
Member Author

/retest

@wbpcode
wbpcode merged commit d253226 into envoyproxy:main Aug 21, 2026
28 checks passed
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.

3 participants