Skip to content

Consumer build-time validation of SqlClient family package versions - #4815

Merged
paulmedynski merged 10 commits into
mainfrom
dev/paul/aot/phase-1.1
Oct 22, 2026
Merged

paulmedynski merged 10 commits into
mainfrom
dev/paul/aot/phase-1.1

Conversation

@paulmedynski

@paulmedynski paulmedynski commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Description

Consumers of the SqlClient family of packages must use identically versioned assemblies. This PR adds a build target to the Microsoft.Data.SqlClient package that warns consuming apps and libraries when their installed SqlClient family packages have mismatched versions.

  • Ship ValidateSqlClientFamilyPackageVersions in the Microsoft.Data.SqlClient package under both build/ and buildTransitive/.
  • Anchor checks on the resolved Microsoft.Data.SqlClient package version; validate only installed family members: Logging, Abstractions, Azure and AKV Provider.
  • Require exact versions including prerelease labels, emitting warning SQLCLIENT001 for mismatches; the warning does not fail the build by default.
  • Support resolved compile/runtime/RID assets and legacy packages.config manifests, including project-specific selection.
  • Skip design-time builds, provide SqlClientEnforceFamilyVersions=false as an opt-out, and exclude independently versioned SqlServer.Server and native SNI.
  • Do not guess missing version metadata or a missing SqlClient anchor.

Public API and behavior changes

No public CLR types or method signatures are added or removed. This PR adds consumer-facing MSBuild validation that reports mismatched installed family package versions as a warning by default.

Surface Change compared with current main Compatibility
Consumer builds Ship ValidateSqlClientFamilyPackageVersions in Microsoft.Data.SqlClient's build/ and buildTransitive/ assets, enabled by default. Mixed-version package graphs produce warning SQLCLIENT001; builds continue by default, though consumers that treat warnings as errors may choose to fail their builds.
Version policy Use the resolved Microsoft.Data.SqlClient version as the anchor and require matching versions, including prerelease labels, for installed SqlClient family packages. Consumers should upgrade installed family members together. Independently versioned SqlServer.Server and native SNI are excluded.
Consumer configuration Add SqlClientEnforceFamilyVersions=false as an opt-out. Explicit opt-out suppresses this warning; it does not make a mixed-version deployment supported or disable AOT 5's runtime checks.
Applicability Cover resolved compile/runtime/RID package assets and legacy packages.config manifests; skip design-time builds. Consumers without Microsoft.Data.SqlClient in their package graph do not import this check; standalone Abstractions/Azure consumers are outside its coverage. Project references are not treated as package-version evidence. Missing version metadata or a missing SqlClient anchor is not replaced with guessed values.

Issues

Related runtime authentication version enforcement: #4820. This consumer build-time check is separate from the AOT 1-7 runtime/validation chain.

Testing

  • The Pester regression suite covers resolved assets, legacy manifests, family exclusions, the opt-out, and automatic direct and transitive NuGet imports.
  • The suite passed 648/648 tests locally with Pester 5.7.1. It is not wired into PR or OneBranch CI.

Copilot AI balanced review requested due to automatic review settings October 9, 2026 18:24
@paulmedynski
paulmedynski added this pull request to stack #4822 October 9, 2026 18:25

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

Project-specific legacy packages configuration files currently bypass validation.

2 open findings
What changed in this PR

Adds consumer-side validation ensuring installed SqlClient family packages use identical versions.

Changes:

  • Ships validation through build/ and buildTransitive/.
  • Adds extensive synthetic and package-consumer tests.
  • Documents diagnostics and the emergency opt-out.
File Description
BUILDGUIDE.md Documents validation and testing.
Logging.targets Implements family-version checks.
Logging.csproj Packages the targets.
PackageReadme.md Documents consumer behavior.
RunVersionChecks.ps1 Adds the regression matrix.

🧠 Review effort: Balanced


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

@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.87%. Comparing base (c7ab087) to head (7910b81).
⚠️ Report is 26 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (c7ab087) and HEAD (7910b81). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (c7ab087) HEAD (7910b81)
CI-SqlClient 2 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4815      +/-   ##
==========================================
- Coverage   72.40%   65.87%   -6.54%     
==========================================
  Files         292      286       -6     
  Lines       45471    68619   +23148     
==========================================
+ Hits        32924    45201   +12277     
- Misses      12547    23418   +10871     
Flag Coverage Δ
CI-SqlClient ?
PR-SqlClient-Project 65.87% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@paulmedynski paulmedynski added the Area\Azure Connectivity Use this to tag issues that are related to Azure connectivity. label Oct 13, 2026
@paulmedynski paulmedynski added this to the 8.0.0-preview1 milestone Oct 13, 2026
@paulmedynski paulmedynski changed the title Validate installed SqlClient family versions from Logging packages AOT 1: Validate installed SqlClient family versions from Logging packages Oct 13, 2026
Comment thread BUILDGUIDE.md Resolved
paulmedynski added a commit that referenced this pull request Oct 13, 2026
Support project-specific legacy manifests with NuGet precedence.
Convert version checks to Pester and invoke them directly from YAML.
Run checks in PR Logging test jobs and OneBranch package validation.
Document pinned PowerShell tooling and regression coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 13, 2026 13:31

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

The stated test command references a missing script, and its reported command count does not match the current suite.

1 open finding
2 resolved since last review

🧠 Review effort: Balanced

paulmedynski added a commit that referenced this pull request Oct 13, 2026
Run pinned PowerShell commands through DotNetCoreCLI tasks.
Document test intent and remove YAML-wiring tests in favor of pipeline runs.
Update the documented Pester command to run only version-check tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 13, 2026 15:59

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

The claimed eight pipeline-wiring tests are absent, making the reported 582-test validation unreproducible.

1 open finding
3 resolved since last review

🧠 Review effort: Balanced

@paulmedynski

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.

Copilot AI balanced review requested due to automatic review settings October 13, 2026 17:41
@paulmedynski
paulmedynski removed this pull request from stack #4822 October 13, 2026 17:44
@paulmedynski
paulmedynski changed the base branch from dev/paul/aot/phase-1.0 to dev/paul/aot/phase-1.01 October 13, 2026 17:45
@paulmedynski
paulmedynski added this pull request to stack #4839 October 13, 2026 17:45

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

The pipeline introduces an ungoverned PSGallery dependency and an unrelated default validation-policy change.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced

@paulmedynski paulmedynski changed the title AOT 1: Validate installed SqlClient family versions from Logging packages AOT 2: Validate installed SqlClient family versions from Logging packages Oct 13, 2026
paulmedynski added a commit that referenced this pull request Oct 13, 2026
Remove the shared Pester step and dedicated Logging test jobs.
Keep the family-version regression suite available for local execution.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 13, 2026 19:31
@mdaigle mdaigle moved this from To triage to In review in SqlClient Board Oct 20, 2026
paulmedynski and others added 2 commits October 21, 2026 14:09
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address review feedback: SqlClient depends on every other family
package, so it now owns the consumer target and anchors the check on
its own resolved version. Logging is checked like any other member.

- Rename the target to Microsoft.Data.SqlClient.targets and pack it into
  build/ and buildTransitive/ via the SqlClient nuspec.
- Stop packing the target from the Logging package.
- Move the Pester suite to tests/VersionChecks; consumer tests use a
  fixture SqlClient package carrying the real target, plus a check
  that the real nuspec packs it.
- Move package readme docs to SqlClient and update BUILDGUIDE.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 21, 2026 17:31

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

The stated consumer contract conflicts with implementation, and cross-version NuGet/MSBuild compatibility remains unverified.

2 open issues

Review effort: Balanced

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 21, 2026 19:45

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

Consumer build integration lacks independently verified execution, and the regression suite is not run in CI.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

Downgrade XmlPeek failures on a malformed packages.config to warnings so the
version check never fails a consumer build on its own, and document the
target's limitations: it depends on .NET SDK/NuGet targets and metadata,
silently skips builds that lack them, and only checks inner builds of
multi-targeting projects.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 22, 2026 11:06

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

Automatically imported consumer build logic warrants maintainer verification because its regression suite is local-only and was not independently executed during review.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 22, 2026 11:09

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

The automatically imported consumer-build target warrants human validation because its regression suite remains outside CI and was not independently executed during this review.

No open issues 🎉

Review effort: Balanced

@paulmedynski
paulmedynski enabled auto-merge (squash) October 22, 2026 14:16
Copilot AI balanced review requested due to automatic review settings October 22, 2026 15:21

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

The automatically imported consumer-build target warrants human validation because its regression suite is local-only and was not executed during this review.

No open issues 🎉

Review effort: Balanced

@paulmedynski
paulmedynski merged commit 568f4d9 into main Oct 22, 2026
123 checks passed
@paulmedynski
paulmedynski deleted the dev/paul/aot/phase-1.1 branch October 22, 2026 17:59
@github-project-automation github-project-automation Bot moved this from In review to Done in SqlClient Board Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Azure Connectivity Use this to tag issues that are related to Azure connectivity. Breaking Change 🔨 Issues/PRs that are related with breaking API changes in the driver.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants