Skip to content

Add location-gated AGENTS.md guidance for key src and test subtrees - #55198

Merged
mthalman merged 12 commits into
dotnet:mainfrom
mthalman:mthalman-agent-recipes-restructure
Jul 16, 2026
Merged

mthalman merged 12 commits into
dotnet:mainfrom
mthalman:mthalman-agent-recipes-restructure

Conversation

@mthalman

@mthalman mthalman commented Jul 8, 2026

Copy link
Copy Markdown
Member

Add nested, auto-loaded AGENTS.md files that give agents area-specific guidance only when editing the relevant subtree, keeping the root instructions lean.

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]>
Copilot AI review requested due to automatic review settings July 8, 2026 15:42
@mthalman
mthalman requested a review from lbussell as a code owner July 8, 2026 15:42
@mthalman mthalman mentioned this pull request Jul 8, 2026
25 of 39 tasks

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md with 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.

Comment thread test/AGENTS.md Resolved
Comment thread src/Dotnet.Watch/AGENTS.md Resolved
Comment thread src/Dotnet.Watch/AGENTS.md Resolved
mthalman and others added 4 commits July 9, 2026 10:19
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]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread src/Tasks/AGENTS.md Resolved
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]>
Comment thread test/AGENTS.md
- **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")]`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: does this work for both MSTest and Xunit projects? Or only one?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread test/AGENTS.md Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 31eeca6

Comment thread src/Dotnet.Watch/AGENTS.md Outdated
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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: There is no IHotReloadClient.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 85c8a0b

Comment thread src/Containers/AGENTS.md Outdated
- **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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread src/Containers/AGENTS.md Outdated
## Tests

- Unit: `test/Microsoft.NET.Build.Containers.UnitTests` (MSTest) — run everywhere.
- Integration: `test/Microsoft.NET.Build.Containers.IntegrationTests` **require a

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c69ae67

Comment thread src/Cli/AGENTS.md Outdated

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]`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3d0d43b

mthalman and others added 5 commits July 15, 2026 15:18
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]>
@mthalman
mthalman merged commit bf32698 into dotnet:main Jul 16, 2026
27 of 28 checks passed
@mthalman
mthalman deleted the mthalman-agent-recipes-restructure branch July 16, 2026 13:14
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants