dotnet / dotnet/msbuild

BuildCheck scope classifier: improve initialization

Open
#10,506 0 comments 0 reactions 0 assignees View on GitHub
10.0 Area: BuildCheck Priority:1 triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 19h
Merged PRs (30d)
135

Description

### Context

`CheckScopeClassifier` uses `FileScopeClassifier` that is initialized from build request data. This is fine for worker nodes (and by extension for Scheduler node with in-proc worker node), but in case the in-proce worker node is disabled - we currently rely on data from end of evaluation:

https://github.com/dotnet/msbuild/blob/b7e76d1d171ef74adec2f3b5e79a5b586a7e7020/src/Build/BuildCheck/Infrastructure/BuildCheckManagerProvider.cs#L335-L346

This has couple implications:
* The scoping might not work properly for evaluation time data
* The Check code might not be able to tell when the scoping is safe to use

### Goals

In ideal case we'd be able to initialize `FileScopeClassifier` early during the request, before any BuildCheck data is created. This might very likely be possible - as the properties required are already part of the request (not derived during the evaluation).

In case we are not able to guarantee that - we should expose some eventing that can help Checks to buffer data and wait with scoping till the scoping is fully functional

### Additional goals

We need to ensure that scoping in the build-in checks (PropertiesCheck, NoEnvVarCheck) is working properly

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at BuildCheckManagerProvider.cs around lines 335-346 and trace how CheckScopeClassifier and FileScopeClassifier receive build request data. Inspect the initialization paths for evaluation-time data, then review PropertiesCheck and NoEnvVarCheck to determine how their scoping depends on classifier readiness. Done means early initialization is guaranteed or checks can safely defer scoping until it is functional.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.