Skip to content

[automated] test(templates): Fix child-project SDK isolation and dashboard checks - #21423

Merged
Ankit Jain (radical) merged 4 commits into
microsoft:mainfrom
radical:stunning-guide
Nov 4, 2026
Merged

Ankit Jain (radical) merged 4 commits into
microsoft:mainfrom
radical:stunning-guide

Conversation

@radical

@radical Ankit Jain (radical) commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Description

Fix starter-template AppHost startup failures caused by inherited repository MSBuild paths.

The AppHost builds its API and frontend child projects before starting those services. Remove inherited MSBuildSDKsPath and MSBuildExtensionsPath before applying fixture and caller overrides, reusing the existing command-helper cleanup so those child builds use the isolated test SDK.

Fixes #21413

Dashboard compatibility and related fixes

Merged current main through d698a4f9cb, including #21759, and resolved the dashboard-helper conflict in favor of its shared DashboardResourceAssertions implementation. It reads names and states from .resource-row[data-resource-name] and validates sources in each resource's details panel, independently of overview layout and sidebar density. Source validation is preserved.

Removed this PR's obsolete card-only implementation and synthetic card-HTML test. Real-dashboard coverage now comes from TemplateResourceAssertionsTests in Aspire.Dashboard.Playwright.Tests, added by #21759, including Resources/Graph navigation and incorrect project/container sources. The README now describes the shared helper rather than the removed Cards layout. The remaining test-code change against main is SDK isolation.

Endpoint discovery remains unchanged from main (#21360). #21222 separately fixed Redis output-cache service registration.

Validation

Local Windows validation after merging main and resolving conflicts:

.\restore.cmd /p:SkipNativeBuild=true

Result: passed; provisioned the pinned SDK and restored the repository. Restore reported existing package vulnerability warnings.

$env:MSBUILDTERMINALLOGGER='false'
dotnet test --project tests\Aspire.Templates.Tests\Aspire.Templates.Tests.csproj --no-launch-profile -- --filter-class '*.ToolCommandTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'

Result: 2 passed, zero failed, zero skipped; compiles the template-test project and exercises inherited SDK-path cleanup.

git -c core.longpaths=true diff origin/main --check

Result: passed.

Fresh CI at e030a1df833ed17dadf31ac2a53a1dbec2c89053 passed:

Full .NET 10/.NET 11 starter-template outerloop scenarios and TemplateResourceAssertionsTests were not rerun locally. Focused cleanup tests and regular PR CI do not establish that all scheduled starter-template outerloop failures are resolved.

An independent GPT-6.1 Sol review at high reasoning effort found no merge blockers and confirmed that Sébastien's layout, card-reordering, and error-badge feedback is addressed by retaining the shared helper from #21759. Both inline threads have been replied to and resolved.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

Local starter-template validation can fail with an unexpected
__dotnet-project-build resource when AppHost runtime builds inherit
the repository's MSBuild SDK paths.

Apply the existing SDK-path cleanup to AppHost launches before
fixture overrides. Discover project endpoints through project
metadata rather than the legacy resource type.

Fixes microsoft#21413

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21423

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21423"

@github-actions github-actions Bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Oct 30, 2026
@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot October 30, 2026 03:21

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.

🟢 Approval recommended

No active review issues block approval of the template-test harness changes.

No open issues 🎉

What changed in this PR

Updates the template-test harness to keep AppHost coordinated builds on the isolated test SDK, addressing the startup failure reported in #21413.

Changes:

  • Removes inherited MSBuild SDK paths before applying fixture environment overrides when launching AppHosts.
  • Identifies project resources by metadata when collecting endpoints, supporting the current resource implementation.
  • Documents SDK-path cleanup for both command helpers and AppHost launches.
File Description
tests/​Shared/​TemplatesTesting/​data/​EndPointWriterHook_cs Selects endpoint-bearing project resources using project metadata.
tests/​Shared/​TemplatesTesting/​AspireProject.cs Applies existing MSBuild environment cleanup before AppHost fixture overrides.
tests/​Aspire.Templates.Tests/​README.md Documents isolated-SDK handling for coordinated project builds.

Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@radical Ankit Jain (radical) changed the title [automated] test(templates): Keep coordinated builds on the isolated SDK [automated] test(templates): Fix child-project builds and endpoint discovery Oct 30, 2026
@radical
Ankit Jain (radical) marked this pull request as ready for review October 30, 2026 17:44
@radical Ankit Jain (radical) added failing-test area-templates and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Oct 30, 2026
@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot October 30, 2026 17:47

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.

🟢 Approval recommended

No active review issues were identified for the starter-template test-harness startup and endpoint-discovery changes.

No open issues 🎉

Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Copy link
Copy Markdown
Collaborator

Heads-up for the Templates outerloop failures (StarterTemplateWithRedisCacheTests_Net11.ApiServiceWorks and WebFrontendWorks, failing 14 of 14 scheduled runs per #18657):

  • Since Modernize the dashboard experience #21412 (merged 2026-10-30 04:47Z), the dashboard's default resources view is the Cards layout (article.resource-card), not the tr.resource-row grid.
  • TemplateTestsBase.CheckDashboardHasResourcesActualAsync still reads .main-grid tr.resource-row. On the post-Modernize the dashboard experience #21412 runs it ends with Expected rows not found: apiservice, webfrontend, cache, for example run 41263841334.
  • This PR doesn't touch that locator, so those tests will likely keep failing after the child-project build fix lands.

The same stale locator broke DashboardUrlTests.DashboardDisplaysResourceUpdatesWhileAppHostIsPausedAtBreakpoint, which #21656 fixes (#21655). I've left the Templates harness alone because this PR owns it.

🤖 Posted by AspireAgent (AI Agent)

@radical

Copy link
Copy Markdown
Member Author

Copilot resolve the merge conflicts in this pull request

David Fowler (davidfowl) added a commit that referenced this pull request Nov 2, 2026
…21656)

## Description


`DashboardUrlTests.DashboardDisplaysResourceUpdatesWhileAppHostIsPausedAtBreakpoint`
has failed in every scheduled Outerloop run on `main` since #21412
("Modernize the dashboard experience") made the Cards layout the default
resources view. Before #21412 it passed 12 of 12 runs; since then it has
failed 2 of 2
([41158473015](https://github.com/microsoft/aspire/actions/runs/41158473015),
[41263841334](https://github.com/microsoft/aspire/actions/runs/41263841334)).

**Root cause:** the test waits for `tr.resource-row`, the legacy grid
row. The default view now renders each resource as `<article
class="resource-card" aria-label="{name}">`
(`ApplicationSummary.razor`), so the locator never matches. The aria
snapshot in the CI failure shows the card already displaying
`dashboard-test-resource … State Dashboard test initial`. The product is
fine; only the locator is stale.

**Fix:** locate the resource card by its exact `aria-label`. The state
is still read from `.state-column-cell`, because the card renders the
same `StateColumnDisplay` component the grid did. Both state assertions
are unchanged: the initial custom state, then the updated state
published while the AppHost is held at the breakpoint. There are no
sleeps, retries, or relaxed timeouts.

Fixes #21655

### Validation

- **Before the fix (`main` at 1bccada), locally with real DCP, the
dashboard, and headless Chromium:** fails the same way as CI, `Locator
expected to be visible … waiting for Locator("tr.resource-row")…`. The
snapshot shows the Cards region containing `dashboard-test-resource …
Dashboard test initial`.
- **After the fix:** passes in about 30s. It passed **50 of 50**
consecutive local runs (27–33s each).
- **Outerloop CI on this branch:** I dispatched [run
41310885927](https://github.com/microsoft/aspire/actions/runs/41310885927)
on 7b9e3a3.
- `outerloop_tests / Hosting.Testing (ubuntu-latest)` passed ([job
124868319332](https://github.com/microsoft/aspire/actions/runs/41310885927/job/124868319332):
total 1, succeeded 1, skipped 0). That job runs only this outerloop
test; on `main` it reports total 1, failed 1.
  - `Hosting.Testing (windows-latest)` also passed.
- I then cancelled the run. Its remaining Templates and Radius jobs fail
on every scheduled `main` run for unrelated, already-tracked reasons
(#21413/#21423, MongoDB family).
- Because of that cancellation, the run's `Final Results` check shows as
failed on this commit. It is not one of this PR's required checks.

### Out of scope

`TemplateTestsBase.CheckDashboardHasResourcesActualAsync` (`.main-grid
tr.resource-row`) reads the same legacy grid and affects the Templates
outerloop tests. That path is tracked by #21413/#21423.

## Checklist

- Is this feature complete?
  - [x] Yes. Ready to ship.
  - [ ] No. Follow-up changes expected.
- Are you including unit tests for the changes and scenario tests if
relevant?
  - [x] Yes
  - [ ] No
- Did you add public API?
  - [ ] Yes
  - [x] No
- Does the change make any security assumptions or guarantees?
  - [ ] Yes
  - [x] No

**🤖 Posted by AspireAgent (AI Agent)**

Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Integrate current main while retaining its IDotnetProgramResource endpoint discovery. Keep AppHost child builds on the isolated SDK and update dashboard resource checks for the default cards layout. Add browser regression coverage without relaxing resource assertions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@radical Ankit Jain (radical) changed the title [automated] test(templates): Fix child-project builds and endpoint discovery [automated] test(templates): Fix child-project SDK isolation and dashboard checks Nov 3, 2026
@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot November 3, 2026 20:33

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.

🔵 Needs a closer look

End-to-end .NET 10/11 starter-template validation with isolated SDKs and the live dashboard remains outstanding, while the focused cleanup and synthetic-markup tests do not establish that the coordinated-build failure is resolved.

No open issues 🎉

Review effort: Balanced

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.

Approving. The SDK path cleanup runs before the fixture overrides and configureProcess, and I checked the new selectors against the dashboard's card markup. __dotnet-project-build also finishes and hides before the page opens on a successful build, because AppHost startup waits for it, so the unknown-resource check won't trip there.

The two comments are minor and fine as a follow-up: one low-rate flake and one misleading timeout. I reviewed the code only and did not run the tests. As the description says, the starter scenarios still need to pass against a real dashboard, so the next outerloop run is the check for #21413.

@sebastienros

Copy link
Copy Markdown
Contributor

Please hold this PR until the dashboard checks are retargeted: #21759, also approved, removes the Cards layout these checks now depend on.

Once both are in, article.resource-card and .resource-card-source in TemplateTestsBase.cs match nothing. The helper treats zero rows as "not ready yet" and keeps polling, so the starter template's ResourcesShowUpOnDashboard and the other callers that expect resources time out with Expected rows not found. CI won't catch it: the two PRs don't conflict, the real-dashboard tests are outerloop, and CheckDashboardHasResourcesValidatesCards runs against hardcoded card HTML, so it keeps passing.

The simplest order is to merge #21759 first, then update this PR before it merges:

  • Selector: .resource-row[data-resource-name] gives the name and state at the default density, which is what NativeDashboardSmoke.mts already uses.
  • Source check: the resource pane doesn't show the source at that density (only on Spacious, and only when the resource has no URL), so SourceContains has to move to the resource's details panel or be dropped.
  • Docs and test: the README's "default Cards layout" note, the code comment and the card-based test need the same update.

The SDK isolation changes in this PR aren't affected.

@radical Ankit Jain (radical) added NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) blocked labels Nov 4, 2026
Keep the sidebar/details helper and real-dashboard coverage from microsoft#21759, remove obsolete card-only tests, and preserve the template SDK isolation fix.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

🔵 Needs a closer look

Validation covered only dictionary cleanup, leaving starter-template startup and coordinated child-project builds unverified in CI with isolated .NET 10/.NET 11 SDKs, including the reported macOS/.NET 11 scenario.

No open issues 🎉

Review effort: Balanced

@radical

Copy link
Copy Markdown
Member Author

Merged main, including #21759, in e030a1d and kept its shared DashboardResourceAssertions helper. It reads sidebar resource rows and checks sources in the details panel, so source validation is preserved without depending on Cards or sidebar density. Removed the obsolete card implementation and hardcoded-card test, and updated the README and PR description. The real-dashboard TemplateResourceAssertionsTests from #21759 remains the coverage for the replacement. The remaining test-code diff against main is SDK isolation. Local SDK-path cleanup tests passed (2/2); fresh CI is still running, with no failures reported so far. The full starter-template and real-dashboard outerloop scenarios have not been rerun locally.

@radical Ankit Jain (radical) removed NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) blocked labels Nov 4, 2026
@radical
Ankit Jain (radical) merged commit 3ceebfa into microsoft:main Nov 4, 2026
79 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 17.0 milestone Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local .NET 11 starter-template validation fails during coordinated project build

4 participants