Repository navigation
Add location-gated AGENTS.md guidance for key src and test subtrees - #55198
Conversation
Add nested, auto-loaded AGENTS.md files that give agents area-specific guidance only when editing the relevant subtree, keeping the root instructions lean. Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
Pull request overview
Adds subtree-scoped AGENTS.md files to provide area-specific guidance for agents when working under key src/ and test/ directories, keeping root agent instructions shorter while still documenting important local conventions.
Changes:
- Introduces a
test/AGENTS.mdwith test-tree conventions (parallelism, skips, Verify snapshots, Helix partitioning). - Adds component-specific agent guidance under
src/for Tasks, Resolvers, Layout, CLI, Containers, dotnet-watch, and NetAnalyzers. - Documents a few area-specific invariants (e.g., diagnostic conventions in Tasks, resolver build gating, layout versioning flow).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/AGENTS.md | Adds test-area guidance (parallelism defaults, skips, Verify snapshots, Helix partitioning). |
| src/Tasks/AGENTS.md | Documents Tasks layout and diagnostics conventions (NETSDK messages, resx/xlf workflow). |
| src/Resolvers/AGENTS.md | Describes resolver projects and key constraints (linked sources, target frameworks, hostfxr interop, dependency pinning). |
| src/Microsoft.CodeAnalysis.NetAnalyzers/AGENTS.md | Adds guidance for analyzer development and release tracking conventions. |
| src/Layout/AGENTS.md | Documents layout’s role and versioning/bundling invariants. |
| src/Dotnet.Watch/AGENTS.md | Adds guidance for dotnet-watch structure, shared projitems, and test parallelism expectations. |
| src/Containers/AGENTS.md | Documents container feature structure, diagnostics code scheme, env var conventions, and test types. |
| src/Cli/AGENTS.md | Documents CLI project split, where code lives, and Verify snapshot test workflow. |
Drop the misleading claim that Microsoft.NET.TestFramework namespaces are exposed as global usings; those usings are xUnit-only and will be removed as the repo completes the MSTest transition. Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Frame the ''Where things live'' intro around the actionable rule: code added to Microsoft.NET.Build.Tasks or Microsoft.NET.Build.Extensions.Tasks must stay net472-compatible. Common is linked shared source that inherits the constraint, and sdk-tasks is current-.NET-only. Co-authored-by: Copilot App <[email protected]>
| - **Don't raise parallelism.** MSTest is repo-defaulted to `None` in | ||
| `test/Directory.Build.props` because of concurrency flakiness; a few projects opt | ||
| into `ClassLevel`. Cranking it up causes Helix over-subscription/timeouts. | ||
| - **Skips must point to a tracking issue URL** — `[Ignore("https://github.com/dotnet/sdk/issues/N")]`. |
There was a problem hiding this comment.
question: does this work for both MSTest and Xunit projects? Or only one?
There was a problem hiding this comment.
This is MSTest-specific ([Ignore]). The repo is standardizing test projects on MSTest, so this file is written MSTest-forward; the xUnit equivalent would be [Fact(Skip="...")], but new and converted tests should use MSTest. The underlying convention -- a skip must cite a tracking issue -- applies regardless.
| into `ClassLevel`. Cranking it up causes Helix over-subscription/timeouts. | ||
| - **Skips must point to a tracking issue URL** — `[Ignore("https://github.com/dotnet/sdk/issues/N")]`. | ||
| - **Verify (approval) snapshots**: `*.verified.*` is checked in; the runner writes a | ||
| git-ignored `*.received.*` on mismatch — promote received → verified when you change |
There was a problem hiding this comment.
issue: *.received.* files are not universally git-ignored. The root rule covers only CompletionTests snapshots, while MTPHelpSnapshotTests writes under CommandTests/Test/snapshots, which has no corresponding ignore rule.
References: root ignore rule, MTP snapshot directory
| to load and breaks tests. | ||
| - **Hot Reload protocol differs per app model.** .NET Core apps use a binary | ||
| named-pipe protocol; Blazor WASM uses JSON over WebSocket. Each `*AppModel` has its | ||
| own `IHotReloadClient`; a new app model needs its own protocol implementation. |
There was a problem hiding this comment.
issue: There is no IHotReloadClient.
| - **Diagnostics use `CONTAINER####` codes** — a self-contained scheme, *not* the | ||
| `NETSDK####` sequence from `src/Tasks`. | ||
| - **Registry behavior is tuned via `DOTNET_CONTAINER_*` env vars**, each with a legacy | ||
| `SDK_CONTAINER_*` alias — keep both when adding one. |
There was a problem hiding this comment.
issue: This is not universally true. For example, the push/pull credential variables and DOTNET_CONTAINER_INSECURE_REGISTRIES have no corresponding SDK_CONTAINER_* alias.
@baronfel, what is the expectation for new environment variables? DOTNET_CONTAINER_* only? I want to avoid encoding false assumptions here.
References: push/pull credential variables, insecure registries variable
There was a problem hiding this comment.
Fixed in 0458134 -- reworded to describe the current state (newer vars like the push/pull credentials and DOTNET_CONTAINER_INSECURE_REGISTRIES are DOTNET_CONTAINER_* only). If the intended convention is to always add an SDK_CONTAINER_* alias for new vars, I'm happy to re-add that as forward guidance (@baronfel).
| ## Tests | ||
|
|
||
| - Unit: `test/Microsoft.NET.Build.Containers.UnitTests` (MSTest) — run everywhere. | ||
| - Integration: `test/Microsoft.NET.Build.Containers.IntegrationTests` **require a |
There was a problem hiding this comment.
Not all tests in the integration project require a daemon. ParseContainerPropertiesTests, for example, performs in-process project evaluation. Tests that do require Docker can opt into DockerUnavailableCondition.
suggestion: distinguish between integration tests that do and do not require a container runtime instead of describing the entire project as requiring Docker/Podman.
References: ParseContainerPropertiesTests, DockerUnavailableCondition
|
|
||
| The same definition tree is parsed by both the managed and AOT hosts, so | ||
| parser/option/description changes flow to AOT and `--help` automatically. Keep heavy | ||
| deps out of `Definitions` and behind `#if !CLI_AOT` / `[RequiresDynamicCode]`. |
There was a problem hiding this comment.
#if !CLI_AOT and [RequiresDynamicCode] are not interchangeable ways to keep dependencies out of the AOT build. The bridge selects shared source explicitly and uses CLI_AOT for conditional paths; [RequiresDynamicCode] only annotates a managed API and does not exclude its dependencies from compilation.
References: AOT source sharing and conditional compilation, PackCommand annotation
Only some snapshot directories (e.g. CompletionTests) have a .gitignore rule for *.received.* files; MTP snapshots under CommandTests/Test/snapshots do not. Keep the actionable rule (never commit received files) and note the ignore is partial. Co-authored-by: Copilot App <[email protected]>
There is no IHotReloadClient interface. The base type is the abstract class HotReloadClient, with concrete per-protocol subclasses DefaultHotReloadClient and WebAssemblyHotReloadClient. Co-authored-by: Copilot App <[email protected]>
Not every DOTNET_CONTAINER_* variable has an SDK_CONTAINER_* alias: the push/pull credential variables and DOTNET_CONTAINER_INSECURE_REGISTRIES are DOTNET_CONTAINER_* only. Describe the actual state rather than implying a universal alias. Co-authored-by: Copilot App <[email protected]>
Only tests that opt into DockerUnavailableCondition require Docker/Podman and skip when absent; others run in-process without a container runtime dependency. Co-authored-by: Copilot App <[email protected]>
#if !CLI_AOT and [RequiresDynamicCode] are not interchangeable. Only the CLI_AOT compile constant (with the AOT project linking files from dotnet) excludes code from the AOT build; [RequiresDynamicCode] merely annotates an API. Drop the misleading equivalence. Co-authored-by: Copilot App <[email protected]>
Add nested, auto-loaded
AGENTS.mdfiles that give agents area-specific guidance only when editing the relevant subtree, keeping the root instructions lean.