Skip to content

Delta client - #6589

Open
JohnMcPMS wants to merge 31 commits into
microsoft:masterfrom
JohnMcPMS:delta-client
Open

JohnMcPMS wants to merge 31 commits into
microsoft:masterfrom
JohnMcPMS:delta-client

Conversation

@JohnMcPMS

@JohnMcPMS JohnMcPMS commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

📖 Description

Adds experimental deltaIndex feature that enables the client to use delta+baseline when it is available from the source.

During add, we attempt to find the delta package at a fixed name, then the baseline it references. If this is all successful, the source data has a new JSON representation to record the multiple pieces of information.

When updating or opening the source, if we believe that delta is available (because we have both the delta and baseline identities), only the delta is acceptable. Any failure should escape to be reported and fixed.

We may consider fallback in the future, but it is much more complex than it would first appear due to the baseline sharing identity with the full index.

🔍 Validation

Added unit and E2E tests targeting the delta source update and opening.

Microsoft Reviewers: Open in CodeFlow

@JohnMcPMS
JohnMcPMS requested a review from a team as a code owner October 12, 2026 18:40

@ranm-msft ranm-msft left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. I read the delta index form, the source factory update path, and the existing unit coverage (including the malformed-data, differing-baseline-version and baseline-repair cases), so this is one question rather than a list.

A newly persisted but unusable delta causes update failure before the documented full-index fallback, even when a valid full index remains available.

In DeltaIndexForm::Update the delta is acquired and persisted first, and the baseline is validated afterwards. If the locator is missing or the baseline does not match, the result is UpdateResult::Unusable. In PreIndexedPackageSourceFactory::UpdateBase that surfaces as APPINSTALLER_CLI_ERROR_SOURCE_DATA_INTEGRITY_FAILURE, which returns out of the update rather than falling back. Open then also locks onto the delta form, so the already-persisted bad delta is what the next call sees.

That reads as if it contradicts the intent stated in the source comments, which describe the delta as an optimization and not a correctness dependency. If a valid full index is still on disk and reachable, I would expect a delta that fails validation to be discarded and the full index used, rather than the update failing.

I may be misreading the ordering, so I am asking rather than asserting - is the persist-then-validate order deliberate, and is the full-index fallback expected to be reachable from this state?

If the fallback is meant to be reachable, a regression test that persists a delta whose baseline does not match and then asserts a successful update from the full index would pin the behaviour down nicely.

Separately, and not a finding on the change itself: the x64 and x86 release test legs are currently failing on this head, so I would want those green before signing off regardless of the above.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Delta updates can leave partial state, one E2E scenario contradicts the implementation, and temporary baseline files may leak.

3 open findings
What changed in this PR

Adds experimental delta-plus-baseline support for pre-indexed package sources.

Changes:

  • Adds delta source creation, metadata, acquisition, and merged SQLite access.
  • Adds deployment downgrade support and delta feature configuration.
  • Adds unit and E2E coverage for delta sources and package stores.
File Description
src/​WinGetSourceCreator/​WinGetLocalSource.cs Builds delta, baseline, and full packages.
src/​WinGetSourceCreator/​Model/​LocalSource.cs Adds delta configuration.
src/​WinGetSourceCreator/​Model/​DeltaSettings.cs Defines delta source settings.
src/​WinGetSourceCreator/​Helpers.cs Supports identity and version overrides.
src/​AppInstallerSharedLib/​Runtime.cpp Adds an interactive-user test hook.
src/​AppInstallerRepositoryCore/​SourceList.cpp Configures the built-in delta identity.
src/​AppInstallerRepositoryCore/​Microsoft/​SQLiteIndex.h Exposes combined delta/baseline indexes.
src/​AppInstallerRepositoryCore/​Microsoft/​SQLiteIndex.cpp Implements combined index opening.
src/​AppInstallerRepositoryCore/​Microsoft/​Schema/​ISQLiteIndex.h Defines baseline locator APIs.
src/​AppInstallerRepositoryCore/​Microsoft/​Schema/​ISQLiteIndex.cpp Adds default locator behavior.
src/​AppInstallerRepositoryCore/​Microsoft/​Schema/​2_1/​Interface.h Exposes schema 2.1 locator reads.
src/​AppInstallerRepositoryCore/​Microsoft/​Schema/​2_1/​Interface_2_1.cpp Implements schema locator access.
src/​AppInstallerRepositoryCore/​Microsoft/​Schema/​2_1/​DeltaGeneration.h Updates delta metadata contracts.
src/​AppInstallerRepositoryCore/​Microsoft/​Schema/​2_1/​DeltaGeneration.cpp Reads and writes baseline locators.
src/​AppInstallerRepositoryCore/​Microsoft/​PreIndexedPackageSourceFactory.cpp Selects and updates delta forms.
src/​AppInstallerRepositoryCore/​Microsoft/​PreIndexed/​SourceData.h Defines structured source identities.
src/​AppInstallerRepositoryCore/​Microsoft/​PreIndexed/​SourceData.cpp Parses and serializes source identities.
src/​AppInstallerRepositoryCore/​Microsoft/​PreIndexed/​PackageStore.cpp Extends package-store selection and hooks.
src/​AppInstallerRepositoryCore/​Microsoft/​PreIndexed/​IndexForm.h Adds delta form and usability APIs.
src/​AppInstallerRepositoryCore/​Microsoft/​PreIndexed/​FullIndexForm.cpp Adapts full indexes to structured data.
src/​AppInstallerRepositoryCore/​Microsoft/​PreIndexed/​DeployedPackageStore.cpp Allows baseline downgrades.
src/​AppInstallerRepositoryCore/​Microsoft/​PreIndexed/​DeltaIndexForm.cpp Implements delta acquisition and opening.
src/​AppInstallerRepositoryCore/​AppInstallerRepositoryCore.vcxproj.filters Registers new source files.
src/​AppInstallerRepositoryCore/​AppInstallerRepositoryCore.vcxproj Builds new delta components.
src/​AppInstallerCommonCore/​UserSettings.cpp Validates the delta setting.
src/​AppInstallerCommonCore/​Public/​winget/​UserSettings.h Maps the delta setting.
src/​AppInstallerCommonCore/​Public/​winget/​ExperimentalFeature.h Defines the delta feature flag.
src/​AppInstallerCommonCore/​Public/​AppInstallerDeployment.h Adds deployment downgrade options.
src/​AppInstallerCommonCore/​ExperimentalFeature.cpp Registers the delta feature.
src/​AppInstallerCommonCore/​Deployment.cpp Applies downgrade deployment flags.
src/​AppInstallerCLITests/​TestMsixPackage.h Declares test package creation.
src/​AppInstallerCLITests/​TestMsixPackage.cpp Builds test MSIX packages.
src/​AppInstallerCLITests/​TestHooks.h Adds package-store test hooks.
src/​AppInstallerCLITests/​PreIndexedPackageSource.cpp Tests delta and store behavior.
src/​AppInstallerCLITests/​ExperimentalFeature.cpp Tests feature registration.
src/​AppInstallerCLITests/​AppInstallerCLITests.vcxproj.filters Organizes new test files.
src/​AppInstallerCLITests/​AppInstallerCLITests.vcxproj Builds the new test utility.
src/​AppInstallerCLIE2ETests/​Helpers/​TestIndex.cs Publishes an E2E delta source.
src/​AppInstallerCLIE2ETests/​DeltaSourceCommand.cs Adds deployed delta E2E tests.
src/​AppInstallerCLIE2ETests/​Constants.cs Defines delta test constants.
schemas/​JSON/​settings/​settings.schema.0.2.json Documents the delta setting schema.
doc/​Settings.md Documents the experimental feature.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +100 to +103
WinGetSettingsHelper.ConfigureFeature(DeltaFeatureName, true);

var updateResult = TestCommon.RunAICLICommand("source update", $"-n {Constants.DeltaTestSourceName}");
Assert.That(updateResult.ExitCode, Is.EqualTo(Constants.ErrorCode.S_OK));

deltaBytes = acquired->DownloadedBytes;

store.Persist(std::move(acquired.value()), progress);
Comment on lines +242 to +247
// The baseline of a combined index, when the caller extracted it to a temporary location.
//
// SQLiteStorageBase holds one such file, which the combined form gives to the delta since
// that is its main connection. The baseline is attached rather than opened, so there is no
// second storage base to hold it and it lives here instead.
Utility::ManagedFile m_baselineFile;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants