FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

xds: Add header mutations library by sauravzg · Pull Request #12494 · grpc/grpc-java · GitHub

/ grpc-java Public

xds: Add header mutations library - #12494

Merged
kannanjgithub merged 12 commits into
grpc:masterfrom
sauravzg:feat/header-mutations
Apr 28, 2026
Merged

xds: Add header mutations library#12494
kannanjgithub merged 12 commits into
grpc:masterfrom
sauravzg:feat/header-mutations

Conversation

sauravzg commented Nov 11, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

This commit introduces a library for handling header mutations as specified by the xDS protocol. This library provides the core functionality for modifying request and response headers based on a set of rules.

The main components of this library are:

  • HeaderMutator: Applies header mutations to Metadata objects.
  • HeaderMutationFilter: Filters header mutations based on a set of configurable rules, such as disallowing mutations of system headers.
  • HeaderMutations: A value class that represents the set of mutations to be applied to request and response headers.
  • HeaderMutationDisallowedException: An exception that is thrown when a disallowed header mutation is attempted.

This commit also includes comprehensive unit tests for the new library.

sauravzg force-pushed the feat/header-mutations branch from 86d68ac to 759130e Compare March 12, 2026 13:46

Copy link
Copy Markdown
Contributor Author

@kannanjgithub PTAL, if the implementation mutation meets the spec for ext proc. You need to TAL at the last two commits only.
I'll eventually move it down the PR chain later to ensure that the dependencies for ext_proc are merged earlier.

sauravzg force-pushed the feat/header-mutations branch from 759130e to 4bfd5e6 Compare March 12, 2026 18:14
sauravzg changed the title feat(xds): Add header mutations library xds: Add header mutations library Mar 12, 2026
sauravzg force-pushed the feat/header-mutations branch from 4bfd5e6 to 6961989 Compare March 12, 2026 19:11

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sending comments for headermutations.

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Reviewed rest of the PR.

Copy link
Copy Markdown
Contributor Author

@kannanjgithub I've resolved or clarified the comments as applicable. PTAL

sauravzg force-pushed the feat/header-mutations branch 2 times, most recently from 90e5491 to efb725f Compare March 15, 2026 21:44

Copy link
Copy Markdown
Contributor Author

@kannanjgithub Addressed the comments. PTAL.

Copy link
Copy Markdown
Contributor Author

/gemini review

kannanjgithub requested a review from AgraVator March 17, 2026 06:04
sauravzg force-pushed the feat/header-mutations branch 2 times, most recently from 399e233 to 677b251 Compare March 17, 2026 08:40
sauravzg added a commit to sauravzg/grpc-java that referenced this pull request Apr 2, 2026
sauravzg force-pushed the feat/header-mutations branch from 9ec272a to 951b761 Compare April 2, 2026 11:58

Copy link
Copy Markdown
Contributor Author

/gemini review

gemini-code-assist Bot 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Code Review

This pull request introduces a CachedChannelManager to manage gRPC channels based on service configurations, alongside a new framework for processing xDS header mutations. The mutation framework includes components for filtering, applying, and validating header changes. Review feedback highlights the need to align the mutation order with the xDS specification, correct the logic for header allowance expressions, optimize performance by pre-calculating metadata keys, and improve error reporting with more descriptive exception messages.

sauravzg force-pushed the feat/header-mutations branch from 8d6cd46 to 312f166 Compare April 22, 2026 13:16

Copy link
Copy Markdown
Contributor Author

/gemini review - Please don't repeat previously addressed comments.

gemini-code-assist Bot 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Code Review

This pull request introduces a CachedChannelManager for managing gRPC channels and a framework for xDS header mutations, including filtering and application logic. Key feedback includes aligning the order of header operations in HeaderMutator with Envoy by processing removals before additions and caching Metadata.Key objects to optimize performance. Furthermore, the filtering logic in HeaderMutationFilter needs adjustment to ensure disallowed headers properly trigger exceptions when strict validation is active.

sauravzg force-pushed the feat/header-mutations branch from c7777c2 to 46c951d Compare April 22, 2026 14:10
sauravzg added 11 commits April 22, 2026 14:18
This commit introduces a library for handling header mutations as specified by the xDS protocol. This library provides the core functionality for modifying request and response headers based on a set of rules.

The main components of this library are:
- `HeaderMutator`: Applies header mutations to `Metadata` objects.
- `HeaderMutationFilter`: Filters header mutations based on a set of configurable rules, such as disallowing mutations of system headers.
- `HeaderMutations`: A value class that represents the set of mutations to be applied to request and response headers.
- `HeaderMutationDisallowedException`: An exception that is thrown when a disallowed header mutation is attempted.

This commit also includes comprehensive unit tests for the new library.
sauravzg force-pushed the feat/header-mutations branch from 46c951d to 9640f87 Compare April 22, 2026 14:27

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Some unit tests are missing.

Copy link
Copy Markdown
Contributor Author

Update since it's been 24 hours since comments: I am slightly caught up in other items and gemini is taking more babysitting in generating tests than I expected. So, I'll be able to update this sometime later tonight or early monday.

sauravzg requested a review from kannanjgithub April 27, 2026 13:55
kannanjgithub merged commit 3e276b0 into grpc:master Apr 28, 2026
15 of 17 checks passed
kannanjgithub pushed a commit to kannanjgithub/grpc-java that referenced this pull request May 4, 2026
This commit introduces a library for handling header mutations as
specified by the xDS protocol. This library provides the core
functionality for modifying request and response headers based on a set
of rules.

The main components of this library are:
- `HeaderMutator`: Applies header mutations to `Metadata` objects.
- `HeaderMutationFilter`: Filters header mutations based on a set of
configurable rules, such as disallowing mutations of system headers.
- `HeaderMutations`: A value class that represents the set of mutations
to be applied to request and response headers.
- `HeaderMutationDisallowedException`: An exception that is thrown when
a disallowed header mutation is attempted.

This commit also includes comprehensive unit tests for the new library.
sauravzg deleted the feat/header-mutations branch May 14, 2026 14:04
github-actions Bot locked as resolved and limited conversation to collaborators Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL