Skip to content

Add C# emitter regression coverage for model-level API version filtering - #11949

Open
JoshLove-msft with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-unexpected-versioning-behavior
Open

Add C# emitter regression coverage for model-level API version filtering#11949
JoshLove-msft with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-unexpected-versioning-behavior

Conversation

Copilot AI commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

The reported behavior emitted models marked @added(v2) when targeting v1, despite correctly excluding v2 properties. The current implementation already filters both correctly; this PR adds regression coverage without changing production code.

  • Version selection: Cover explicit v1/v2, latest, and default selection.
  • Availability: Assert model-level @added and @removed, alongside property-level @added.
  • Unreferenced models: Assign @usage so assertions exercise version filtering rather than omission of unused types.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label Sep 11, 2026
Copilot AI changed the title [WIP] Fix unexpected versioning behavior in http-client-csharp emitter Add C# emitter regression coverage for model-level API version filtering Sep 11, 2026
Copilot AI requested a review from JoshLove-msft September 11, 2026 23:42
@JoshLove-msft
JoshLove-msft marked this pull request as ready for review September 11, 2026 23:43
Copilot AI lite review requested due to automatic review settings September 11, 2026 23:43

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.

🔵 Needs a closer look

The undefined case does not exercise the shipped emitter’s default version selection.

Pull request overview

Adds C# emitter regression coverage for model- and property-level API version filtering without production changes.

Changes:

  • Tests explicit, latest, and default version selection.
  • Verifies model @added/@removed and property @added behavior.
  • Covers unreferenced models.
File summaries
File Description
packages/http-client-csharp/emitter/test/Unit/client-model-builder.test.ts Adds API-version filtering regression tests.
Review details

Suppressed comments (1)

packages/http-client-csharp/emitter/test/Unit/client-model-builder.test.ts:610

  • The undefined case does not exercise the emitter's default selection: this test calls createSdkContext directly, while the shipped emitter first runs resolveOptions (src/emitter.ts:50), where defaultOptions supplies api-version: "latest" (src/options.ts:168-191). As written, it tests TCGC with an explicitly undefined option rather than the C# emitter default; resolve the options or drive the emitter entrypoint for this case.
      const context = createEmitterContext(program, { "api-version": apiVersion });
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@pkg-pr-new

pkg-pr-new Bot commented Sep 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-csharp@11949

commit: 8e707f4

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

Labels

emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: unexpected versioning behavior in http-client-csharp emitter

3 participants