Skip to content

Fix cryptic curl error in CLI E2E AspireStartAsync when dashboard URL is empty#16061

Open
Copilot wants to merge 2 commits intomainfrom
copilot/open-issue-failing-test
Open

Fix cryptic curl error in CLI E2E AspireStartAsync when dashboard URL is empty#16061
Copilot wants to merge 2 commits intomainfrom
copilot/open-issue-failing-test

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 11, 2026

Description

Fixes the cryptic curl: (3) URL rejected: Malformed input to a URL function error in CLI E2E tests by detecting an empty dashboard URL early and throwing a clear InvalidOperationException before the curl call.

Problem

The AspireStartAsync helper in CLI E2E tests extracts the dashboard URL from aspire start --format json output using sed. When the extraction fails (the dashboardUrl field is missing or in an unexpected format), $DASHBOARD_URL is empty. The existing code has an if [ -z "$DASHBOARD_URL" ] guard that dumps diagnostic logs when the URL is empty, but then falls through to the curl call with the empty URL, producing the cryptic error:

curl: (3) URL rejected: Malformed input to a URL function

This pattern was seen in: https://github.com/microsoft/aspire/actions/runs/24276013064/job/70890264300?pr=16059

Fix

Instead of falling through to curl after detecting the empty URL, the code now:

  1. Watches for the dashboard-url-empty echo marker in the terminal output (from the existing empty-URL guard)
  2. If detected, throws an InvalidOperationException with a clear message explaining that the dashboard URL extraction failed
  3. Only proceeds to the curl verification if the URL was successfully extracted

This makes failures due to empty dashboard URLs produce clear, actionable error messages instead of the cryptic curl error, making diagnosis much easier.

Validation

  • Verified the test project builds successfully
  • The change only affects the failure path (empty URL), so the happy path is unchanged

Fixes #16062

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?
    • No
  • Does the change make any security assumptions or guarantees?
    • No
  • Does the change require an update in our Aspire docs?
    • No

Copilot AI and others added 2 commits April 11, 2026 07:10
When $DASHBOARD_URL extraction from aspire start JSON output fails,
the curl call receives an empty string and produces a cryptic error:
  curl: (3) URL rejected: Malformed input to a URL function

This change detects the empty URL via the existing "dashboard-url-empty"
echo and throws a clear InvalidOperationException with diagnostic guidance,
instead of falling through to the curl call.

Fixes the failure pattern seen in:
https://github.com/microsoft/aspire/actions/runs/24276013064/job/70890264300

Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/750205bd-83b5-4cca-bfe1-65c59cd74ca8

Co-authored-by: radical <1472+radical@users.noreply.github.com>
@radical
Copy link
Copy Markdown
Member

radical commented Apr 11, 2026

/create-issue --test "Aspire.Cli.EndToEnd.Tests.PythonReactTemplateTests.CreateAndRunPythonReactProject" --url https://github.com/microsoft/aspire/actions/runs/24276013064/job/70890264300?pr=16059

Copilot AI requested a review from radical April 11, 2026 07:13
@github-actions
Copy link
Copy Markdown
Contributor

✅ Created failing-test issue #16062: #16062

To disable this test on your PR, comment:

/disable-test Aspire.Cli.EndToEnd.Tests.PythonReactTemplateTests.CreateAndRunPythonReactProject https://github.com/microsoft/aspire/issues/16062

@radical radical marked this pull request as ready for review April 11, 2026 07:16
@radical radical requested review from Copilot and mitchdenny April 11, 2026 07:16
@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 -- 16061

Or

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves failure diagnostics in the CLI E2E test harness by turning an empty dashboard URL (caused by failed JSON extraction) into a clear, actionable exception instead of a cryptic curl error.

Changes:

  • Detects the dashboard-url-empty marker and throws a clear InvalidOperationException before attempting the curl verification.
  • Updates the empty-dashboard-URL guard comment to reflect the new fail-fast behavior.

Reviewed changes

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

File Description
tests/Aspire.Cli.EndToEnd.Tests/Helpers/CliE2EAutomatorHelpers.cs Adds fail-fast detection for empty dashboard URL extraction to avoid cryptic curl failures.
tests/Aspire.Cli.EndToEnd.Tests/PythonReactTemplateTests.cs No functional change (whitespace).

if (emptySearcher.Search(snapshot).Count > 0)
{
dashboardUrlEmpty = true;
return true;
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

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

The WaitUntilAsync predicate returns immediately when it sees the dashboard-url-empty marker (before the shell returns to the next prompt). Since the marker is echoed at the start of the if block, this can throw while the rest of the diagnostic cat/ls/tail output is still being produced, so the terminal recording may not contain the logs that the exception message asks the reader to check. Consider setting dashboardUrlEmpty = true when the marker is detected, but continue waiting until the prompt appears (or explicitly wait for the prompt after detecting the marker) before throwing.

Suggested change
return true;

Copilot uses AI. Check for mistakes.
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.

[Failing test]: Aspire.Cli.EndToEnd.Tests.PythonReactTemplateTests.CreateAndRunPythonReactProject

3 participants