-
Notifications
You must be signed in to change notification settings - Fork 68
Fix TCGC regression with @clientOption negation scope filtering #3885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…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>
commit: |
tadelesh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Resolve comment.
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
Co-authored-by: tadelesh <1726438+tadelesh@users.noreply.github.com>
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:
If you need me to access, download, or install something from one of these locations, you can either:
|
- [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>
getDecoratorsInfoininternal-utils.tsdoesn't handle negation scope patterns like!pythonor!(java, python)/packages/typespec-client-generator-core/src/internal-utils.tsparseScopesandisScopeApplicablehelper functions to properly handle negation scopesclient-option.test.ts(6 new tests)parseScopesfunction (moved from decorators.ts to internal-utils.ts and exported)Summary
@clientOptiondecorator (and other decorators using scope filtering ingetDecoratorsInfo) did not properly handle negation scope patternsparseScopesfunction by moving it tointernal-utils.tsand exporting it for use bydecorators.tsOriginal prompt
@clientOption#3884💡 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.