diff --git a/src/AppInstallerCLICore/Commands/ExportCommand.h b/src/AppInstallerCLICore/Commands/ExportCommand.h index 0dcbb8fcbe..25e5c985f3 100644 --- a/src/AppInstallerCLICore/Commands/ExportCommand.h +++ b/src/AppInstallerCLICore/Commands/ExportCommand.h @@ -8,7 +8,7 @@ namespace AppInstaller::CLI // Command to get the set of installed packages on the system. struct ExportCommand final : public Command { - ExportCommand(std::string_view parent) : Command("export", parent, Settings::ExperimentalFeature::Feature::ExperimentalExport) {} + ExportCommand(std::string_view parent) : Command("export", parent) {} std::vector GetArguments() const override; diff --git a/src/AppInstallerCLICore/Commands/ListCommand.h b/src/AppInstallerCLICore/Commands/ListCommand.h index 6d8c5a23fd..8e0e22b6e2 100644 --- a/src/AppInstallerCLICore/Commands/ListCommand.h +++ b/src/AppInstallerCLICore/Commands/ListCommand.h @@ -8,7 +8,7 @@ namespace AppInstaller::CLI // Command to get the set of installed packages on the system. struct ListCommand final : public Command { - ListCommand(std::string_view parent) : Command("list", parent, Settings::ExperimentalFeature::Feature::ExperimentalList) {} + ListCommand(std::string_view parent) : Command("list", parent) {} std::vector GetArguments() const override; diff --git a/src/AppInstallerCLICore/Commands/UninstallCommand.h b/src/AppInstallerCLICore/Commands/UninstallCommand.h index 29ad34246a..e6595d0b44 100644 --- a/src/AppInstallerCLICore/Commands/UninstallCommand.h +++ b/src/AppInstallerCLICore/Commands/UninstallCommand.h @@ -7,7 +7,7 @@ namespace AppInstaller::CLI { struct UninstallCommand final : public Command { - UninstallCommand(std::string_view parent) : Command("uninstall", parent, Settings::ExperimentalFeature::Feature::ExperimentalUninstall) {} + UninstallCommand(std::string_view parent) : Command("uninstall", parent) {} std::vector GetArguments() const override; diff --git a/src/AppInstallerCLICore/Commands/UpgradeCommand.h b/src/AppInstallerCLICore/Commands/UpgradeCommand.h index fc1c9368f2..44f217c368 100644 --- a/src/AppInstallerCLICore/Commands/UpgradeCommand.h +++ b/src/AppInstallerCLICore/Commands/UpgradeCommand.h @@ -7,7 +7,7 @@ namespace AppInstaller::CLI { struct UpgradeCommand final : public Command { - UpgradeCommand(std::string_view parent) : Command("upgrade", parent, Settings::ExperimentalFeature::Feature::ExperimentalUpgrade) {} + UpgradeCommand(std::string_view parent) : Command("upgrade", parent) {} std::vector GetArguments() const override; diff --git a/src/AppInstallerCLIE2ETests/FeaturesCommand.cs b/src/AppInstallerCLIE2ETests/FeaturesCommand.cs index b1d1e44248..237a8e014d 100644 --- a/src/AppInstallerCLIE2ETests/FeaturesCommand.cs +++ b/src/AppInstallerCLIE2ETests/FeaturesCommand.cs @@ -28,8 +28,6 @@ public void DisplayFeatures() { var result = TestCommon.RunAICLICommand("features", ""); Assert.AreEqual(Constants.ErrorCode.S_OK, result.ExitCode); - Assert.True(result.StdOut.Contains("Command Sample")); - Assert.True(result.StdOut.Contains("Argument Sample")); Assert.True(result.StdOut.Contains("Microsoft Store Support")); Assert.False(result.StdOut.Contains("Enabled")); } diff --git a/src/AppInstallerCLIE2ETests/ImportCommand.cs b/src/AppInstallerCLIE2ETests/ImportCommand.cs index 67dc80d4ce..739b122c6b 100644 --- a/src/AppInstallerCLIE2ETests/ImportCommand.cs +++ b/src/AppInstallerCLIE2ETests/ImportCommand.cs @@ -11,17 +11,9 @@ public class ImportCommand : BaseCommand [SetUp] public void Setup() { - InitializeAllFeatures(false); - ConfigureFeature("export", true); CleanupTestExe(); } - [TearDown] - public void TearDown() - { - InitializeAllFeatures(false); - } - [Test] public void ImportSuccessful() { @@ -119,7 +111,6 @@ private bool VerifyTestExeInstalled(string installDir = null) private void UninstallTestExe() { - ConfigureFeature("uninstall", true); TestCommon.RunAICLICommand("uninstall", Constants.ExeInstallerPackageId); } diff --git a/src/AppInstallerCLIE2ETests/ListCommand.cs b/src/AppInstallerCLIE2ETests/ListCommand.cs index 52f752fc6c..2de25930e6 100644 --- a/src/AppInstallerCLIE2ETests/ListCommand.cs +++ b/src/AppInstallerCLIE2ETests/ListCommand.cs @@ -7,19 +7,6 @@ namespace AppInstallerCLIE2ETests public class ListCommand : BaseCommand { - [SetUp] - public void Setup() - { - InitializeAllFeatures(false); - ConfigureFeature("list", true); - } - - [TearDown] - public void TearDown() - { - InitializeAllFeatures(false); - } - [Test] public void ListSelf() { diff --git a/src/AppInstallerCLIE2ETests/UninstallCommand.cs b/src/AppInstallerCLIE2ETests/UninstallCommand.cs index 37fb4f4e43..caabaecca6 100644 --- a/src/AppInstallerCLIE2ETests/UninstallCommand.cs +++ b/src/AppInstallerCLIE2ETests/UninstallCommand.cs @@ -20,19 +20,6 @@ public class UninstallCommand : BaseCommand // Package name of the test MSIX package private const string UninstallTestMsixName = "6c6338fe-41b7-46ca-8ba6-b5ad5312bb0e"; - [OneTimeSetUp] - public void OneTimeSetUp() - { - InitializeAllFeatures(false); - ConfigureFeature("uninstall", true); - } - - [OneTimeTearDown] - public void OneTimeTearDown() - { - InitializeAllFeatures(false); - } - [Test] public void UninstallTestExe() { diff --git a/src/AppInstallerCLITests/Downloader.cpp b/src/AppInstallerCLITests/Downloader.cpp index 1f99367890..f53b2bc54a 100644 --- a/src/AppInstallerCLITests/Downloader.cpp +++ b/src/AppInstallerCLITests/Downloader.cpp @@ -66,5 +66,5 @@ TEST_CASE("DownloadInvalidUrl", "[Downloader]") ProgressCallback callback; - REQUIRE_THROWS_HR(Download("blargle-flargle-fluff", tempFile.GetPath(), DownloadType::Installer, callback, true), WININET_E_UNRECOGNIZED_SCHEME); + REQUIRE_THROWS(Download("blargle-flargle-fluff", tempFile.GetPath(), DownloadType::Installer, callback, true)); } diff --git a/src/AppInstallerCommonCore/Downloader.cpp b/src/AppInstallerCommonCore/Downloader.cpp index 1d7c478ddb..a287d82d26 100644 --- a/src/AppInstallerCommonCore/Downloader.cpp +++ b/src/AppInstallerCommonCore/Downloader.cpp @@ -164,18 +164,21 @@ namespace AppInstaller::Utility // Determine whether to try DO first or not, as this is the only choice currently supported. InstallerDownloader setting = User().Get(); - // Currently, the default remains WinINet until the DO path is proven. - if (setting == InstallerDownloader::Default) + if (setting == InstallerDownloader::Default || + setting == InstallerDownloader::DeliveryOptimization) { - setting = InstallerDownloader::WinInet; - } - - if (setting == InstallerDownloader::DeliveryOptimization) - { - return DODownload(url, dest, progress, computeHash, info); + auto result = DODownload(url, dest, progress, computeHash, info); + // Since we cannot pre-apply to the file with DO, post-apply the MotW to the file. + // Only do so if the file exists, because cancellation will not throw here. + if (std::filesystem::exists(dest)) + { + ApplyMotwIfApplicable(dest, URLZONE_INTERNET); + } + return result; - // While DO still requires an explicit opt-in, we will let failures through. - // When DO becomes the default, we may choose to catch exceptions and fall back to WinINet below. + // If DO becomes an issue, we may choose to catch exceptions and fall back to WinINet below. + // We would need to be careful not to bypass metered networks or other reasons that might + // intentionally cause the download to be blocked. } } diff --git a/src/AppInstallerCommonCore/ExperimentalFeature.cpp b/src/AppInstallerCommonCore/ExperimentalFeature.cpp index ae6921dc8e..8f8f0ff6de 100644 --- a/src/AppInstallerCommonCore/ExperimentalFeature.cpp +++ b/src/AppInstallerCommonCore/ExperimentalFeature.cpp @@ -18,6 +18,14 @@ namespace AppInstaller::Settings return true; } + // Even if all experimental features are disabled, if the store policy is enabled then override it. + if (feature == ExperimentalFeature::Feature::ExperimentalMSStore && + GroupPolicies().GetState(TogglePolicy::Policy::MSStoreSource) == PolicyState::Enabled) + { + // Force enable the feature + return true; + } + if (!GroupPolicies().IsEnabled(TogglePolicy::Policy::ExperimentalFeatures)) { AICLI_LOG(Core, Info, << @@ -35,23 +43,7 @@ namespace AppInstaller::Settings case ExperimentalFeature::Feature::ExperimentalArg: return userSettings.Get(); case ExperimentalFeature::Feature::ExperimentalMSStore: - if (GroupPolicies().GetState(TogglePolicy::Policy::MSStoreSource) == PolicyState::Enabled) - { - // Force enable the feature - return true; - } - return userSettings.Get(); - case ExperimentalFeature::Feature::ExperimentalList: - return userSettings.Get(); - case ExperimentalFeature::Feature::ExperimentalUpgrade: - return userSettings.Get(); - case ExperimentalFeature::Feature::ExperimentalUninstall: - return userSettings.Get(); - case ExperimentalFeature::Feature::ExperimentalExport: - return userSettings.Get(); - case ExperimentalFeature::Feature::ExperimentalRestSource: - return userSettings.Get(); default: THROW_HR(E_UNEXPECTED); } @@ -80,16 +72,6 @@ namespace AppInstaller::Settings return ExperimentalFeature{ "Argument Sample", "experimentalArg", "https://aka.ms/winget-settings", Feature::ExperimentalArg }; case Feature::ExperimentalMSStore: return ExperimentalFeature{ "Microsoft Store Support", "experimentalMSStore", "https://aka.ms/winget-settings", Feature::ExperimentalMSStore }; - case Feature::ExperimentalList: - return ExperimentalFeature{ "List Command", "list", "https://aka.ms/winget-settings", Feature::ExperimentalList }; - case Feature::ExperimentalUpgrade: - return ExperimentalFeature{ "Upgrade Command", "upgrade", "https://aka.ms/winget-settings", Feature::ExperimentalUpgrade }; - case Feature::ExperimentalUninstall: - return ExperimentalFeature{ "Uninstall Command", "uninstall", "https://aka.ms/winget-settings", Feature::ExperimentalUninstall }; - case Feature::ExperimentalExport: - return ExperimentalFeature{ "Export Command", "export", "https://aka.ms/winget-settings", Feature::ExperimentalExport }; - case Feature::ExperimentalRestSource: - return ExperimentalFeature{ "Rest Source Support", "restSource", "https://aka.ms/winget-settings", Feature::ExperimentalRestSource }; default: THROW_HR(E_UNEXPECTED); } diff --git a/src/AppInstallerCommonCore/Public/winget/ExperimentalFeature.h b/src/AppInstallerCommonCore/Public/winget/ExperimentalFeature.h index 453795e264..b1bbf0e8eb 100644 --- a/src/AppInstallerCommonCore/Public/winget/ExperimentalFeature.h +++ b/src/AppInstallerCommonCore/Public/winget/ExperimentalFeature.h @@ -20,18 +20,13 @@ namespace AppInstaller::Settings enum class Feature : unsigned { None = 0x0, - ExperimentalCmd = 0x1, - ExperimentalArg = 0x2, - ExperimentalMSStore = 0x4, - ExperimentalList = 0x8, - ExperimentalUpgrade = 0x10, - ExperimentalUninstall = 0x20, - ExperimentalRestSource = 0x40, + ExperimentalMSStore = 0x1, Max, // This MUST always be after all experimental features // Features listed after Max will not be shown with the features command - // This can be used to hide highly experimental features - ExperimentalExport = 0x100 + // This can be used to hide highly experimental features (or these example ones) + ExperimentalCmd = 0x10000, + ExperimentalArg = 0x20000, }; using Feature_t = std::underlying_type_t; diff --git a/src/AppInstallerCommonCore/Public/winget/UserSettings.h b/src/AppInstallerCommonCore/Public/winget/UserSettings.h index 9bfacdc7bd..57a91bbd22 100644 --- a/src/AppInstallerCommonCore/Public/winget/UserSettings.h +++ b/src/AppInstallerCommonCore/Public/winget/UserSettings.h @@ -68,12 +68,7 @@ namespace AppInstaller::Settings EFExperimentalCmd, EFExperimentalArg, EFExperimentalMSStore, - EFList, - EFExperimentalUpgrade, - EFUninstall, - EFExport, TelemetryDisable, - EFRestSource, InstallScopePreference, InstallScopeRequirement, NetworkDownloader, @@ -118,12 +113,7 @@ namespace AppInstaller::Settings SETTINGMAPPING_SPECIALIZATION(Setting::EFExperimentalCmd, bool, bool, false, ".experimentalFeatures.experimentalCmd"sv); SETTINGMAPPING_SPECIALIZATION(Setting::EFExperimentalArg, bool, bool, false, ".experimentalFeatures.experimentalArg"sv); SETTINGMAPPING_SPECIALIZATION(Setting::EFExperimentalMSStore, bool, bool, false, ".experimentalFeatures.experimentalMSStore"sv); - SETTINGMAPPING_SPECIALIZATION(Setting::EFList, bool, bool, false, ".experimentalFeatures.list"sv); - SETTINGMAPPING_SPECIALIZATION(Setting::EFExperimentalUpgrade, bool, bool, false, ".experimentalFeatures.upgrade"sv); - SETTINGMAPPING_SPECIALIZATION(Setting::EFUninstall, bool, bool, false, ".experimentalFeatures.uninstall"sv); - SETTINGMAPPING_SPECIALIZATION(Setting::EFExport, bool, bool, false, ".experimentalFeatures.export"sv); SETTINGMAPPING_SPECIALIZATION(Setting::TelemetryDisable, bool, bool, false, ".telemetry.disable"sv); - SETTINGMAPPING_SPECIALIZATION(Setting::EFRestSource, bool, bool, false, ".experimentalFeatures.restSource"sv); SETTINGMAPPING_SPECIALIZATION(Setting::InstallScopePreference, std::string, ScopePreference, ScopePreference::User, ".installBehavior.preferences.scope"sv); SETTINGMAPPING_SPECIALIZATION(Setting::InstallScopeRequirement, std::string, ScopePreference, ScopePreference::None, ".installBehavior.requirements.scope"sv); SETTINGMAPPING_SPECIALIZATION(Setting::NetworkDownloader, std::string, InstallerDownloader, InstallerDownloader::Default, ".network.downloader"sv); diff --git a/src/AppInstallerCommonCore/UserSettings.cpp b/src/AppInstallerCommonCore/UserSettings.cpp index 915f11d4b5..8cac00105e 100644 --- a/src/AppInstallerCommonCore/UserSettings.cpp +++ b/src/AppInstallerCommonCore/UserSettings.cpp @@ -225,12 +225,7 @@ namespace AppInstaller::Settings WINGET_VALIDATE_PASS_THROUGH(EFExperimentalCmd) WINGET_VALIDATE_PASS_THROUGH(EFExperimentalArg) WINGET_VALIDATE_PASS_THROUGH(EFExperimentalMSStore) - WINGET_VALIDATE_PASS_THROUGH(EFList) - WINGET_VALIDATE_PASS_THROUGH(EFExperimentalUpgrade) - WINGET_VALIDATE_PASS_THROUGH(EFUninstall) - WINGET_VALIDATE_PASS_THROUGH(EFExport) WINGET_VALIDATE_PASS_THROUGH(TelemetryDisable) - WINGET_VALIDATE_PASS_THROUGH(EFRestSource) WINGET_VALIDATE_SIGNATURE(InstallScopePreference) { diff --git a/src/AppInstallerRepositoryCore/RepositorySource.cpp b/src/AppInstallerRepositoryCore/RepositorySource.cpp index 74fa7feb81..467cca44cb 100644 --- a/src/AppInstallerRepositoryCore/RepositorySource.cpp +++ b/src/AppInstallerRepositoryCore/RepositorySource.cpp @@ -438,12 +438,6 @@ namespace AppInstaller::Repository for (auto& source : userSources) { - if (Utility::CaseInsensitiveEquals(Rest::RestSourceFactory::Type(), source.Type) - && !Settings::ExperimentalFeature::IsEnabled(Settings::ExperimentalFeature::Feature::ExperimentalRestSource)) - { - continue; - } - // Check source against list of allowed sources and drop tombstones for required sources if (!IsUserSourceAllowedByPolicy(source.Name, source.Type, source.Arg, source.IsTombstone)) { @@ -582,8 +576,7 @@ namespace AppInstaller::Repository { return Microsoft::PredefinedInstalledSourceFactory::Create(); } - else if (Utility::CaseInsensitiveEquals(Rest::RestSourceFactory::Type(), type) - && Settings::ExperimentalFeature::IsEnabled(Settings::ExperimentalFeature::Feature::ExperimentalRestSource)) + else if (Utility::CaseInsensitiveEquals(Rest::RestSourceFactory::Type(), type)) { return Rest::RestSourceFactory::Create(); } @@ -880,15 +873,6 @@ namespace AppInstaller::Repository details.LastUpdateTime = Utility::ConvertUnixEpochToSystemClock(0); details.Origin = SourceOrigin::User; - // Check feature flag enablement for rest source. - if (Utility::CaseInsensitiveEquals(Rest::RestSourceFactory::Type(), type) - && !Settings::ExperimentalFeature::IsEnabled(Settings::ExperimentalFeature::Feature::ExperimentalRestSource)) - { - AICLI_LOG(Repo, Error, << Settings::ExperimentalFeature::GetFeature(Settings::ExperimentalFeature::Feature::ExperimentalRestSource).Name() - << " feature is disabled. Execution cancelled."); - THROW_HR(APPINSTALLER_CLI_ERROR_EXPERIMENTAL_FEATURE_DISABLED); - } - AddSourceFromDetails(details, progress); AICLI_LOG(Repo, Info, << "Source created with extra data: " << details.Data);