Skip to content

Support vendored Go native modules - #5289

Merged
ananth7592 merged 2 commits into
mainfrom
ananth7592-vendored-go-modules
Sep 16, 2026
Merged

ananth7592 merged 2 commits into
mainfrom
ananth7592-vendored-go-modules

Conversation

@ananth7592

Copy link
Copy Markdown
Member

Place generated Cosmos native archives at each target module root so Go vendoring preserves the linker input and cgo can link through ${SRCDIR}.

  • generate the flat archive/header layout for all six targets and remove stale native/ or .syso outputs
  • bind root archive paths into checksums, provenance, and downstream layout validation
  • add direct and vendored Go consumer builds that call cosmos_version() from a real native archive
  • update the native pipeline, local rehearsal, Pester coverage, and supply-chain documentation

Validation

  • Native pipeline Pester suite: 29/29 passed
  • Real Windows AMD64 native archive build: passed
  • Direct and -mod=vendor consumer builds against the real archive: passed
  • Real native link smoke test: passed
  • Markdown lint and cSpell: passed

Copilot AI balanced review requested due to automatic review settings September 11, 2026 03:12
@ananth7592
ananth7592 requested a review from a team as a code owner September 11, 2026 03:12
@github-actions github-actions Bot added the Cosmos The azure_cosmos crate label Sep 11, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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.

🔵 Needs a closer look

Two moderate test assertions need their single-quoted expected strings corrected before approval.

Pull request overview

This PR makes Cosmos native Go modules vendoring-compatible by placing archives and headers at module roots.

Changes:

  • Flattens native outputs and removes stale paths.
  • Strengthens checksum, provenance, and layout validation.
  • Adds direct/vendored consumer checks and updates pipeline documentation.
File summaries
File Summary
sdk/cosmos/azure_data_cosmos_driver_native/pipeline/tests/Test-GoModuleConsumer.Tests.ps1 Tests consumer build command flow.
sdk/cosmos/azure_data_cosmos_driver_native/pipeline/tests/Prepare-GoDriverPullRequest.Tests.ps1 Tests staging, provenance, and path validation.
sdk/cosmos/azure_data_cosmos_driver_native/pipeline/tests/New-GoModules.Tests.ps1 Tests flat output layout and cleanup.
sdk/cosmos/azure_data_cosmos_driver_native/pipeline/Test-NativeLink.ps1 Links against root-level native inputs.
sdk/cosmos/azure_data_cosmos_driver_native/pipeline/Test-GoModuleConsumer.ps1 Builds direct and vendored Go consumers.
sdk/cosmos/azure_data_cosmos_driver_native/pipeline/README.md Documents layout and validation.
sdk/cosmos/azure_data_cosmos_driver_native/pipeline/Prepare-GoDriverPullRequest.ps1 Validates generated paths, checksums, and provenance.
sdk/cosmos/azure_data_cosmos_driver_native/pipeline/New-GoModules.ps1 Generates flat modules and removes stale outputs.
sdk/cosmos/azure_data_cosmos_driver_native/pipeline/native-driver.yml Adds CI validation for checksums and consumers.
sdk/cosmos/azure_data_cosmos_driver_native/pipeline/Invoke-LocalSupplyChain.ps1 Updates the local rehearsal flow.
sdk/cosmos/azure_data_cosmos_driver_native/docs/NATIVE_SUPPLY_CHAIN.md Updates supply-chain documentation.
Review details

Suppressed comments (2)

sdk/cosmos/azure_data_cosmos_driver_native/pipeline/tests/New-GoModules.Tests.ps1:173

  • Because this is a single-quoted PowerShell string, the backtick is literal, so this assertion searches for a backtick before ${SRCDIR} instead of the generated ${SRCDIR}/native text. A linker file containing both the new root directive and the obsolete native-directory directive would therefore pass this check; remove the backtick from the expected string.
            $linkContent | Should -Not -Match ([regex]::Escape('`${SRCDIR}/native'))

sdk/cosmos/azure_data_cosmos_driver_native/pipeline/tests/New-GoModules.Tests.ps1:188

  • This repeats the same quoting error: in a single-quoted PowerShell string the backtick is literal, so the repository-wide check does not match the actual obsolete ${SRCDIR}/native directive. Remove the backtick so this regression check can fail when any generated linker file retains the old path.
        $generatedContents | Should -Not -Match ([regex]::Escape('`${SRCDIR}/native'))
  • Files reviewed: 11/11 changed files
  • Comments generated: 0
  • Review effort level: Lite

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

@tvaron3 Tomas Varon (tvaron3) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM thanks

Place native archives at each generated module root so Go vendoring preserves the linker input. Validate the flat layout, checksums, and provenance, and exercise both direct and vendored consumers against a real native symbol.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@ananth7592
ananth7592 force-pushed the ananth7592-vendored-go-modules branch from 1a3ddf5 to 22b1f35 Compare September 15, 2026 22:32
@ananth7592
ananth7592 merged commit db4df30 into main Sep 16, 2026
15 checks passed
@ananth7592
ananth7592 deleted the ananth7592-vendored-go-modules branch September 16, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cosmos The azure_cosmos crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants