Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

  • Understand the issue: The filtering logic in getDecoratorsInfo in internal-utils.ts doesn't handle negation scope patterns like !python or !(java, python)
  • Identify the fix location: Line 406-411 in /packages/typespec-client-generator-core/src/internal-utils.ts
  • Implement fix: Added parseScopes and isScopeApplicable helper functions to properly handle negation scopes
  • Add tests for negation scope filtering in client-option.test.ts (6 new tests)
  • Run tests to verify the fix (418 tests pass)
  • Run code review and address feedback
  • Consolidate duplicate parseScopes function (moved from decorators.ts to internal-utils.ts and exported)
  • Add changelog entry

Summary

  • Fixed a regression where the @clientOption decorator (and other decorators using scope filtering in getDecoratorsInfo) did not properly handle negation scope patterns
  • Consolidated the duplicate parseScopes function by moving it to internal-utils.ts and exporting it for use by decorators.ts
Original prompt

This section details on the original issue you should resolve

<issue_title>[TCGC] Regression with @clientOption</issue_title>
<issue_description>In this PR, there is a change to filter decorators on types decorators list. It only considered the positive scope case, but fail with negation scope case. For case @clientName("XXX", "!python"), the new added logic will cause regression. The filter should work for negation scope cases.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 4, 2026 05:28
…egression

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix regression with @clientOption for negation scope Fix TCGC regression with @clientOption negation scope filtering Feb 4, 2026
Copilot AI requested a review from tadelesh February 4, 2026 05:37
@tadelesh tadelesh marked this pull request as ready for review February 4, 2026 06:39
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 4, 2026

Open in StackBlitz

npm i https://pkg.pr.new/Azure/typespec-azure/@azure-tools/typespec-client-generator-core@3885

commit: 2e2deee

Copy link
Member

@tadelesh tadelesh left a comment

Choose a reason for hiding this comment

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

@copilot Resolve comment.

@azure-sdk
Copy link
Collaborator

All changed packages have been documented.

  • @azure-tools/typespec-client-generator-core
Show changes

@azure-tools/typespec-client-generator-core - fix ✏️

Fix regression with @clientoption negation scope handling. Decorators using negation scope patterns like '!python' or '!(java, python)' are now correctly filtered.

@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website

Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 4, 2026

@copilot Resolve comment.

Done in 2e2deee.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • telemetry.astro.build
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/typespec-azure/typespec-azure/website/node_modules/.bin/../astro/astro.js build sh ore/node_modules/.bin/../@typespec/tspd/cmd/tspd.js astro check --mi--llmstxt node n/node xtern-signature sh ture tobuf/reference node c-cl�� ../../website/src/content/docs/docs/libraries/sse/reference . _modules/pnpm/dist/node-gyp-bin/node --import y-linter nerator-core/reftspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/libraries/azure-portal-core/reference node (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from tadelesh February 4, 2026 06:56
@iscai-msft iscai-msft added this pull request to the merge queue Feb 4, 2026
Merged via the queue into main with commit a1066a8 Feb 4, 2026
23 checks passed
@iscai-msft iscai-msft deleted the copilot/fix-clientoption-regression branch February 4, 2026 19:50
@microsoft-github-policy-service microsoft-github-policy-service bot added the lib:tcgc Issues for @azure-tools/typespec-client-generator-core library label Feb 4, 2026
iscai-msft pushed a commit that referenced this pull request Feb 4, 2026
- [x] Understand the issue: The filtering logic in `getDecoratorsInfo`
in `internal-utils.ts` doesn't handle negation scope patterns like
`!python` or `!(java, python)`
- [x] Identify the fix location: Line 406-411 in
`/packages/typespec-client-generator-core/src/internal-utils.ts`
- [x] Implement fix: Added `parseScopes` and `isScopeApplicable` helper
functions to properly handle negation scopes
- [x] Add tests for negation scope filtering in `client-option.test.ts`
(6 new tests)
- [x] Run tests to verify the fix (418 tests pass)
- [x] Run code review and address feedback
- [x] Consolidate duplicate `parseScopes` function (moved from
decorators.ts to internal-utils.ts and exported)
- [x] Add changelog entry

## Summary
- Fixed a regression where the `@clientOption` decorator (and other
decorators using scope filtering in `getDecoratorsInfo`) did not
properly handle negation scope patterns
- Consolidated the duplicate `parseScopes` function by moving it to
`internal-utils.ts` and exporting it for use by `decorators.ts`

<!-- START COPILOT ORIGINAL PROMPT -->

<details>

<summary>Original prompt</summary>

>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>[TCGC] Regression with `@clientOption`</issue_title>
> <issue_description>In this
[PR](https://github.com/Azure/typespec-azure/pull/3827/changes#diff-dd3c82fa034f20c8652ade787a9bbabaaa7c406606105be69450f43618961fa2),
there is a change to filter decorators on types decorators list. It only
considered the positive scope case, but fail with negation scope case.
For case `@clientName("XXX", "!python")`, the new added logic will cause
regression. The filter should work for negation scope
cases.</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>

</details>

<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes #3884

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib:tcgc Issues for @azure-tools/typespec-client-generator-core library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TCGC] Regression with @clientOption

5 participants