Repository navigation
[azure-core] Keep CaseInsensitiveSet consistent for in-place set operations - #49608
Open
Sebastian Turner (auraseb) wants to merge 1 commit into
Open
Sebastian Turner (auraseb) wants to merge 1 commit into
Sebastian Turner (auraseb) wants to merge 1 commit into
Conversation
Sebastian Turner (auraseb)
requested review from
iscai-msft,
Kashif Khan (kashifkhan) and
Jeff Fisher (xirzec)
as code owners
October 19, 2026 19:05
Contributor
|
Thank you for your contribution Sebastian Turner (@auraseb)! We will review the pull request and get back to you soon. |
|
Azure Pipelines: Successfully started running 3 pipeline(s). 5 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Self-subtraction raises during iteration and can leave allowlists only partially cleared.
1 open issue
What changed in this PR
Fixes #49607 by keeping CaseInsensitiveSet membership checks consistent with in-place mutations used by logging and tracing allowlists.
Changes:
- Routes in-place operators and update methods through cache-aware mutations.
- Adds utility and logging regression tests.
- Documents the fix in the changelog.
| File | Description |
|---|---|
sdk/core/azure-core/tests/test_utils.py |
Tests case-insensitive set mutations. |
sdk/core/azure-core/tests/test_http_logging_policy.py |
Tests header redaction after allowlist changes. |
sdk/core/azure-core/CHANGELOG.md |
Documents the allowlist fix. |
sdk/core/azure-core/azure/core/utils/_utils.py |
Adds cache-aware mutation overrides. |
Review effort: Balanced
|
|
||
| def difference_update(self, *others): | ||
| for other in others: | ||
| for item in other: |
…ations Signed-off-by: Sebastian Turner <sebastiant3484@gmail.com>
Sebastian Turner (auraseb)
force-pushed
the
fix/caseinsensitiveset-inplace-ops
branch
from
October 19, 2026 20:59
4aa6bd1 to
166f9f4
Compare
This branch has not been deployed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
CaseInsensitiveSet(used forHttpLoggingPolicy.allowed_header_namesand theallowed_query_paramssets ofHttpLoggingPolicyandDistributedTracingPolicy) subclassessetand answersinfrom a separate lowercase cache. The inherited|=,-=,&=,^=,difference_update,intersection_updateandsymmetric_difference_updatemodify the base set without updating that cache, sopolicy.allowed_header_names |= {"x-custom-header"}leaves the header redacted andpolicy.allowed_header_names -= {"x-ms-request-id"}leaves it logged. Both worked while these attributes were plain sets.This change overrides those methods so they go through
addanddiscard, which keep the cache in sync. Matching is case-insensitive, consistent with the existingdiscardandremove. The in-place operators returnNotImplementedfor non-set operands, matching the built-inset.Tests added in
tests/test_utils.pyfor each operation, and intests/test_http_logging_policy.pyfor the user-facing logging behavior. A CHANGELOG entry is added under Bugs Fixed.All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines
Fixes #49607