Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.sh | bash -s -- 1176Or
iex "& { $(irm https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.ps1) } 1176" |
There was a problem hiding this comment.
Pull request overview
This PR adds Aspire ATS/Polyglot export support to the ActiveMQ hosting integration and introduces a TypeScript ValidationAppHost to validate the exported surface from a polyglot app host.
Changes:
- Export ActiveMQ resources and builder extension methods via
AspireExport, and hide ATS-incompatible settings viaAspireExportIgnore. - Add a TypeScript
ValidationAppHost(tsconfig + npm project + sampleapphost.ts) for ActiveMQ export validation. - Update
.gitignoreto ignore common playground build/output artifacts.
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/CommunityToolkit.Aspire.Hosting.ActiveMQ/ActiveMQServerResourceBase.cs | Exports resource properties for polyglot hosts; ignores ATS-incompatible ActiveMqSettings. |
| src/CommunityToolkit.Aspire.Hosting.ActiveMQ/ActiveMQBuilderExtensions.cs | Exports ActiveMQ/Artemis adders and volume/bind-mount fluent APIs for polyglot hosts. |
| playground/polyglot/TypeScript/CommunityToolkit.Aspire.Hosting.ActiveMQ/ValidationAppHost/tsconfig.json | TypeScript compiler configuration for the validation host. |
| playground/polyglot/TypeScript/CommunityToolkit.Aspire.Hosting.ActiveMQ/ValidationAppHost/package.json | NPM project metadata and scripts for building/running the validation host. |
| playground/polyglot/TypeScript/CommunityToolkit.Aspire.Hosting.ActiveMQ/ValidationAppHost/package-lock.json | Lockfile capturing the resolved dependency graph for the validation host. |
| playground/polyglot/TypeScript/CommunityToolkit.Aspire.Hosting.ActiveMQ/ValidationAppHost/apphost.ts | Validation app host script exercising exported APIs and property exposure. |
| playground/polyglot/TypeScript/CommunityToolkit.Aspire.Hosting.ActiveMQ/ValidationAppHost/apphost.run.json | Local run profile configuration for the validation host. |
| playground/polyglot/TypeScript/CommunityToolkit.Aspire.Hosting.ActiveMQ/ValidationAppHost/.aspire/settings.json | Aspire polyglot host settings referencing the ActiveMQ package. |
| .gitignore | Ignores additional playground outputs (e.g., dist/, generated files). |
Files not reviewed (1)
- playground/polyglot/TypeScript/CommunityToolkit.Aspire.Hosting.ActiveMQ/ValidationAppHost/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)
src/CommunityToolkit.Aspire.Hosting.ActiveMQ/ActiveMQBuilderExtensions.cs:80
AddActiveMQArtemisdoesn’t validate thebuilderargument, unlikeAddActiveMQ. Passing a null builder will currently lead to aNullReferenceExceptionlater instead of anArgumentNullException. AddArgumentNullException.ThrowIfNull(builder, nameof(builder));at the start for consistency and clearer failure behavior.
[AspireExport("addActiveMQArtemis", Description = "Adds an ActiveMQ Artemis container resource")]
public static IResourceBuilder<ActiveMQArtemisServerResource> AddActiveMQArtemis(this IDistributedApplicationBuilder builder,
[ResourceName] string name,
IResourceBuilder<ParameterResource>? userName = null,
IResourceBuilder<ParameterResource>? password = null,
int? port = null,
string scheme = "tcp",
int? webPort = null)
{
ArgumentNullException.ThrowIfNull(name, nameof(name));
ArgumentNullException.ThrowIfNull(scheme, nameof(scheme));
You can also share your feedback on Copilot code review. Take the survey.
| using Microsoft.Extensions.DependencyInjection; | ||
| using Microsoft.Extensions.Logging; | ||
| using System.Diagnostics.CodeAnalysis; | ||
| using System.Text; |
| #pragma warning disable ASPIREATS001 // AspireExport is experimental | ||
|
|
| #pragma warning disable ASPIREATS001 // AspireExport is experimental | ||
|
|
aaronpowell
left a comment
There was a problem hiding this comment.
Some thoughts on this design:
- I'd prefer we don't create a new
playgroundtop level folder but instead work out how to continue using theexamplesfolder. Maybe the existing app hosts should be turned to file-based and we have ts and cs side-by-side. - I want some way we can run a test or validation against the TypeScript app host. Right now, there's nothing in CI that validates that it is going to continue to work.
- What do you think about making the TypeScript app host implement the same logic as the C# one so that we could (in theory) load it into a test runner and run automated tests?
The problem with this approach is the
That's a good callout, and I do agree. The
That's a good idea! The playground approach is to ensure that the APIs we explicitly exported are in fact, generated as TypeScript compatible APIs. I'd argue that you'd really want to leave playground bits as they are, since they serve two different purposes (even though they slightly overlap). |
Oh, that's a bit of a pain. Maybe we'll have to have a
Our test projects for the integration have a test class which uses the testing framework to start the app host, but this works by having a project reference. Have a look at
If the intent of the playground is to validate that the API surface is properly covered, then we need something place to confirm that assumption. Right now, it would appear that there is a file in the repo that says "at some point in time this API was valid" but without any process to run the app host, test the app host, or something, we can't have confidence that it will continue to work. |
|
Sorry @aaronpowell - been buried, not ignoring you... |
- move the TypeScript apphost into examples - add reusable TypeScript apphost validation coverage - fix the ActiveMQ export review feedback Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
aaronpowell
left a comment
There was a problem hiding this comment.
We'll want to add the Aspire CLI to the GitHub Actions, we don't do that now and that'd be why the TypeScript AppHost test failed.
| public async Task TypeScriptAppHostCompilesAndStarts() | ||
| { | ||
| string repoRoot = Path.GetFullPath(Path.Combine("..", "..", "..", "..", "..")); | ||
| string scriptPath = Path.Combine(repoRoot, "eng", "testing", "validate-typescript-apphost.ps1"); | ||
| string appHostPath = Path.Combine(repoRoot, "examples", "activemq", "CommunityToolkit.Aspire.Hosting.ActiveMQ.AppHost.TypeScript", "apphost.ts"); | ||
| string packageProjectPath = Path.Combine(repoRoot, "src", "CommunityToolkit.Aspire.Hosting.ActiveMQ", "CommunityToolkit.Aspire.Hosting.ActiveMQ.csproj"); | ||
| string shell = OperatingSystem.IsWindows() ? "pwsh.exe" : "pwsh"; | ||
|
|
||
| await ProcessTestUtilities.RunProcessAsync(shell, [ | ||
| "-NoLogo", | ||
| "-NoProfile", | ||
| "-File", scriptPath, | ||
| "-AppHostPath", appHostPath, | ||
| "-PackageProjectPath", packageProjectPath, | ||
| "-PackageName", "CommunityToolkit.Aspire.Hosting.ActiveMQ", | ||
| "-WaitForResources", "classic,classic2,artemis,artemis2" | ||
| ], repoRoot, TestContext.Current.CancellationToken); | ||
| } |
There was a problem hiding this comment.
I reckon we can bundle this up a lot cleaner so that the test is doing a bit less lifting, and we rely more on conventions.
public async Task TypeScriptAppHostCompilesAndStarts()
{
await TypeScriptAppHostTest.Run(
appHostProject: "CommunityToolkit.Aspire.Hosting.ActiveMQ.AppHost.TypeScript",
packageProject: "CommunityToolkit.Aspire.Hosting.ActiveMQ",
exampleName: "activemq"
);
}And then in the CommunityToolkit.Aspire.Testsings project we'd have:
public static class TypeScriptAppHostTest
{
public static async Task Run(string appHostProject, string packageName, string exampleName)
{
string repoRoot = Path.GetFullPath(Path.Combine("..", "..", "..", "..", ".."));
string scriptPath = Path.Combine(repoRoot, "eng", "testing", "validate-typescript-apphost.ps1");
string appHostPath = Path.Combine(repoRoot, "examples", exampleName, appHostProject, "apphost.ts");
string packageProjectPath = Path.Combine(repoRoot, "src", packageName, $"{packageName}.csproj");
string shell = OperatingSystem.IsWindows() ? "pwsh.exe" : "pwsh";
await ProcessTestUtilities.RunProcessAsync(shell, [
"-NoLogo",
"-NoProfile",
"-File", scriptPath,
"-AppHostPath", appHostPath,
"-PackageProjectPath", packageProjectPath,
"-PackageName", packageName,
"-WaitForResources", "classic,classic2,artemis,artemis2"
], repoRoot, TestContext.Current.CancellationToken);
}
}Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Validation