Skip to content

Enhance content downloader with V2 contract and logging improvements#861

Merged
Nox-MSFT merged 10 commits intodevelopfrom
user/nox-msft/pr-828-enhanced
Apr 22, 2026
Merged

Enhance content downloader with V2 contract and logging improvements#861
Nox-MSFT merged 10 commits intodevelopfrom
user/nox-msft/pr-828-enhanced

Conversation

@Nox-MSFT
Copy link
Copy Markdown
Collaborator

NOTE: This pull request contains an improvement in ADU Agent logging proposed by PR #828 by @AndreRicardo-Zoetis (Thank you!)

This pull request updates the content downloader extension contract to version 2.0, introducing improved logging initialization and cleanup support. The changes ensure backward compatibility with version 1.0 while enabling new extensions to take advantage of enhanced initialization and resource management. Documentation has been updated to reflect the new contract, and the agent and extension manager have been refactored to support both V1 and V2 contracts.

Content Downloader Contract V2 Support:

  • Added support for V2 (2.0) content downloader contract, which changes the Initialize method to accept a logLevel parameter and introduces an optional Cleanup export for resource cleanup before unloading the library. The agent now detects the contract version at load time and dispatches accordingly. [1]], [2]], [3]], [4]], [5]])

  • Updated both curl_content_downloader.EXPORTS.cpp and deliveryoptimization_content_downloader.EXPORTS.cpp to implement the V2 contract: initializing logging in Initialize, reporting contract version 2.0 in GetContractInfo, and providing a Cleanup method to uninitialize logging. [1]], [2]], [3]], [4]])

Agent and Extension Manager Refactoring:

  • Refactored the agent and extension manager to pass the logLevel parameter to the content downloader's Initialize method and to call the Cleanup export when unloading V2 contract libraries. [1]], [2]], [3]], [4]], [5]], [6]], [7]], [8]])

Documentation Updates:

  • Updated documentation to describe the V2 contract changes, including the new logging and cleanup features, and to guide extension authors on supporting both V1 and V2. [1]], [2]])

Test Suite Enhancements:

  • Extended the test infrastructure to support specifying the contract version for test cases, enabling testing of both V1 and V2 contract behaviors. [1]], [2]], [3]], [4]], [5]])

AndreRicardo-Zoetis and others added 8 commits February 26, 2026 16:12
Enhance PR #828's logging initialization for content downloaders with
proper backward compatibility via a V2 contract model:

- Add V2 contract version (2.0) constants and ADUC_ContractUtils_IsV2Contract()
- Add InitializeV1Proc typedef for V1 ABI (1 arg) alongside V2's InitializeProc (2 args)
- Branch InitializeContentDownloader on contract version: V1 calls with 1 arg, V2 with 2 args
- Remove Cleanup from required symbols array so V1 extensions still load
- Only call Cleanup on the content downloader lib (not all libs) and only for V2
- Update Download() to accept both V1 and V2 contract versions
- Update curl and DO downloaders to report V2 contract
- Add unit tests for V1/V2/unsupported contract version routing

Addresses ABI compatibility concerns raised in #828.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update extension-contract-versions.md with V1 vs V2 content downloader
contract details (Initialize signature change, Cleanup export).

Update device-update-agent-extensibility-points.md custom content
downloader section with V1/V2 guidance.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@AndreRicardo-Zoetis AndreRicardo-Zoetis left a comment

Choose a reason for hiding this comment

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

Thanks for the reply back and the new PR suggestions, PR looks good to me.

I'm still struggling to see how users on current version (now called v1) see/initialize their logs but it makes sense to try to make this as backwards compatible as possible so they don't have to recompile their extensions.

We have the changes made in #828 already in our production release so we can see the download logs.

chgennar
chgennar previously approved these changes Apr 22, 2026
- extension_manager_ut.cpp: pass ADUC_LOG_DEBUG to InitializeContentDownloader
  callsites (build break after logLevel param was added)
- extension_manager_ut.cpp, extension_manager_download_test_case.cpp: use
  {3,0} instead of {2,0} for the 'unsupported contract version' scenarios,
  since {2,0} is now a supported V2 contract
- curl_content_downloader_ut.cpp: update GetContractInfo test to expect V2,
  matching curl downloader's reported contract version

All 744 unit tests pass.
@Nox-MSFT Nox-MSFT merged commit 8e43492 into develop Apr 22, 2026
13 checks passed
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.

4 participants