Skip to content

Remove head-as-boolean emitter flag (superseded by TCGC @responseAsBool)#3986

Merged
JialinHuang803 merged 5 commits into
mainfrom
copilot/remove-head-as-boolean-flag
May 28, 2026
Merged

Remove head-as-boolean emitter flag (superseded by TCGC @responseAsBool)#3986
JialinHuang803 merged 5 commits into
mainfrom
copilot/remove-head-as-boolean-flag

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

The emitter flag head-as-boolean duplicates functionality now provided by TCGC's @responseAsBool decorator, which promotes the operation's response type to boolean directly. The flag is removed in favor of the decorator-based approach.

Changes

  • src/lib.ts — Remove "head-as-boolean" from EmitterOptions interface and RLCOptionsSchema
  • src/transform/transfromRLCOptions.ts — Remove headAsBoolean extraction and propagation
  • src/modular/helpers/operationHelpers.ts:
    • isHeadAsBooleanOperation: drop context parameter and the legacy context.rlcOptions?.headAsBoolean fallback; now solely relies on TCGC's response.type.kind === "boolean" signal
    • buildNonModelResponseTypeDeclaration: remove dead code branch that handled void-HEAD with the emitter flag
  • test/util/emitUtil.ts — Remove both head-as-booleanheadAsBoolean forwarding blocks
  • test/modularUnit/scenarios/operations/wrapNonModelReturn.md — Remove 3 scenarios that drove behavior via head-as-boolean: true (covered by headResponseAsBool.md using @responseAsBool); strip head-as-boolean: false from remaining HEAD scenarios

Migration

Replace emitter option with the TCGC decorator on the operation:

-# tspconfig.yaml
-options:
-  "@azure-tools/typespec-ts":
-    head-as-boolean: true

+// main.tsp
+@Azure.ClientGenerator.Core.responseAsBool
 @head
 op checkExistence(@path name: string): void;

Copilot AI changed the title [WIP] Remove head-as-boolean flag and update related UT case Remove head-as-boolean emitter flag (superseded by TCGC @responseAsBool) May 19, 2026
Copilot AI requested a review from v-jiaodi May 19, 2026 06:29
@v-jiaodi v-jiaodi marked this pull request as ready for review May 19, 2026 07:24
@qiaozha qiaozha added P1 priority 1 HRLC labels May 20, 2026
@v-jiaodi
Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 27, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in 132b461. The only conflict was in wrapNonModelReturn.md — main had re-added the head-as-boolean: true test scenarios (with updated terminology). Since this PR removes that flag entirely, I kept our version (those scenarios dropped). Build passes cleanly.

@JialinHuang803
Copy link
Copy Markdown
Member

packages/typespec-ts/src/rlc-common/interfaces.ts:270-276 still defines headAsBoolean?: boolean;, could you delete it as well?

// For HEAD + @responseAsBool / head-as-boolean, 404 is a valid "false" response.
// For HEAD + @responseAsBool, 404 is a valid "false" response.
if (
context &&
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since isHeadAsBooleanOperation no longer uses context, the context && guard can be removed.

@v-jiaodi
Copy link
Copy Markdown
Member

@copilot apply all comments.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 28, 2026

@copilot apply all comments.

Done in 78bd8f9:

  • Removed headAsBoolean?: boolean from packages/typespec-ts/src/rlc-common/interfaces.ts
  • Removed the context && guard from getExpectedStatuses (also dropped the now-unused context?: SdkContext parameter from its signature and updated its call sites)

@JialinHuang803 JialinHuang803 enabled auto-merge (squash) May 28, 2026 08:13
@JialinHuang803 JialinHuang803 merged commit c5d1285 into main May 28, 2026
16 checks passed
@JialinHuang803 JialinHuang803 deleted the copilot/remove-head-as-boolean-flag branch May 28, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

HRLC P1 priority 1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Emitter head-as-boolean duplicate with TCGC @responseAsBool

4 participants