-
Notifications
You must be signed in to change notification settings - Fork 799
Gate experimental polyglot languages behind per-language feature flags #14428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add per-language experimental feature flags for Python, Go, Java, and Rust. When polyglotSupportEnabled is true, only C# and TypeScript are available by default. Experimental languages require an additional flag: - experimentalPolyglot:python - experimentalPolyglot:go - experimentalPolyglot:java - experimentalPolyglot:rust Changes: - Add IsExperimental property to LanguageInfo record - Add 4 new feature flags to KnownFeatures - Filter experimental languages in DefaultLanguageDiscovery based on flags - Update CI Dockerfiles to enable per-language flags - Update extension JSON schemas with new flag definitions - Update --language option description in NewCommand/InitCommand - Add tests for experimental language filtering
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14428Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14428" |
There was a problem hiding this 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 introduces per-language feature flags to gate experimental polyglot language support in Aspire.Cli, so that polyglot can be enabled broadly while still requiring explicit opt-in for specific experimental languages.
Changes:
- Added new feature flags (
experimentalPolyglot:{python,go,java,rust}) and surfaced them in CLI feature metadata and extension JSON schemas. - Extended language discovery metadata with an
IsExperimentalmarker and filtered experimental languages based on feature flags. - Updated CLI help text, CI polyglot validation Dockerfiles, and added/updated tests to cover experimental language filtering.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Cli.Tests/Projects/DefaultLanguageDiscoveryTests.cs | Updates construction of language discovery and adds tests for experimental language gating. |
| src/Aspire.Cli/Projects/ILanguageDiscovery.cs | Adds IsExperimental to LanguageInfo to support gating logic. |
| src/Aspire.Cli/Projects/DefaultLanguageDiscovery.cs | Implements experimental-language filtering via per-language feature flags. |
| src/Aspire.Cli/KnownFeatures.cs | Defines new experimental polyglot feature flags and metadata. |
| src/Aspire.Cli/Commands/NewCommand.cs | Updates --language help text to reflect default language options. |
| src/Aspire.Cli/Commands/InitCommand.cs | Updates --language help text to reflect default language options. |
| extension/schemas/aspire-settings.schema.json | Adds features.experimentalPolyglot schema entries for settings validation/intellisense. |
| extension/schemas/aspire-global-settings.schema.json | Adds features.experimentalPolyglot schema entries for global settings validation/intellisense. |
| .github/workflows/polyglot-validation/Dockerfile.* | Enables the relevant experimental polyglot flag in each language validation container. |
| if (s_experimentalFeatureFlags.TryGetValue(language.LanguageId.Value, out var featureFlag)) | ||
| { | ||
| return features.IsFeatureEnabled(featureFlag, false); | ||
| } | ||
|
|
||
| return true; |
Copilot
AI
Feb 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DefaultLanguageDiscovery now filters experimental languages only by the per-language flag, but the feature metadata/docs state these flags require polyglotSupportEnabled. As-is, enabling experimentalPolyglot:* will surface the language even when polyglotSupportEnabled is false. Consider updating IsLanguageEnabled to also require features.IsFeatureEnabled(KnownFeatures.PolyglotSupportEnabled, false) (at least for experimental languages) so runtime behavior matches the documented requirement.
| if (s_experimentalFeatureFlags.TryGetValue(language.LanguageId.Value, out var featureFlag)) | |
| { | |
| return features.IsFeatureEnabled(featureFlag, false); | |
| } | |
| return true; | |
| // Experimental languages require polyglot support to be enabled globally. | |
| if (!features.IsFeatureEnabled(KnownFeatures.PolyglotSupportEnabled, false)) | |
| { | |
| return false; | |
| } | |
| if (s_experimentalFeatureFlags.TryGetValue(language.LanguageId.Value, out var featureFlag)) | |
| { | |
| return features.IsFeatureEnabled(featureFlag, false); | |
| } | |
| // If there is no per-language feature flag defined, treat the experimental language as disabled. | |
| return false; |
| /// - Configuration files (~/.aspire/languages.json) | ||
| /// - NuGet search (Aspire.Hosting.Language.* packages) | ||
| /// - Remote service endpoints | ||
| /// Experimental languages (Go, Java, Rust) are filtered based on per-language feature flags. |
Copilot
AI
Feb 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The remarks mention experimental languages as “(Go, Java, Rust)”, but this file also marks Python as experimental. Update the remark to include Python (or reword to avoid listing specific languages) so the documentation matches behavior.
| /// Experimental languages (Go, Java, Rust) are filtered based on per-language feature flags. | |
| /// Experimental languages are filtered based on per-language feature flags. |
| public async Task GetAvailableLanguagesAsync_ReturnsPythonLanguage() | ||
| { | ||
| var discovery = new DefaultLanguageDiscovery(); | ||
| var features = new TestFeatures(); |
Copilot
AI
Feb 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests enable the per-language experimental flag but do not enable KnownFeatures.PolyglotSupportEnabled. The PR description/feature metadata say experimental polyglot flags require polyglotSupportEnabled, so the tests should set both flags (or the implementation/docs should be adjusted for consistency).
| var features = new TestFeatures(); | |
| var features = new TestFeatures(); | |
| features.SetFeature(KnownFeatures.PolyglotSupportEnabled, true); |
| var features = new TestFeatures(); | ||
| features.SetFeature(featureFlag, true); | ||
| var discovery = new DefaultLanguageDiscovery(features); | ||
|
|
Copilot
AI
Feb 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parametrized test enables experimentalPolyglot:* flags but not polyglotSupportEnabled. If experimental language availability is intended to be additive on top of polyglotSupportEnabled (per PR description), set KnownFeatures.PolyglotSupportEnabled to true in the test setup as well.
| var features = new TestFeatures(); | ||
| features.SetFeature(KnownFeatures.ExperimentalPolyglotGo, true); | ||
| var discovery = new DefaultLanguageDiscovery(features); |
Copilot
AI
Feb 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test enables KnownFeatures.ExperimentalPolyglotGo but not KnownFeatures.PolyglotSupportEnabled. To match the documented requirement that experimental polyglot flags require polyglot support, the test should enable both (or update the implementation/docs).
| return features.IsFeatureEnabled(featureFlag, false); | ||
| } | ||
|
|
||
| return true; |
Copilot
AI
Feb 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IsLanguageEnabled returns true if an experimental language isn't present in s_experimentalFeatureFlags. That means a future contributor could mark a language as experimental but forget to add the mapping, and it would become enabled by default (opposite of the intended gating). Consider defaulting to false when IsExperimental is true and no feature-flag mapping exists.
| return true; | |
| return false; |
| public void GetLanguageById_ReturnsExperimentalLanguageWhenFlagEnabled() | ||
| { | ||
| var features = new TestFeatures(); | ||
| features.SetFeature(KnownFeatures.ExperimentalPolyglotRust, true); |
Copilot
AI
Feb 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test enables KnownFeatures.ExperimentalPolyglotRust but not KnownFeatures.PolyglotSupportEnabled. If experimental polyglot languages are meant to be gated by both flags, the test should set polyglotSupportEnabled too (or the docs/implementation should be reconciled).
| features.SetFeature(KnownFeatures.ExperimentalPolyglotRust, true); | |
| features.SetFeature(KnownFeatures.ExperimentalPolyglotRust, true); | |
| features.SetFeature(KnownFeatures.PolyglotSupportEnabled, true); |
| _languageOption = new Option<string?>("--language", "-l") | ||
| { | ||
| Description = "The programming language for the AppHost (csharp, typescript, python)" | ||
| Description = "The programming language for the AppHost (csharp, typescript)" |
Copilot
AI
Feb 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The --language help text now lists only “csharp, typescript”, but the command can accept additional experimental languages when their feature flags are enabled. Consider tweaking the description to mention that more languages may be available when experimental polyglot flags are turned on, to avoid making --help misleading for users who enable them.
| Description = "The programming language for the AppHost (csharp, typescript)" | |
| Description = "The programming language for the AppHost (for example: csharp, typescript; additional experimental languages may be available when polyglot features are enabled)" |
| _languageOption = new Option<string?>("--language", "-l") | ||
| { | ||
| Description = "The programming language for the AppHost (csharp, typescript, python)" | ||
| Description = "The programming language for the AppHost (csharp, typescript)" |
Copilot
AI
Feb 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The --language help text now lists only “csharp, typescript”, but init --language can also accept experimental languages when their feature flags are enabled. Consider mentioning the experimental flags in the option description so --help stays accurate for those scenarios.
| Description = "The programming language for the AppHost (csharp, typescript)" | |
| Description = "The programming language for the AppHost (csharp, typescript; additional experimental languages may be available when enabled via feature flags)." |
🎬 CLI E2E Test RecordingsThe following terminal recordings are available for commit
📹 Recordings uploaded automatically from CI run #21871647512 |
Summary
Add per-language experimental feature flags for Python, Go, Java, and Rust polyglot languages. When
polyglotSupportEnabledistrue, only C# and TypeScript are available by default. Experimental languages require an additional flag to be enabled.New Feature Flags
experimentalPolyglot:pythonfalseexperimentalPolyglot:gofalseexperimentalPolyglot:javafalseexperimentalPolyglot:rustfalseBehavior Matrix
polyglotSupportEnabledfalse(default)truetrueexperimentalPolyglot:python=truetrueexperimentalPolyglot:go=truePer-language flags are additive on top of
polyglotSupportEnabled.Changes
KnownFeatures.cs— Added 4 new feature flag constants and metadata entriesILanguageDiscovery.cs— AddedIsExperimentalproperty toLanguageInforecordDefaultLanguageDiscovery.cs— InjectedIFeatures, filters experimental languages based on per-language flags in all discovery methodsNewCommand.cs/InitCommand.cs— Updated--languageoption descriptionDockerfile.go/java/rust/python— CI polyglot validation enables per-language experimental flagsexperimentalPolyglotobject with per-language propertiesDefaultLanguageDiscoveryTests.cs— Added tests for experimental language filteringUsage