Repository navigation
Make isolated graph builds fail deterministically on undeclared cross-project targets - #14280
Conversation
|
Hello @copilot, I noticed that you’re changing an .swr file or any file under src/Package/MSBuild.VSSetup.. Please make sure to validate this change by an experimental VS insertion. This is accomplished by pushing to an exp/* branch, which requires write permissions to this repo. |
|
@copilot fix the failing checks |
Fixed. The failing checks were caused by a compile error in |
There was a problem hiding this comment.
Pull request overview
This PR makes -graph -isolate builds fail deterministically when a project invokes an undeclared cross-project target, eliminating scheduling-dependent behavior where node-local cached dependency results could accidentally satisfy an invalid ProjectReferenceTargets protocol reference.
Changes:
- Adds an isolation-aware gate to results-cache satisfaction so only graph-declared top-level targets can be reused across projects in strict isolation (ChangeWave 18.10 gated).
- Threads the “allowed top-level targets” restriction through scheduler and build-request-engine cache satisfaction paths.
- Adds regression/unit tests and documents the new ChangeWave behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Framework/ChangeWaves.cs | Adds ChangeWave 18.10 to support opt-out for the new deterministic isolation behavior. |
| src/Build/BackEnd/Shared/BuildRequestConfiguration.cs | Computes “allowed top-level targets” for strict isolation cache satisfaction. |
| src/Build/BackEnd/Components/Scheduler/Scheduler.cs | Passes isolation “allowed targets” through scheduler cache satisfaction to enforce deterministic failures. |
| src/Build/BackEnd/Components/Caching/IResultsCache.cs | Extends SatisfyRequest API with optional allowedTopLevelTargets gate. |
| src/Build/BackEnd/Components/Caching/ResultsCache.cs | Implements the isolation gating check inside cache satisfaction. |
| src/Build/BackEnd/Components/Caching/ResultsCacheWithOverride.cs | Threads the new allowedTopLevelTargets argument through override cache implementation. |
| src/Build/BackEnd/Components/BuildRequestEngine/BuildRequestEngine.cs | Applies the same isolation gate to node-local cache satisfaction in request issuance. |
| src/Build.UnitTests/Graph/IsolateProjects_Tests.cs | Adds regression tests covering deterministic MSB4252 behavior + ChangeWave opt-out behavior. |
| documentation/wiki/ChangeWaves.md | Documents ChangeWave 18.10 and the opt-out knob for this behavioral change. |
Expert review — PR #14280 · 9 files, +222/−12Methodology: portable core + dotnet/msbuild expert-reviewer · 24/24 dimensions evaluated · Mode: Deep Verdict: 🟡 COMMENT — address findings — 0 blocking, 0 major, 3 moderate, 2 nit · 20 of 24 evaluated dimensions clean The fix is well-reasoned and correct in the scenarios I traced. A forced cache miss under strict isolation routes to
|
Expert review update — PR #14280 @ 4408138I re-reviewed the current head after the latest fixes. I found one issue that should be addressed before merge. Major: persisted input/output caches bypass the new strict-isolation allow-list
That is fine for live node packets, because Relevant lines:
Concrete scenario: build a referenced project in strict isolation with an output cache, where the graph-declared entry target is Recommendation: persist I did not find other blocking issues in the 9-file PR diff. I did not run the test suite for this review. |
Expert review update — PR #14280 @ 64146a7I re-reviewed the current head after the persisted-cache fix. No remaining actionable findings from the 10-file PR diff. The previous major issue is addressed: Relevant fixed coverage:
Validation I ran:
Residual risk: the new test directly covers the serialization member that caused the cache bypass, and the existing graph test covers the in-memory cache leak path. I still do not see a full end-to-end test that writes a strict-mode output cache and consumes it later as an input cache, but I do not consider that a blocking gap now that the serialization path itself is covered. |
…ets (fix MSB4252 scheduling nondeterminism, #14225) Co-authored-by: AlesProkop <[email protected]>
Co-authored-by: AlesProkop <[email protected]>
…r; exempt SkipNonexistentTargets Add Wave18_10 opt-out for the deterministic MSB4252 behavior, consolidate the duplicated GetIsolationAllowedTopLevelTargets into BuildRequestConfiguration, exempt SkipNonexistentTargets requests from the gate, and add enabled/disabled regression tests.
Co-authored-by: Copilot <[email protected]> Copilot-Session: 944d33d8-0a06-4cba-ba75-dc66ff131146
4492215 to
52aa5c8
Compare
Updated [Microsoft.Build](https://github.com/dotnet/msbuild) from 18.11.0 to 18.12.2. <details> <summary>Release notes</summary> _Sourced from [Microsoft.Build's releases](https://github.com/dotnet/msbuild/releases)._ ## 18.12.2 ## What's Changed * [TaskAnalyzer] Align diagnostic severities and ignore open generic ITaskItem<T> by @VolPlita in dotnet/msbuild#14811 * Add multi-threading option to build response file by @ViktorHofer in dotnet/msbuild#14837 * Anchor MSBuildTask0003 code fix on the flagged call and withhold it where TaskEnvironment cannot bind by @ViktorHofer with @Copilot in dotnet/msbuild#14810 * Bump main to 18.12 after the vs18.11 branch snap by @ViktorHofer in dotnet/msbuild#14841 * Report MSBuildTask0005 at the unsafe call site so it can be suppressed there by @ViktorHofer with @Copilot in dotnet/msbuild#14829 * Revert "Add multi-threading option to build response file" by @ViktorHofer in dotnet/msbuild#14851 * [main] Source code updates from dotnet/dotnet by @dotnet-maestro[bot] in dotnet/msbuild#14853 * [main] Update dependencies from dotnet/arcade by @dotnet-maestro[bot] in dotnet/msbuild#14854 * Update MicrosoftBuildVersion in analyzer template by @github-actions[bot] in dotnet/msbuild#14565 * Revert "Revert "Add multi-threading option to build response file"" by @ViktorHofer in dotnet/msbuild#14855 * Fix stale gh-aw-actions/setup pin causing "activation" job failure by @JanProvaznik with @Copilot in dotnet/msbuild#14842 * Make isolated graph builds fail deterministically on undeclared cross-project targets by @AlesProkop with @Copilot in dotnet/msbuild#14280 * Revise temp path handling in README by @baronfel in dotnet/msbuild#14834 * Fix BuildCheck rule configuration and task name casing bug by @AR-May in dotnet/msbuild#14778 * Remove MSBuildImportedProject item from the XSD by @drewnoakes in dotnet/msbuild#14659 * [main] Source code updates from dotnet/dotnet by @dotnet-maestro[bot] in dotnet/msbuild#14866 * Require ready-for-training tag for OptProf by @AlesProkop in dotnet/msbuild#14867 * Ignore stale MSBuild server console writes by @JanProvaznik in dotnet/msbuild#14850 * Regenerate Expert Code Review workflow lock by @JanProvaznik with @Copilot in dotnet/msbuild#14870 * [main] Update dependencies from dotnet/arcade by @dotnet-maestro[bot] in dotnet/msbuild#14896 * [main] Update dependencies from dotnet/roslyn by @dotnet-maestro[bot] in dotnet/msbuild#14900 * [main] Update dependencies from nuget/nuget.client by @dotnet-maestro[bot] in dotnet/msbuild#14669 * [main] Source code updates from dotnet/dotnet by @dotnet-maestro[bot] in dotnet/msbuild#14886 * Expose AbsolutePath.GetCanonicalForm() by @JanProvaznik with @Copilot in dotnet/msbuild#14873 * Make release checklist step 1.3 a full branch-retirement audit by @ViktorHofer in dotnet/msbuild#14911 * Resolve PathLike MatchOnMetadata against the thread working directory by @JanProvaznik in dotnet/msbuild#14916 * Fix typo in project dependency explanation by @DanexisIbrahimAbtula in dotnet/msbuild#14885 * Preserve events routed through the TaskHostTask by @AR-May in dotnet/msbuild#14876 * Fix NormalizePath and other intrinsic functions in multithreaded mode by @AR-May in dotnet/msbuild#14875 * Bump actions/checkout from 7.0.0 to 7.0.1 by @dependabot[bot] in dotnet/msbuild#14887 * Bump github/gh-aw-actions/setup-cli from 0.87.2 to 0.87.9 by @dependabot[bot] in dotnet/msbuild#14888 * Bump github/gh-aw-actions/setup from 0.82.9 to 0.87.9 by @dependabot[bot] in dotnet/msbuild#14889 * Upgrade gh-aw to v0.88.2 and recompile agentic workflow lock files by @AR-May in dotnet/msbuild#14935 * Preserve error detail when ContinueOnError downgrades an error to a warning by @AR-May in dotnet/msbuild#14918 * Fix Dependabot ignore rule to match gh-aw-actions sub-path actions by @AR-May in dotnet/msbuild#14938 * [Flaky Test] Quarantine 1 flaky test (TaskEnvironment) by @github-actions[bot] in dotnet/msbuild#14662 * Fix template path in quarantine pipeline by @AR-May in dotnet/msbuild#14937 * Run expert code review when a draft PR is marked ready for review by @AR-May in dotnet/msbuild#14952 * [Dreaming] dreaming: clarify RenderImmediateMessage as the correct path for immediate TerminalLogger output by @github-actions[bot] in dotnet/msbuild#14381 * [Dreaming] Clarify: don't hardcode backslash path separators in test XML by @github-actions[bot] in dotnet/msbuild#14973 * Regenerate review-on-open lock file by @AR-May in dotnet/msbuild#14977 * Recognize AbsolutePath.Value canonicalization in task analyzers by @JanProvaznik in dotnet/msbuild#14970 * improve issue and pr templates based on history by @JanProvaznik in dotnet/msbuild#14982 * Detect environment-dependent temp helpers in TaskAnalyzer by @ViktorHofer with @Copilot in dotnet/msbuild#14975 * Document registered task object semantics in multithreaded builds by @JanProvaznik in dotnet/msbuild#14919 * Add server-only MSBUILDDEBUGONSTART modes by @JanProvaznik in dotnet/msbuild#14988 * Preserve manifest input streams when writing manifests by @dtivel in dotnet/msbuild#14883 * Scope MT-specific TaskAnalyzer diagnostics and support .editorconfig by @VolPlita in dotnet/msbuild#14775 * [main] Update dependencies from dotnet/arcade by @dotnet-maestro[bot] in dotnet/msbuild#14948 ... (truncated) Commits viewable in [compare view](dotnet/msbuild@v18.11.0...v18.12.2). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Fixes #14225
In
-graph -isolatebuilds, a cross-project reference to a target that only has results because it ran as aDependsOnTargetsdependency could be satisfied from a node-local (or in-proc shared) results cache when the referenced project happened to run on the same node, but miss and fail with MSB4252 when it ran on a different node. This made an incompleteProjectReferenceTargetsprotocol scheduling-dependent —/m:1passes,/m:8intermittently fails.Context
The presence of a result in the engine cache is the de-facto validation of the
ProjectReferenceTargetsprotocol: the static graph pre-builds each node with its declared entry targets, so only those results land in the shared cache. However, dependency-produced target results also accumulate in a node's local cache and can satisfy an undeclared cross-project reference, but only under scheduling where parent and child share a node. The result of an isolated build should not depend on node scheduling.Changes Made
Non-destructive gate: an isolated cross-project reference may only be satisfied from the results cache when the requested targets are among the referenced configuration's explicitly-requested (graph-declared) top-level targets. Otherwise it is treated as a cache miss, so the existing isolation constraint check fires and reports MSB4252 consistently.
IResultsCache/ResultsCache/ResultsCacheWithOverride: added optionalallowedTopLevelTargetsparameter toSatisfyRequest. When set, all requested targets (or config default targets) must be contained in it (case-insensitive) or the request is reported unsatisfied.Scheduler: newGetIsolationAllowedTopLevelTargetshelper threaded throughTrySatisfyRequestFromCacheand both cache-satisfaction sites (HandleRequestBlockedByNewRequests,ResolveRequestFromCacheAndResumeIfPossible).BuildRequestEngine.IssueBuildRequests: gated the node-localSatisfyRequestpath the same way.BuildRequestConfiguration.RequestedTargetsand applies only underProjectIsolationMode.True, for non-root, non-SkipStaticGraphIsolationConstraintsrequests, exempting self-references (a project building itself). EmptyRequestedTargetsfalls back to existing behavior.Testing
Manual repro from the issue (
root/Parent/Child+ fillers) now fails consistently with MSB4252 under both/m:1and/m:8, instead of passing only under/m:1.Notes
ProjectIsolationMode.True);MessageUponIsolationViolationand non-isolated builds retain existing behavior.BuildRequestEngine.ReportConfigurationResponsecache path is intentionally not gated — its local cache is empty in the leak-relevant scenarios and its unresolved config'sRequestedTargetsis unreliable there.