Relax Patch(record, updates...) field-type strictness and preserve unioned record shape#3063
Draft
Copilot wants to merge 3 commits into
Draft
Relax Patch(record, updates...) field-type strictness and preserve unioned record shape#3063Copilot wants to merge 3 commits into
Patch(record, updates...) field-type strictness and preserve unioned record shape#3063Copilot wants to merge 3 commits into
Conversation
Agent-Logs-Url: https://github.com/microsoft/Power-Fx/sessions/06ca3f33-4583-4197-9410-940f498c6d89 Co-authored-by: CarlosFigueiraMSFT <44986255+CarlosFigueiraMSFT@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/Power-Fx/sessions/06ca3f33-4583-4197-9410-940f498c6d89 Co-authored-by: CarlosFigueiraMSFT <44986255+CarlosFigueiraMSFT@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Patch function to allow coercions from second item to first
Relax May 19, 2026
Patch(record, updates...) field-type strictness and preserve unioned record shape
Contributor
|
Please add a few entries where coercion is required to the .txt tests at src\tests\Microsoft.PowerFx.Core.Tests.Shared\ExpressionTestCases\Patch_PatchRecord.txt - and make sure that they pass |
Contributor
For example: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Patch({a:1,b:"hello"}, {a:3,b:4})failed because the record overload required exact type matches for overlapping fields across update records. This change relaxes that rule so record patching can evolve field types while still computing a consistent return record type.Record-overload type-checking change
PatchRecordFunction.CheckTypesto stop rejecting updates when an existing field appears with a different type.Regression coverage for record patching
TexlTests.csfor:b:n -> b:s)Unknown($) fieldsWarning
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:
1mcvsblobprodwus2174.vsblob.vsassets.io/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Power-Fx/Power-Fx/src/Microsoft.PowerFx.sln --packages /tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)5bdvsblobprodwus2128.vsblob.vsassets.io/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Power-Fx/Power-Fx/src/Microsoft.PowerFx.sln --packages /tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)5o1vsblobprodwus2115.vsblob.vsassets.io/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TestPatchRecordFunction|TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter FullyQualifiedName~TestPatchRecordFunction --nologo(dns block)5zivsblobprodwus217.vsblob.vsassets.io/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TestPatchRecordFunction|TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter FullyQualifiedName~TestPatchRecordFunction --nologo(dns block)6yfvsblobprodwus2121.vsblob.vsassets.io/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TestPatchRecordFunction|TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter FullyQualifiedName~TestPatchRecordFunction --nologo(dns block)7t8vsblobprodwus2168.vsblob.vsassets.io/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Power-Fx/Power-Fx/src/Microsoft.PowerFx.sln --packages /tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)ezcvsblobprodwus2170.vsblob.vsassets.io/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TestPatchRecordFunction|TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter FullyQualifiedName~TestPatchRecordFunction --nologo(dns block)faxvsblobprodwus2122.vsblob.vsassets.io/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TestPatchRecordFunction|TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter FullyQualifiedName~TestPatchRecordFunction --nologo(dns block)i01vsblobprodwus216.vsblob.vsassets.io/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TestPatchRecordFunction|TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter FullyQualifiedName~TestPatchRecordFunction --nologo(dns block)jhgvsblobprodwus2167.vsblob.vsassets.io/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Power-Fx/Power-Fx/src/Microsoft.PowerFx.sln --packages /tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)ldhvsblobprodwus2153.vsblob.vsassets.io/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TestPatchRecordFunction|TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter FullyQualifiedName~TestPatchRecordFunction --nologo(dns block)ndavsblobprodwus219.vsblob.vsassets.io/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Power-Fx/Power-Fx/src/Microsoft.PowerFx.sln --packages /tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)s0ivsblobprodwus2134.vsblob.vsassets.io/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TestPatchRecordFunction|TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter FullyQualifiedName~TestPatchRecordFunction --nologo(dns block)vd2vsblobprodwus2150.vsblob.vsassets.io/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Power-Fx/Power-Fx/src/Microsoft.PowerFx.sln --packages /tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)wztvsblobprodwus2155.vsblob.vsassets.io/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TestPatchRecordFunction|TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter FullyQualifiedName~TestPatchRecordFunction --nologo(dns block)x0dvsblobprodwus2111.vsblob.vsassets.io/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Power-Fx/Power-Fx/src/Microsoft.PowerFx.sln --packages /tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Power-Fx/Power-Fx/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/Microsoft.PowerFx.LanguageServerProtocol.csproj --packages /tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Power-Fx/Power-Fx/src/libraries/Microsoft.PowerFx.Json/Microsoft.PowerFx.Json.csproj --packages /tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)y5lvsblobprodwus2179.vsblob.vsassets.io/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TestPatchRecordFunction|TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter FullyQualifiedName~TestPatchRecordFunction --nologo(dns block)z2bvsblobprodwus2185.vsblob.vsassets.io/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter TestPatchRecordFunction|TexlPatchWithDataSourceArgumentValidation --nologo(dns block)/usr/bin/dotnet dotnet test /home/REDACTED/work/Power-Fx/Power-Fx/src/tests/.Net7.0/Microsoft.PowerFx.Core.Tests/Microsoft.PowerFx.Core.Tests.csproj --filter FullyQualifiedName~TestPatchRecordFunction --nologo(dns block)zd2vsblobprodwus2156.vsblob.vsassets.io/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Power-Fx/Power-Fx/src/Microsoft.PowerFx.sln --packages /tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Power-Fx/Power-Fx/src/libraries/Microsoft.PowerFx.Connectors/Microsoft.PowerFx.Connectors.csproj --packages /tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)zugvsblobprodwus2169.vsblob.vsassets.io/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Power-Fx/Power-Fx/src/Microsoft.PowerFx.sln --packages /tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Power-Fx/Power-Fx/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/Microsoft.PowerFx.LanguageServerProtocol.csproj --packages /tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Power-Fx/Power-Fx/src/libraries/Microsoft.PowerFx.Connectors/Microsoft.PowerFx.Connectors.csproj --packages /tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-65e5a7552fae7ad7/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true(dns block)If you need me to access, download, or install something from one of these locations, you can either: