Repository navigation
Only fail Dependencies.props CodeCheck for non-Maestro dependency changes - #68097
Merged
wtgodbe merged 2 commits intoJul 30, 2026
Merged
Conversation
…ency changes The CodeCheck added in dotnet#68012 flagged any add/remove in eng/Dependencies.props as requiring a matching update to eng/tools/DependabotDiscovery/DependabotDiscovery.csproj. This incorrectly fires when a Maestro-managed package is renamed (as in dotnet#68014), since that shows up as one add + one remove even though DependabotDiscovery.csproj never referenced it (Maestro-managed packages are excluded, see the project's README). Now the check compares the set of <LatestPackageReference Include="..." /> names before/after and only requires a DependabotDiscovery.csproj update when an added or removed package has no matching version property in eng/Version.Details.props (i.e. isn't managed by Maestro). Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates eng/scripts/CodeCheck.ps1 so the “Dependabot discovery project must be updated when eng/Dependencies.props changes” rule only fails when the change adds/removes dependencies that aren’t Maestro-managed (as identified via version properties in eng/Version.Details.props). This reduces false failures for Maestro-only renames.
Changes:
- Compute the set of added/removed
<LatestPackageReference Include="...">entries by diffing target-branch vs working tree. - Determine whether changed packages are Maestro-managed by checking for corresponding
$(...Version)properties ineng/Version.Details.props(unioning both old and new versions). - Only error when
DependabotDiscovery.csprojwasn’t updated and at least one changed package is non-Maestro-managed.
Comments suppressed due to low confidence (1)
eng/scripts/CodeCheck.ps1:257
- Get-MaestroManagedVersionProperties has the same
return , $propertiesissue as above (it returns an array containing the HashSet). Additionally, the regex only matches tags of the form and will miss properties if they ever gain attributes (e.g. ). Returning a non-enumerated HashSet and using a '\b' boundary makes the extraction more robust.
function Get-MaestroManagedVersionProperties([string[]]$fileContent) {
$properties = [System.Collections.Generic.HashSet[string]]::new()
foreach ($line in $fileContent) {
if ($line -match '<(\w+Version)>') {
[void]$properties.Add($matches[1])
}
}
return , $properties
}
…tern, cover all DependabotDiscovery exclusion categories Copilot's automated review on dotnet#68097 caught two real bugs: - The Include="..." regex only matched self-closing tags with no other attributes, silently missing entries like <LatestPackageReference Include="xunit.v3" Version="$(XunitV3Version)" />. Fixed with a regex that tolerates any attributes/tag layout, and now joins file content into one string so a tag split across lines is still matched. - 'return , $x' combined with inconsistent @(...) wrapping at call sites caused double array-wrapping in some paths, silently shrinking the Maestro-managed-properties set from ~440 entries to 1-2. Removed the comma-trick entirely; every call site now consistently wraps in @(...). Additionally, two independent review agents pointed out that eng/tools/DependabotDiscovery/README.md documents more exclusion categories than just Maestro: packages pinned via the shared $(IdentityModelVersion) property, packages mapped to an in-repo project via ProjectReferenceProvider (eng/ProjectReferences.props), and two hard-coded packages (NETStandard.Library, Microsoft.CodeAnalysis.PublicApiAnalyzers). The check now recognizes all of these, matching the original error message's intent ('isn't managed by Maestro or the shared $(IdentityModelVersion) property'). Verified end-to-end in isolated worktrees against the real repo history: - PR dotnet#68014's actual rename (Maestro-managed) - passes - A synthetic new, non-excluded package addition - still fails as expected - A full IdentityModel-managed rename (Dependencies.props + Versions.props) - passes - A ProjectReferenceProvider-mapped name - passes - The hard-coded NETStandard.Library exclusion - passes Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
eng/scripts/CodeCheck.ps1:260
- Get-LatestPackageReferenceNames currently treats any Include attribute value as a package name, but eng/Dependencies.props contains a non-package item transform Include="@(_LatestRuntimePackageReference->Distinct())". If that expression ever changes, it will be treated as an added/removed "package" and will likely trigger an incorrect DependabotDiscovery sync failure (and it also can't be mapped to a *Version property name reliably). Filter out item transforms (values starting with '@(') so this helper only returns concrete package IDs.
function Get-LatestPackageReferenceNames([string[]]$fileContent) {
$text = $fileContent -join "`n"
return [regex]::Matches($text, '<LatestPackageReference\b[^<>]*?\bInclude="([^"]+)"') |
ForEach-Object { $_.Groups[1].Value } |
Sort-Object -Unique
JoeRobich
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
CodeCheck.ps1check added in #68012 requireseng/tools/DependabotDiscovery/DependabotDiscovery.csprojto be updated whenevereng/Dependencies.propschanges at all. This is too broad: it also fires when a package that's already managed by Maestro is renamed (as in #68014), even thoughDependabotDiscovery.csprojnever referenced that package in the first place (Maestro-managed dependencies are explicitly excluded from it, per itsREADME.md).A rename shows up as one
<LatestPackageReference Include="..." />removed and one added, which the old check couldn't distinguish from a genuinely new/removed third-party dependency.Change
The check now:
<LatestPackageReference Include="..." />names ineng/Dependencies.propsbetween the target branch and the current tree to find only the packages that were actually added or removed.%(Identity)->$(...Version)convention already used ineng/Dependencies.props) and checks whether that property is defined ineng/Version.Details.props(checking both the target-branch and current versions, so renames into/out of a Maestro-managed name are recognized either way).DependabotDiscovery.csprojwasn't updated and at least one of the added/removed packages isn't Maestro-managed.Verified against #68014's actual diff (rename of
Microsoft.CodeAnalysis.ExternalAccess.AspNetCoretoMicrosoft.CodeAnalysis.Features.ExternalAccess, both Maestro-managed): the check now passes without touchingDependabotDiscovery.csproj. Also verified it still fails when a genuinely new, non-Maestro package is added without a matchingDependabotDiscovery.csprojupdate.Co-authored-by: Copilot [email protected]