Skip to content

Optimize TypeScript compatibility checks#17415

Merged
sebastienros merged 8 commits into
mainfrom
sebros/tsgo-compatibility
May 25, 2026
Merged

Optimize TypeScript compatibility checks#17415
sebastienros merged 8 commits into
mainfrom
sebros/tsgo-compatibility

Conversation

@sebastienros
Copy link
Copy Markdown
Contributor

@sebastienros sebastienros commented May 23, 2026

Description

The TypeScript API Compatibility check was doing unnecessary work on every pull request: it regenerated the base ATS surface even though the release baseline is already checked in, and it started a fresh CLI/AppHost scanner for each integration. This change makes the check compare against the checked-in release baseline and generate the PR surface with far fewer process/build cycles.

Actual changes in this PR:

  • Use the checked-in ATS release baseline from the target branch instead of regenerating base ATS output.
  • Invoke the already-built CLI and TypeScript API compatibility tool with dotnet exec instead of dotnet run --no-build.
  • Add aspire sdk dump --output-directory so one capability-scanner AppHost can scan many integrations and write one ATS file per integration assembly.
  • Filter diagnostics by selected assembly in the remote host, and normalize package surfaces in the compat parser so duplicated foreign-package symbols in older baselines do not create false package-local removals.
  • Keep the TypeScript polyglot validation improvement: install @typescript/native-preview, use tsgo, and run those AppHost type checks in bounded parallel batches.

Measured CI improvement for Tests / TypeScript API Compatibility / TypeScript API Compatibility:

  • Before: 20m40s (4dbcd268, run 26338878979)
  • After: 4m17s (9129483, run 26340613003)
  • Improvement: about 16m23s faster, roughly 4.8x faster / 79% less time

Validation performed:

  • ./restore.sh
  • ./dotnet.sh build src/Aspire.Cli/Aspire.Cli.csproj --configuration Release /p:SkipNativeBuild=true
  • ./dotnet.sh build tests/Aspire.Hosting.RemoteHost.Tests/Aspire.Hosting.RemoteHost.Tests.csproj --configuration Release /p:SkipNativeBuild=true
  • ./dotnet.sh test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --configuration Release --no-launch-profile -- --filter-class "*.SdkDumpCommandTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"
  • ./dotnet.sh test --project tests/Aspire.Hosting.RemoteHost.Tests/Aspire.Hosting.RemoteHost.Tests.csproj --configuration Release --no-launch-profile -- --filter-class "*.AtsContextFilterTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"
  • ./dotnet.sh test --project tests/Infrastructure.Tests/Infrastructure.Tests.csproj --configuration Release --no-launch-profile -- --filter-class "*.TypeScriptApiCompatTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"
  • Batched aspire sdk dump --format ci --output-directory smoke test for Redis and Garnet
  • Byte-for-byte comparison of batched Redis/Garnet output against single-project sdk dump output
  • Local SqlServer compatibility check against the checked-in release baseline after package-surface normalization
  • Workflow YAML parse, embedded bash syntax checks, and git diff --check

Fixes # (issue)

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

Install the native TypeScript checker in the polyglot TypeScript validation image and run the validation AppHosts with bounded parallelism. This speeds up the compatibility validation while preserving per-AppHost failure reporting.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 23, 2026 17:20
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 23, 2026

🚀 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 -- 17415

Or

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

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 speeds up TypeScript polyglot validation by switching per-AppHost type-checking from tsc to the native TypeScript checker (tsgo) and by running validations in bounded parallel batches to reduce overall wall-clock time in CI.

Changes:

  • Install @typescript/native-preview in the TypeScript validation container image and use tsgo for type-checking.
  • Update the TypeScript playground validation script to run AppHost validations in parallel batches, with per-AppHost isolated logs/results and a configurable max parallelism.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.github/workflows/polyglot-validation/test-typescript-playground.sh Switches to tsgo and adds bounded parallel execution with per-AppHost logging/results.
.github/workflows/polyglot-validation/Dockerfile.typescript Installs @typescript/native-preview (providing tsgo) into the validation image.

@sebastienros sebastienros marked this pull request as draft May 23, 2026 17:40
Use the checked-in ATS release baseline from the target branch instead of regenerating the base surface for each PR. Invoke the already-built CLI and compatibility tool with dotnet exec, and generate current integration ATS files with bounded parallelism.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sebastienros sebastienros changed the title Speed up TypeScript validation with tsgo Optimize TypeScript compatibility checks May 23, 2026
sebastienros and others added 4 commits May 23, 2026 10:55
TypeScriptApiCompat targets net8.0, so use its net8.0 build output when verifying and invoking the already-built tool in CI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add an sdk dump output-directory mode that builds one capability scanner for many integrations and writes one ATS file per integration assembly. Use it in the TypeScript API compatibility workflow so the current PR surface is generated with one CLI/AppHost startup instead of one per integration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The workflow only needs the PR checkout plus the explicitly fetched base branch, so remove fetch-depth: 0 from the initial checkout.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Ignore ATS symbols owned by other packages when loading a package surface so release baselines that include referenced core symbols do not produce false package-local removals. Keep exported values unchanged because their paths are not consistently assembly-qualified.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sebastienros sebastienros marked this pull request as ready for review May 23, 2026 18:56
Copy link
Copy Markdown
Member

@mitchdenny mitchdenny left a comment

Choose a reason for hiding this comment

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

Reviewed for correctness. Two prefix-overmatch bugs and one minor logging concern. See inline comments.

Comment thread tools/TypeScriptApiCompat/AtsSurfaceParser.cs Outdated
Comment thread src/Aspire.Hosting.RemoteHost/AtsContextFilter.cs Outdated
Comment thread src/Aspire.Cli/Commands/Sdk/SdkDumpCommand.cs Outdated
Copy link
Copy Markdown
Member

@mitchdenny mitchdenny left a comment

Choose a reason for hiding this comment

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

A few issues but approving assuming you’ll fix those up.

sebastienros and others added 2 commits May 24, 2026 19:44
…sgo-compatibility

# Conflicts:
#	.github/workflows/polyglot-validation/Dockerfile.typescript
#	.github/workflows/polyglot-validation/test-typescript-playground.sh
Use most-specific known package and assembly ownership when normalizing ATS surfaces and filtering diagnostics, and log batched sdk dump failures at warning level for CI visibility.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sebastienros sebastienros enabled auto-merge (squash) May 25, 2026 03:37
@sebastienros sebastienros merged commit e6b669a into main May 25, 2026
616 of 619 checks passed
@github-actions github-actions Bot added this to the 13.4 milestone May 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

CLI E2E Tests unknown — 96 passed, 0 failed, 5 unknown (commit 9141eff)

View all recordings
Status Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View recording
AddPackageWhileAppHostRunningDetached ▶️ View recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View recording
AgentInitCommand_DefaultSelection_InstallsDefaultSkills ▶️ View recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View recording
AgentMcpListStructuredLogsFromStarterAppCore ▶️ View recording
AllPublishMethodsBuildDockerImages ▶️ View recording
AspireAddPackageVersionToDirectoryPackagesProps ▶️ View recording
AspireInitSingleFileAppHostRunsViaDotnetRunAppHost ▶️ View recording
AspireInitWithExistingAppHostDirRecreatesMissingNuGetConfigAndPreservesFiles ▶️ View recording
AspireInitWithSolutionFileGeneratesAppHostThatBuildsAgainstChannelHive ▶️ View recording
AspireStartUpdatesStaleTypeScriptAppHostPath ▶️ View recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View recording
AspireUpdateRemovesOrphanAppHostPackageVersionWhenSdkAlreadyCurrent ▶️ View recording
Banner_DisplayedOnFirstRun ▶️ View recording
Banner_DisplayedWithExplicitFlag ▶️ View recording
Banner_NotDisplayedWithNoLogoFlag ▶️ View recording
CertificatesClean_RemovesCertificates ▶️ View recording
CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ▶️ View recording
CertificatesTrust_WithUntrustedCert_TrustsCertificate ▶️ View recording
ConfigSetGet_CreatesNestedJsonFormat ▶️ View recording
CreateAndRunAspireStarterProject ▶️ View recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View recording
CreateAndRunEmptyAppHostProject ▶️ View recording
CreateAndRunJavaEmptyAppHostProject ▶️ View recording
CreateAndRunJsReactProject ▶️ View recording
CreateAndRunPythonReactProject ▶️ View recording
CreateAndRunTypeScriptEmptyAppHostProject ▶️ View recording
CreateAndRunTypeScriptStarterProject ▶️ View recording
CreateJavaAppHostWithViteApp ▶️ View recording
CreateTypeScriptAppHostWithViteApp_UsesConfiguredToolchain ▶️ View recording
DashboardRunWithAgentMcpCore ▶️ View recording
DashboardRunWithOtelTracesReturnsNoTracesCore ▶️ View recording
DeployK8sBasicApiService ▶️ View recording
DeployK8sWithExternalHelmChart ▶️ View recording
DeployK8sWithGarnet ▶️ View recording
DeployK8sWithMongoDB ▶️ View recording
DeployK8sWithMySql ▶️ View recording
DeployK8sWithPostgres ▶️ View recording
DeployK8sWithRabbitMQ ▶️ View recording
DeployK8sWithRedis ▶️ View recording
DeployK8sWithSqlServer ▶️ View recording
DeployK8sWithValkey ▶️ View recording
DeployTypeScriptAppToKubernetes ▶️ View recording
DescribeCommandResolvesReplicaNames ▶️ View recording
DescribeCommandShowsRunningResources ▶️ View recording
DetachFormatJsonProducesValidJson ▶️ View recording
DetachFormatJsonProducesValidJsonWhenRestartingExistingInstance ▶️ View recording
DoListStepsShowsPipelineSteps ▶️ View recording
DocsCommand_RendersInteractiveMarkdownFromLocalSource ▶️ View recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View recording
DoctorCommand_TypeScriptAppHostReportsMissingConfiguredToolchain ▶️ View recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View recording
GeneratedAspireDevScript_StartsWatchMode_WithConfiguredToolchain ▶️ View recording
GlobalMigration_HandlesCommentsAndTrailingCommas ▶️ View recording
GlobalMigration_HandlesMalformedLegacyJson ▶️ View recording
GlobalMigration_PreservesAllValueTypes ▶️ View recording
GlobalMigration_SkipsWhenNewConfigExists ▶️ View recording
GlobalSettings_MigratedFromLegacyFormat ▶️ View recording
InitTypeScriptAppHost_AugmentsExistingViteRepoAtRoot ▶️ View recording
InteractiveCSharpInitCreatesExpectedFiles ▶️ View recording
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View recording
JavaScriptHostingApisRunFromTypeScriptAppHost ▶️ View recording
LatestCliCanStartStableChannelAppHost ▶️ View recording
LatestCliCanStartStableChannelTypeScriptAppHost ▶️ View recording
LegacySettingsMigration_AdjustsRelativeAppHostPath ▶️ View recording
LogLevelTrace_ProducesTraceEntriesInCliLogFile ▶️ View recording
LogsCommandShowsResourceLogs ▶️ View recording
OtelLogsReturnsStructuredLogsFromStarterApp ▶️ View recording
OtelLogsReturnsStructuredLogsFromStarterAppIsolated ▶️ View recording
PsCommandListsRunningAppHost ▶️ View recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View recording
PublishJavaScriptPatternsGeneratesExpectedDockerComposeArtifacts ▶️ View recording
PublishWithConfigureEnvFileUpdatesEnvOutput ▶️ View recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View recording
PublishWithoutOutputPathUsesAppHostDirectoryDefault ▶️ View recording
ResourceCommand_FailedExecution_DisplaysAppHostLogPathAndLogContainsEntries ▶️ View recording
ResourceCommand_FailsWhenInteractionServiceIsRequired ▶️ View recording
ResourceCommand_SetAndDeleteParameterUpdatesDescribeOutput ▶️ View recording
RestoreGeneratesSdkFiles ▶️ View recording
RestoreGeneratesSdkFiles_WithConfiguredToolchain ▶️ View recording
RestoreRefreshesGeneratedSdkAfterAddingIntegration ▶️ View recording
RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes ▶️ View recording
RunFromParentDirectory_UsesExistingConfigNearAppHost ▶️ View recording
RunPublishFailureScenarioAsync ▶️ View recording
RunReportsSyntaxErrorsForDotNetAppHost ▶️ View recording
RunReportsSyntaxErrorsForTypeScriptAppHost ▶️ View recording
SecretCrudOnDotNetAppHost ▶️ View recording
SecretCrudOnTypeScriptAppHost ▶️ View recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View recording
StartAndWaitForTypeScriptSqlServerAppHostWithNativeAssets ▶️ View recording
StartReportsSyntaxErrorsForDotNetAppHost ▶️ View recording
StartReportsSyntaxErrorsForTypeScriptAppHost ▶️ View recording
StopAllAppHostsFromAppHostDirectory ▶️ View recording
StopJavaPolyglotAppHostUsingApphostDirectory ▶️ View recording
StopNonInteractiveSingleAppHost ▶️ View recording
StopTypeScriptPolyglotAppHostUsingApphostDirectory ▶️ View recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View recording
UnAwaitedChainsCompileWithAutoResolvePromises ▶️ View recording
UpdateProjectChannelToStable_TypeScript_PicksUpStablePackages ▶️ View recording

📹 Recordings uploaded automatically from CI run #26381053515

@aspire-repo-bot
Copy link
Copy Markdown
Contributor

⚠️ Documentation drafting was attempted but the draft PR could not be confirmed.

See the workflow run for details: https://github.com/microsoft/aspire/actions/runs/26381935807

Added CLI reference documentation for the aspire sdk and aspire sdk dump commands, including the new --output-directory option introduced in this PR (triggered by signals: cli_command_file_changed on SdkDumpCommand.cs, cli_option_added for --output-directory, and pr_body_has_cli_flag_mention). Files: new aspire-sdk.mdx, new aspire-sdk-dump.mdx, updated aspire.mdx command table, updated reference.topics.ts sidebar.

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.

3 participants