Skip to content

Commit 51edbf7

Browse files
EvangelinkCopilot
andauthored
Fix Dependabot discovery of bundled Playwright; bump to 1.61.0 (#9508)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4fd64bc commit 51edbf7

2 files changed

Lines changed: 33 additions & 25 deletions

File tree

Directory.Packages.props

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@
138138
Declare below packages that are bundled through MSTest.Sdk (baked into the shipped SDK
139139
templates) and are not otherwise consumed by a restored project, so that Dependabot can
140140
discover and update them. They are referenced only inside the SDK feature targets
141-
(Sdk/Features/*.targets, which Dependabot doesn't restore); their only graph-visible reference
142-
from a repo project restore is the inert anchor described in condition 2 below.
141+
(Sdk/Features/*.targets, which Dependabot doesn't restore); their only Dependabot-visible
142+
reference from a repo project is the inert anchor described in condition 2 below.
143143
144144
Two conditions must BOTH hold for Dependabot to bump one of these, and missing either one
145145
silently stops the updates:
@@ -149,17 +149,19 @@
149149
PackageVersion whose Version is an MSBuild property interpolation.
150150
See dependabot/dependabot-core#5812 and dependabot/dependabot-core#7183.
151151
152-
2. The package MUST appear in the repo's restore graph via a graph-visible reference:
152+
2. The package MUST be referenced by a project via a PackageReference that Dependabot reads:
153153
Dependabot only updates a CPM PackageVersion that is actually referenced by a project;
154154
an "orphan" PackageVersion (declared here but referenced nowhere) is ignored. Because
155155
these packages are only baked into the shipped SDK templates (Sdk/Features/*.targets)
156156
and never referenced by a built project, we add inert anchor references in
157157
test/IntegrationTests/MSTest.Acceptance.IntegrationTests/MSTest.Acceptance.IntegrationTests.csproj.
158-
The anchor MUST be a PackageDownload, NOT a PackageReference with ExcludeAssets="all":
159-
ExcludeAssets="all" removes the reference from the dependency graph Dependabot reads, so
160-
the package stays invisible and never gets bumped. PackageDownload keeps it in the restore
161-
graph (so Dependabot proposes bumps) without flowing any of its assets into the project.
162-
Without a graph-visible anchor Dependabot never proposed bumps (see #9362).
158+
The anchor MUST be a PackageReference (ExcludeAssets="all" is fine - it only stops the
159+
package's assets from flowing into the project; it does NOT hide the reference from
160+
Dependabot, which reads the PackageReference XML node, not the asset-flow rules). It must
161+
NOT be a PackageDownload: Dependabot does not read PackageDownload items at all
162+
(dependabot/dependabot-core#2502), so a PackageDownload anchor is invisible to it. Using a
163+
PackageDownload as the anchor is exactly why Playwright silently stopped updating (see
164+
#9362 / #9452); the PackageReference anchor is what makes the bumps flow.
163165
164166
Each literal version is duplicated as the matching *Version property (defined near the top of
165167
this file) which is the value actually consumed by the build and baked into the MSTest.Sdk

test/IntegrationTests/MSTest.Acceptance.IntegrationTests/MSTest.Acceptance.IntegrationTests.csproj

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,33 @@
4444

4545
<!--
4646
Dependabot anchors for the packages bundled by MSTest.Sdk (Microsoft.Playwright.MSTest.v4,
47-
Aspire.Hosting.Testing). The Aspire entry doubles as the download that stages its nupkg for
48-
test assets (see CopyNuGetPackagesForTestAssets below); the Playwright entry is the Dependabot
49-
anchor only. These packages are baked into the shipped SDK templates (Sdk/Features/*.targets)
50-
and are otherwise referenced only there (which Dependabot doesn't restore), so without a
51-
graph-visible reference from a repo project their Central Package Management PackageVersion
52-
entries in Directory.Packages.props are "orphans" that Dependabot ignores (it only updates
53-
package versions that are actually referenced by a restored project).
47+
Aspire.Hosting.Testing). These are baked into the shipped SDK templates (Sdk/Features/*.targets)
48+
and are otherwise referenced only there (which Dependabot doesn't restore), so their Central
49+
Package Management PackageVersion entries in Directory.Packages.props are "orphans" that
50+
Dependabot ignores unless a project references them.
5451
55-
We use PackageDownload (NOT a PackageReference with ExcludeAssets="all") deliberately:
56-
ExcludeAssets="all" removes the reference from the dependency graph Dependabot reads, so the
57-
package stays invisible to it and never gets bumped (Aspire only kept updating because it ALSO
58-
had this PackageDownload; the equivalent Playwright anchor with ExcludeAssets="all" silently did
59-
nothing, see #9362). PackageDownload puts the package into the restore (so Dependabot proposes
60-
bumps) without flowing any of its assets (compile/runtime/build, e.g. Playwright's browser
61-
install) into this test project. The _ValidateBundledSdkFeatureVersions target in
62-
Directory.Packages.props then guards the matching version properties (MicrosoftPlaywrightVersion,
63-
AspireHostingTestingVersion) against drift after a bump.
52+
The PackageReference (with ExcludeAssets="all") is the Dependabot ANCHOR: Dependabot reads the
53+
PackageReference XML node to discover the dependency and bump its CPM PackageVersion.
54+
ExcludeAssets="all" only stops the package's assets (compile/runtime/build, e.g. Playwright's
55+
browser install) from flowing into this test project - it does NOT hide the reference from
56+
Dependabot. A PackageDownload does NOT work as the anchor: Dependabot does not read
57+
PackageDownload items at all (dependabot/dependabot-core#2502). Using PackageDownload as the
58+
anchor is exactly why Playwright silently stopped updating - see #9362 / #9452.
59+
60+
Dependabot only bumps the literal PackageVersion in Directory.Packages.props, not the matching
61+
*Version property the build consumes; the _ValidateBundledSdkFeatureVersions target in
62+
Directory.Build.targets fails the build if the two drift apart, so a maintainer reconciles the
63+
property in the Dependabot PR.
6464
-->
65+
<ItemGroup>
66+
<PackageReference Include="Aspire.Hosting.Testing" ExcludeAssets="all" />
67+
<PackageReference Include="Microsoft.Playwright.MSTest.v4" ExcludeAssets="all" />
68+
</ItemGroup>
69+
70+
<!-- Packages needed to stage nupkgs for the generated test assets (see
71+
CopyNuGetPackagesForTestAssets below) but that we don't want to reference. -->
6572
<ItemGroup>
6673
<PackageDownload Include="Aspire.Hosting.Testing" Version="[$(AspireHostingTestingVersion)]" />
67-
<PackageDownload Include="Microsoft.Playwright.MSTest.v4" Version="[$(MicrosoftPlaywrightVersion)]" />
6874
</ItemGroup>
6975

7076
<Target Name="CopyNuGetPackagesForTestAssets" BeforeTargets="BeforeBuild">

0 commit comments

Comments
 (0)