Skip to content

xds: ignore keep_empty_value and discard header keys on empty mutations#12852

Merged
kannanjgithub merged 3 commits into
grpc:masterfrom
kannanjgithub:empty_header_value_noop
Jun 22, 2026
Merged

xds: ignore keep_empty_value and discard header keys on empty mutations#12852
kannanjgithub merged 3 commits into
grpc:masterfrom
kannanjgithub:empty_header_value_noop

Conversation

@kannanjgithub

@kannanjgithub kannanjgithub commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

In GrpcService/ext_proc header mutations, we do not support the keep_empty_value field (grpc/proposal@f6d42d6). If any header mutation results in a header containing an empty value (either string or binary), we proceed with the empty value.

In GrpcService/ext_proc header mutations, we do not support the
`keep_empty_value` field (grpc/proposal@f6d42d6).
If any header mutation results in a header containing an empty value (either string or binary), the
entire header key is discarded/removed from the metadata.

This chang modifies HeaderMutator to apply mutations and discard keys containing empty values.
@kannanjgithub kannanjgithub requested a review from sauravzg June 10, 2026 05:28
@sauravzg

Copy link
Copy Markdown
Contributor

/gemini review

@sauravzg

Copy link
Copy Markdown
Contributor

/gemini-review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

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 refactors the header mutation logic in HeaderMutator.java to discard headers containing empty values, updating the corresponding test cases in HeaderMutatorTest.java to reflect this change. A review comment suggests that the newly added containsEmpty helper method is redundant and can be safely removed.

Comment thread xds/src/main/java/io/grpc/xds/internal/headermutations/HeaderMutator.java Outdated
Updates the HeaderMutator library to always apply mutations even if
the resulting value is empty, ignoring the keep_empty_value setting
altogether. Empty mutated values are now kept in the metadata and
the header key is no longer discarded.

- Removes containsEmpty check and helper from HeaderMutator.
- Updates HeaderMutatorTest to assert that empty mutations are kept.
@kannanjgithub

Copy link
Copy Markdown
Contributor Author

I'm retaining the empty value now (same as Envoy), not removing it.

@kannanjgithub kannanjgithub requested a review from sauravzg June 22, 2026 08:39
@kannanjgithub kannanjgithub reopened this Jun 22, 2026
@kannanjgithub kannanjgithub merged commit 293aa89 into grpc:master Jun 22, 2026
25 of 26 checks passed
@kannanjgithub kannanjgithub deleted the empty_header_value_noop branch June 22, 2026 09:43
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