Create source-only filter package#15638
Conversation
src/Microsoft.TestPlatform.Filter.Source/Microsoft.TestPlatform.Filter.Source.csproj
Outdated
Show resolved
Hide resolved
src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj
Show resolved
Hide resolved
…m.Filter.Source.csproj Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj
Show resolved
Hide resolved
src/Microsoft.TestPlatform.Filter.Source/Microsoft.TestPlatform.Filter.Source.nuspec
Outdated
Show resolved
Hide resolved
src/Microsoft.TestPlatform.Filter.Source/Microsoft.TestPlatform.Filter.Source.csproj
Show resolved
Hide resolved
src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj
Show resolved
Hide resolved
|
@copilot Create a new test project for the new package. You MUST:
|
|
@Youssef1313 I've opened a new pull request, #15641, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@nohwnd Would you like to change all namespaces in the source-only package? |
|
@copilot Please review this PR and add a comment with your findings. During review, ensure that all classes in the new package are internal and have embedded attribute (except when under |
|
Looks good. Consider adding integration test to Library.IntegrationTests that uses the package to ensure it works. |
|
@copilot add an integration test in Microsoft.TestPlatform.Library.IntegrationTests for this package. |
1 similar comment
|
@copilot add an integration test in Microsoft.TestPlatform.Library.IntegrationTests for this package. |
|
@copilot Add an integration test in Microsoft.TestPlatform.Library.IntegrationTests for this package. |
….IntegrationTests (#15652) * Initial plan for Filter.Source integration tests Agent-Logs-Url: https://github.com/microsoft/vstest/sessions/cd54345b-ac28-4df2-a11c-bf97609df345 Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com> * Add FilterSource integration tests in Library.IntegrationTests Agent-Logs-Url: https://github.com/microsoft/vstest/sessions/cd54345b-ac28-4df2-a11c-bf97609df345 Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com> * Revert accidental file mode change on eng/common/tools.sh Agent-Logs-Url: https://github.com/microsoft/vstest/sessions/bd76cc82-b18d-4caa-949e-331115ede2e7 Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com> * Replace unit-test-style tests with proper integration tests using FilterSourcePackageConsumerTests test asset Agent-Logs-Url: https://github.com/microsoft/vstest/sessions/0622e862-cf7d-4c75-a624-3ebe024133b3 Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com> * Fix: revert file mode change on eng/common/tools.sh back to 100644 Agent-Logs-Url: https://github.com/microsoft/vstest/sessions/0622e862-cf7d-4c75-a624-3ebe024133b3 Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com> * Update FilterSourceIntegrationTests.cs --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com> Co-authored-by: Youssef Victor <youssefvictor00@gmail.com>
Youssef1313
left a comment
There was a problem hiding this comment.
@copilot Please add explicit #nullable enable in all files in C# code files in Microsoft.TestPlatform.Filter.Source.
* chore: add #nullable enable to all Filter.Source files Agent-Logs-Url: https://github.com/microsoft/vstest/sessions/c13b276b-99f8-454e-b5a6-491000a14200 Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com> * chore: add #nullable enable to all Filter.Source C# files Agent-Logs-Url: https://github.com/microsoft/vstest/sessions/c13b276b-99f8-454e-b5a6-491000a14200 Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Youssef1313 <31348972+Youssef1313@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 24 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (4)
src/Microsoft.TestPlatform.Filter.Source/FilterExpressionWrapper.cs:58
- In the
!IS_VSTEST_REPObuild (i.e., when this code is embedded via the source-only package), the constructor does not validatefilterStringat all. In-repo it throws for null/empty viaValidateArg.NotNullOrEmpty, but out-of-repo it may fail later with less clear exceptions. Consider adding equivalentArgumentNullException/ArgumentExceptionvalidation in theelsepath to keep behavior consistent.
src/Microsoft.TestPlatform.Filter.Source/FilterExpressionWrapper.cs:159 - In the
!IS_VSTEST_REPObuild,Evaluatedoes not checkpropertyValueProviderfor null (the in-repo build does). If a consumer passes null, this will likely throw aNullReferenceExceptiondeeper in evaluation. Consider validating the delegate in the non-repo path too to provide a clearArgumentNullExceptionand keep behavior consistent.
src/Microsoft.TestPlatform.Filter.Source/TestCaseFilterExpression.cs:90 - In the
!IS_VSTEST_REPObuild,MatchTestCasedoesn’t validatepropertyValueProviderfor null, while the in-repo implementation does. Adding anArgumentNullExceptioncheck in the non-repo path would avoid null-derefs and keep behavior consistent between the in-repo and source-only-package builds.
src/Microsoft.TestPlatform.Filter.Source/FilterHelper.cs:40 - The XML doc for
Escapelists%as a character that will be escaped, but%isn’t included inSpecialCharacters/SpecialCharactersSet. Either update the documentation to match the actual escaped characters, or add%to the escaped character set if it is intended to be supported.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 24 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (4)
src/Microsoft.TestPlatform.Filter.Source/Condition.cs:25
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities;is unconditional, but under!IS_VSTEST_REPOthis source-only code is intended to compile without referencing the ObjectModel assembly. Since no types from this namespace are used outsideIS_VSTEST_REPO, wrap the using in#if IS_VSTEST_REPO(or remove it) to avoid compile failures for consumers.
src/Microsoft.TestPlatform.Filter.Source/Condition.cs:135TPDebug.Assert(...)is referenced without ausing Microsoft.VisualStudio.TestPlatform.Common;or full qualification. SinceTPDebuglives inMicrosoft.VisualStudio.TestPlatform.Common, this will not compile from withinMicrosoft.VisualStudio.TestPlatform.Common.Filtering. Consider switching toDebug.Assert(likeFilterExpression.csdoes) or fully qualifying the call.
src/Microsoft.TestPlatform.Filter.Source/FilterExpression.cs:24using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities;is unconditional. In the source-only package (!IS_VSTEST_REPO) this namespace may not exist in the consuming project, causing a compile error even if it’s unused. Wrap this using in#if IS_VSTEST_REPO(or remove it) to keep the embedded sources dependency-free.
src/Microsoft.TestPlatform.Filter.Source/FastFilter.cs:120TPDebug.Assert(PropertyValueRegex != null);is referenced without bringingTPDebuginto scope. BecauseTPDebugis inMicrosoft.VisualStudio.TestPlatform.Common, this will not compile from this namespace. PreferDebug.Assert(...)here (matchingFilterExpression.cs) or fully qualifyMicrosoft.VisualStudio.TestPlatform.Common.TPDebug.
...t.TestPlatform.Filter.Source.UnitTests/Microsoft.TestPlatform.Filter.Source.UnitTests.csproj
Show resolved
Hide resolved
test/TestAssets/FilterSourcePackageConsumerTests/FilterSourcePackageConsumerTests.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 24 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (4)
src/Microsoft.TestPlatform.Filter.Source/FilterExpressionWrapper.cs:58
- In the source-only (non-
IS_VSTEST_REPO) build, the constructor no longer validatesfilterString. Passingnullwill currently lead to aNullReferenceExceptionlater, and empty strings may produce less actionable failures. Consider adding explicit argument validation in the non-repo path (e.g.,if (filterString is null) throw ...;and/or empty check) so behavior is consistent and errors are clearer for package consumers.
src/Microsoft.TestPlatform.Filter.Source/FilterHelper.cs:55 - In the non-
IS_VSTEST_REPObuild,Escape/Unescapeno longer validatestr. If a consumer passesnull(e.g., from older code or with null-forgiveness), this will throw aNullReferenceExceptioninstead of a clear argument exception. Add an unconditionalnullcheck (or a non-repo check) so consumers get a consistent, actionable exception.
src/Microsoft.TestPlatform.Filter.Source/TestCaseFilterExpression.cs:94 - For the source-only (non-
IS_VSTEST_REPO) build,MatchTestCasedoesn’t validatepropertyValueProvider. Anullprovider will currently lead to failures deeper in evaluation rather than a clear argument exception. Consider adding explicit validation in the non-repo path to keep behavior consistent and error messages clearer for package consumers.
src/Microsoft.TestPlatform.Filter.Source/FilterExpression.cs:343 FilterExpressionswitched fromTPDebug.AsserttoDebug.Assert, which changes the assertion mechanism used in-repo. IfTPDebugis the standard assertion helper in this codebase, consider keepingTPDebug.Assertunder#if IS_VSTEST_REPO(andDebug.Assertor no assert for the source-only build) to stay consistent with existing diagnostics behavior.
Fixes #15361