@@ -684,6 +684,48 @@ public void FindBestVersionMatch_V4Range_NoCaps_MixedSet_PicksHighest()
684
684
#endif
685
685
686
686
#if NET6_0
687
+
688
+ [ Fact ]
689
+ public void FindBestVersionMatch_V4Range_PlaceholderMode_AllowsPreviouslyCappedMin ( )
690
+ {
691
+ // Without placeholder mode, only version "4.2.0" would be excluded by the adjusted open interval (4.2.0, 4.22.0),
692
+ // resulting in a null match (covered by existing test FindBestVersionMatch_V4Range_AllFiltered_ReturnsNull).
693
+ // With placeholder mode enabled, adjustment is skipped and "4.2.0" is valid and should be selected.
694
+ var range = VersionRange . Parse ( "[4.0.0, 5.0.0)" ) ;
695
+ var versions = new List < string > { "4.2.0" } ;
696
+
697
+ var options = GetTestExtensionBundleOptions ( BundleId , "[4.*,5.0.0)" ) ;
698
+ var env = GetTestAppServiceEnvironment ( ) ;
699
+ env . SetEnvironmentVariable ( AzureWebsitePlaceholderMode , "1" ) ; // enable placeholder mode
700
+
701
+ var manager = GetExtensionBundleManager ( options , env ) ;
702
+
703
+ var resolved = manager . FindBestVersionMatch ( range , versions , ScriptConstants . DefaultExtensionBundleId , new FunctionsHostingConfigOptions ( ) ) ;
704
+
705
+ Assert . Equal ( "4.2.0" , resolved ) ;
706
+ }
707
+
708
+ [ Fact ]
709
+ public void FindBestVersionMatch_V4Range_PlaceholderMode_AllowsPreviouslyCappedOuterVersions ( )
710
+ {
711
+ // Version adjustment on .NET 6 would cap effective range to (4.2.0, 4.22.0) (exclusive on both ends),
712
+ // excluding 4.2.0, 4.22.0, and anything above (e.g., 4.23.0). Normal (non-placeholder) selection (with provided list)
713
+ // would therefore choose 4.21.9 (if present) or next highest inside interval.
714
+ // With placeholder mode enabled, no adjustment occurs and the highest (4.23.0) should be selected.
715
+ var range = VersionRange . Parse ( "[4.0.0, 5.0.0)" ) ;
716
+ var versions = new List < string > { "4.2.0" , "4.3.0" , "4.21.9" , "4.22.0" , "4.23.0" } ;
717
+
718
+ var options = GetTestExtensionBundleOptions ( BundleId , "[4.*,5.0.0)" ) ;
719
+ var env = GetTestAppServiceEnvironment ( ) ;
720
+ env . SetEnvironmentVariable ( AzureWebsitePlaceholderMode , "1" ) ; // enable placeholder mode
721
+
722
+ var manager = GetExtensionBundleManager ( options , env ) ;
723
+
724
+ var resolved = manager . FindBestVersionMatch ( range , versions , ScriptConstants . DefaultExtensionBundleId , new FunctionsHostingConfigOptions ( ) ) ;
725
+
726
+ Assert . Equal ( "4.23.0" , resolved ) ;
727
+ }
728
+
687
729
[ Fact ]
688
730
public void FindBestVersionMatch_V4Range_MinCapApplied_ExcludesCappedMin ( )
689
731
{
0 commit comments