Skip to content

fix(java): isolate special-header exclusions per code-model build - #12515

Open
Weidong Xu (weidongxu-microsoft) wants to merge 2 commits into
microsoft:mainfrom
weidongxu-microsoft:fix/java-special-header-isolation
Open

Weidong Xu (weidongxu-microsoft) wants to merge 2 commits into
microsoft:mainfrom
weidongxu-microsoft:fix/java-special-header-isolation

Conversation

@weidongxu-microsoft

@weidongxu-microsoft Weidong Xu (weidongxu-microsoft) commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Keep skip-special-headers exclusions local to each code-model builder. Removing the option now restores header parameters on subsequent compilations in the same process, while built-in special headers remain excluded.

Addresses the builder-state leak reported in Azure/typespec-azure#5988.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 526da12f-9fd4-4446-ab7f-46e72cc328cf
Copilot AI balanced review requested due to automatic review settings November 7, 2026 06:50
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:java Issue for the Java client emitter: @typespec/http-client-java label Nov 7, 2026

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.

🟢 Approval recommended

No active review issues remain for the change isolating special-header exclusions per builder.

No open issues 🎉

What changed in this PR

Fixes state leakage in the Java emitter by keeping configured special-header exclusions local to each code-model builder. Subsequent compilations restore header parameters when the option is removed, while built-in exclusions remain intact.

Changes:

  • Copies built-in special headers into a per-builder set.
  • Adds regression coverage for consecutive builds with configured, omitted, and empty exclusions.
  • Adds a fix changelog entry.
File Description
packages/​http-client-java/​emitter/​test/​fixtures/​special-headers.tsp Defines custom and built-in special headers for regression testing.
packages/​http-client-java/​emitter/​test/​code-model.test.ts Verifies exclusions remain isolated across consecutive builds.
packages/​http-client-java/​emitter/​src/​code-model-builder.ts Replaces shared-set mutation with per-builder header exclusions.
.chronus/​changes/​http-client-java-special-header-isolation.md Documents the header-exclusion isolation fix.

Review effort: Balanced

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • ✅ @typespec/http-client-java
Show changes

@typespec/http-client-java - fix ✏️

Keep skip-special-headers exclusions local to each code-model build so removing the option restores header parameters on subsequent compilations.

@azure-sdk-automation

azure-sdk-automation Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 526da12f-9fd4-4446-ab7f-46e72cc328cf
Copilot AI balanced review requested due to automatic review settings November 7, 2026 07:21

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.

🟡 Changes recommended

A regression test is missing to guard against cross-build leakage of custom header exclusions while confirming built-in special headers remain excluded.

1 open issue

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:java Issue for the Java client emitter: @typespec/http-client-java

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants