Skip to content

Replace TestTempDirectory with TemporaryWorkspace and clean up test project configuration - #18683

Merged
Ankit Jain (radical) merged 12 commits into
mainfrom
jamesnk/workspace
Jul 9, 2026
Merged

Ankit Jain (radical) merged 12 commits into
mainfrom
jamesnk/workspace

Conversation

@JamesNK

@JamesNK James Newton-King (JamesNK) commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

Description

Replace the minimal TestTempDirectory helper with a robust TemporaryWorkspace class and clean up test project configuration:

  • Replace TestTempDirectory with TemporaryWorkspace — the new shared utility creates a workspace directory with retry-based cleanup, .aspire/settings.json sentinel (stops config directory walks), git init support, and workspace preservation for debugging failed tests.
  • Shorten workspace paths (Workspace/{random-filename} instead of long GUIDs) to stay within the ~108-byte Unix Domain Socket path limit.
  • Delete tests/Shared/TempDirectory.cs — superseded by TemporaryWorkspace.
  • Remove erroneous using Aspire.Cli.Tests.Utils from 72 test source files — this namespace does not exist and was causing CS0234 build errors.
  • Add <Using Include="Aspire.Tests.Utils" /> to test projects that use TemporaryWorkspace.
  • Alphabetize and fix formatting in Aspire.slnx and several test .csproj files.

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 — this is a test infrastructure refactoring; existing tests validate the change.
  • Did you add public API?
    • Yes
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
    • No

Copilot AI review requested due to automatic review settings July 8, 2026 06:43

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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@github-actions

github-actions Bot commented Jul 8, 2026

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 -- 18683

Or

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

Copilot AI review requested due to automatic review settings July 8, 2026 06:55

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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Copilot AI review requested due to automatic review settings July 8, 2026 07:03

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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Copilot AI review requested due to automatic review settings July 8, 2026 07:05

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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@github-actions

This comment has been minimized.

Copilot AI review requested due to automatic review settings July 8, 2026 07: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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Copilot AI review requested due to automatic review settings July 8, 2026 07:23

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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@github-actions

This comment has been minimized.

Copilot AI review requested due to automatic review settings July 8, 2026 07:49

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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Copilot AI review requested due to automatic review settings July 8, 2026 07:51

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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Copilot AI review requested due to automatic review settings July 8, 2026 07:57

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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@github-actions

github-actions Bot commented Jul 9, 2026

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.

Split workspace creation into two methods:
- Create(): clean workspace without .aspire/settings.json (for non-CLI tests
  like Docker/Kubernetes that use VerifyDirectory on workspace.Path)
- CreateForCli(): workspace with .aspire/settings.json sentinel so
  ConfigurationHelper.GetConfigRootDirectory resolves correctly

Update all CLI test files to use CreateForCli.
Copilot AI review requested due to automatic review settings July 9, 2026 00:14

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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@github-actions

This comment has been minimized.

…ssumptions

- InitializeWorkspacesParent: delete stale aspire.config.json left by
  previous runs and create a backstop .aspire/settings.json so walks
  never escape to the user's home directory
- SetConfigurationAsync_CreatesNewFile_WhenNoneExists: stop deleting the
  sentinel; assert on the legacy settings file that FindNearestSettingsFile
  actually writes to
- ConfigSetCommand_LocalAppHostPath_RemainsAllowed: stop deleting the
  sentinel; EnsureAspireConfigFileForAppHostPathSettings migrates the
  legacy file to aspire.config.json correctly when the sentinel exists
Copilot AI review requested due to automatic review settings July 9, 2026 00:27

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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@github-actions

This comment has been minimized.

…gsAsync

When aspire.config.json or .aspire/settings.json exists at a directory level,
that directory IS the workspace root. Stop walking up regardless of whether
an appHost path is specified — absence of the path means no AppHost is
configured, not 'keep searching parent directories.'

Previously the walk continued past these files when they had no appHost
path, allowing stale config from unrelated parent directories to
contaminate the result.

Also remove file creation/deletion from InitializeWorkspacesParent — the
parent directory should not be mutated.
Copilot AI review requested due to automatic review settings July 9, 2026 00: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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@github-actions

This comment has been minimized.

…ehavior

Verify that the config walk stops at the workspace root (either
aspire.config.json or .aspire/settings.json) even when the config
has no appHost.path. Previously the walk continued to parent dirs
and could pick up stale config.
Copilot AI review requested due to automatic review settings July 9, 2026 00:53

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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Tests selector (audit mode)

The full test matrix and all jobs still run in audit mode. The tests and jobs below are what selective CI would run under enforcement.

Runs the full test matrix + all jobs (ALL) — a rule matching 'Aspire.slnx' selects ALL


Selection computed for commit 1d2795a.

@radical
Ankit Jain (radical) merged commit 18d59c4 into main Jul 9, 2026
335 checks passed
@radical
Ankit Jain (radical) deleted the jamesnk/workspace branch July 9, 2026 01:25
@github-actions github-actions Bot added this to the 13.5 milestone Jul 9, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

✅ No documentation update needed.

docs_optional → internal_refactor

No signals triggered (signal_count = 0).

The PR replaces the TestTempDirectory test helper with TemporaryWorkspace, removes the now-superseded tests/Shared/TempDirectory.cs, fixes erroneous using Aspire.Cli.Tests.Utils directives across 72 test files, and alphabetizes/formats .slnx and .csproj files. The one non-test source file changed (src/Aspire.Cli/Projects/ProjectLocator.cs) is an internal implementation detail (shortening workspace paths to stay within the Unix Domain Socket path limit). The PR checklist explicitly confirms no public API was added and no user-facing behavior changed. All changed files match the internal_refactor category.

Ankit Jain (radical) added a commit that referenced this pull request Jul 9, 2026
…elper

main renamed tests/Shared/TemporaryRepo.cs to TemporaryWorkspace.cs and moved
its namespace from Aspire.Cli.Tests.Utils to Aspire.Tests.Utils (#18683). This
branch predated that change, so merging main produced a clean textual merge but
a broken build: the project referenced a deleted file and a deleted namespace.

Without this adaptation the merged tree fails with:
- CS2001: source file TemporaryRepo.cs could not be found
- CS0246: namespace Aspire.Cli.Tests.Utils does not exist

git reported no conflict (the two csproj edits were in different regions), so
the break would have been silent on merge.

Fix:
- Point the shared compile include at TemporaryWorkspace.cs.
- Update the using directive to Aspire.Tests.Utils.

Verified: Aspire.Hosting.RemoteHost.Tests builds with 0 warnings/0 errors and
PromptInputs_ResultCarriesSubmittedFileMetadataByName passes.

Co-authored-by: Copilot App <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants