Repository navigation
Enable terminal configuration callbacks in TypeScript AppHosts - #21116
Conversation
Export WithTerminal directly through ATS, preserve dimension validation and defaults, and stabilize the resource terminal configuration API. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f3d7b933-6c1d-4ae9-9403-2781fa45ca12
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21116Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21116" |
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot App <[email protected]> Copilot-Session: f3d7b933-6c1d-4ae9-9403-2781fa45ca12
There was a problem hiding this comment.
🟡 Changes recommended
SDK wire-name mismatches, missing Python callback writeback, and required Rust callbacks prevent correct configuration or break default calls.
6 open issues
Go DTO wire-name mismatch drops callback dimensions · New Java DTO mapping uses incorrect capitalized wire keys · New Python TypedDict uses incorrect capitalized wire keys · New Python callback wrapper discards mutated DTO arguments · New Rust DTO serde names mismatch host callback keys · New Rust callback API breaks parameterless with_terminal calls · New
What changed in this PR
Exposes terminal-dimension configuration through Aspire’s polyglot SDKs using the existing callback and options type.
Changes:
- Exports
WithTerminalcallbacks with background-thread execution. - Removes experimental status from resource-terminal configuration.
- Updates documentation, regression tests, and five SDK snapshots.
| File | Description |
|---|---|
| tests/Aspire.Hosting.Tests/WithTerminalTests.cs | Verifies non-experimental API status. |
| tests/Aspire.Hosting.RemoteHost.Tests/CapabilityDispatcherTests.cs | Tests defaults, callback mutations, and validation. |
| tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts | Adds terminal configuration callbacks. |
| tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.rs | Adds terminal DTO and callback parameters. |
| tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py | Adds terminal DTO and callback options. |
| tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java | Adds terminal DTO and callback overloads. |
| tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go | Adds terminal DTO and callback writeback. |
| src/Aspire.Hosting/TerminalResourceBuilderExtensions.cs | Exports the existing configuration callback. |
| src/Aspire.Hosting/ApplicationModel/TerminalAnnotation.cs | Marks terminal options as a non-experimental DTO. |
| docs/specs/with-terminal.md | Documents configuration and experimental boundaries. |
Review effort: Balanced
This comment has been minimized.
This comment has been minimized.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
There was a problem hiding this comment.
🟡 Changes recommended
DTO writeback silently discards floating-point-encoded integer dimensions from generated SDK callbacks.
7 open issues
DTO writeback rejects floating-point integer dimensions · New Rust callback API breaks parameterless with_terminal calls Rust DTO serde names mismatch host callback keys Python callback wrapper discards mutated DTO arguments Python TypedDict uses incorrect capitalized wire keys Java DTO mapping uses incorrect capitalized wire keys Go DTO wire-name mismatch drops callback dimensions
Review effort: Balanced
Align DTO wire names with the host, return Python DTO mutations, preserve Rust default calls, and accept integral decimal-form callback numbers. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f3d7b933-6c1d-4ae9-9403-2781fa45ca12
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🔵 Needs a closer look
Shared SDK changes have an unresolved correctness issue and require human review after updated-head end-to-end validation.
1 open issue
7 resolved since last review
DTO writeback rejects floating-point integer dimensions Rust callback API breaks parameterless with_terminal calls Rust DTO serde names mismatch host callback keys Python callback wrapper discards mutated DTO arguments Python TypedDict uses incorrect capitalized wire keys Java DTO mapping uses incorrect capitalized wire keys Go DTO wire-name mismatch drops callback dimensions
Review effort: Balanced
Use functional TypedDict syntax for reserved wire keys while deferring forward references, and cover generation and import in the terminal callback probe. Co-authored-by: Copilot App <[email protected]> Copilot-Session: f3d7b933-6c1d-4ae9-9403-2781fa45ca12
This comment has been minimized.
This comment has been minimized.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Merged current main in 247aa03 and resolved the terminal export conflict by retaining the configurable callback export, while preserving the new auto-fit behavior. Refreshed the generated TypeScript documentation snapshot and added ATS coverage proving that omitted/empty dimension updates retain auto-fit eligibility while explicit dimensions (including default-valued dimensions) disable it. Merged-head local results: terminal hosting 70 passed / 1 platform skip; ATS dispatcher/callback/marshaller 284 passed; TypeScript 135, Go 34, Java 61, Python 29, and Rust 21 passed. The remaining Python-fixture review thread has been replied to and resolved; no unresolved review threads remain. New-head CI: https://github.com/microsoft/aspire/actions/runs/39217098942 (running). The earlier 7/7 artifact E2E report remains evidence for e4314ac, not this merge commit. Human approval is still required; the PR has not been merged. |
This comment has been minimized.
This comment has been minimized.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Merged-head CI is now green: https://github.com/microsoft/aspire/actions/runs/39217098942 completed successfully for 247aa03. The main merge and conflict resolution are pushed, local regression suites passed, and all previously outstanding review threads were addressed. Human approval is still required; this PR has not been merged. |
Co-authored-by: Copilot App <[email protected]> Copilot-Session: f3d7b933-6c1d-4ae9-9403-2781fa45ca12
This comment has been minimized.
This comment has been minimized.
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
Final PR Testing ReportPR Information
Artifact Version VerificationInstalled the actual PR dogfood artifacts into a new isolated temporary directory: curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh |
bash -s -- 21116 --install-path "$testDir" --skip-path --skip-extension
CLI="$testDir/dogfood/pr-21116/bin/aspire"
"$CLI" --versionPassed: Changes ExercisedThe scenarios exercise the generated TypeScript callback, ATS DTO writeback, terminal dimensions, validation, and stable C# configuration. They also verify the interaction with the terminal auto-fit feature merged from main: a no-op callback must preserve auto-fit, but explicitly assigning either dimension—even to its default—must disable it. The producer ran under a real PTY and recorded Test Scenarios Executed
All eight positive cases reported both stdin and stdout as TTYs. Every AppHost was stopped with its explicit Exact commands and resultsEach TypeScript case used its own newly scaffolded project: "$CLI" new aspire-ts-empty --name TerminalProbe --output "$scenarioDir" \
--source "$testDir/hives/pr-21116/packages" \
--version 17.0.0-pr.21116.g092d2720 \
--localhost-tld false --suppress-agent-init --non-interactive
"$scenarioDir/node_modules/.bin/tsc" --project "$scenarioDir/tsconfig.apphost.json"Passed: all nine TypeScript projects scaffolded and type-checked. "$CLI" new aspire-empty --name TerminalCSharp --output "$testDir/csharp" \
--source "$testDir/hives/pr-21116/packages" \
--version 17.0.0-pr.21116.g092d2720 \
--localhost-tld false --suppress-agent-init --non-interactivePassed: C# scaffolded, compiled, and ran with For each successful scenario: "$CLI" start --apphost "$apphost" --isolated --format json --non-interactive
"$CLI" wait probe --status up --timeout 120 --apphost "$apphost" --non-interactive
"$CLI" describe probe --apphost "$apphost" --format json --non-interactive
"$CLI" stop --apphost "$apphost" --non-interactivePassed: all eight positive starts, structured readiness checks, size assertions, snapshot assertions, and stops. The two negative cases used the same Focused Regression CoverageThe generated Python SDK-to-host test invokes actual generated Local suites on the final head passed: 285 ATS host tests, 29 Python generator tests, 202 JavaScript runtime tests, 135 TypeScript generator tests, and 70 hosting terminal tests (one platform skip). Strict targeted type-checking of the changed transport passed. The broader JavaScript test-project type-check still reports unrelated missing generated modules and existing test typing errors; it is not counted as passed. Go (34), Java (61), and Rust (21) generator suites passed locally after merging main; final-head CI also passed. CI and Review Status
Limitations and Cleanup
Overall ResultFinal head verified: 10/10 artifact E2E scenarios passed and CI is green. |
PR Testing ReportPR Information
Artifact Version Verification
Changes Analyzed
Categories: [x] Hosting [x] Codegen/SDK [x] Tests [ ] CLI [ ] Dashboard [ ] Templates [ ] Extension [ ] CI infra Test Scenarios ExecutedEach scenario used a fresh
Overall Result✅ PR VERIFIED - 10/10 scenarios behaved as specified, consistent with the author's report. Not exercised: Go/Java/Rust SDKs at runtime (covered only by the PR's executable generator tests), Linux/macOS PTY behavior. Notes
|
David Pine (IEvangelist)
left a comment
There was a problem hiding this comment.
This all looks good and well. But I think the naming convention for Python should be different.
Preserve assignment-aware DTO callback writeback and retain AKS node pool callback regression coverage from main. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 3a95a878-d1d2-4e7b-9b15-5e2ef288eedf
Tests selector55 / 100 PR test projects · 7 PR jobs, from 19 changed files. Selected PR test projects (55 / 100)
Selected PR jobs (7)
How these were chosen — grouped by what changed
🔧 show 40
🔧 🧪 📦 affected project 📦 affected project 📦 affected project 🔧 🔧 🔧 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 🧪 Job reasons
Selection computed for commit |
|
Pull request created: #1959
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#1959 targeting Updated Note This draft PR needs human review before merging. |
Resolve the single conflict, the Go two-pass-scanning snapshot (TwoPassScanningGeneratedAspire.verified.go), by regenerating it from the merged tree instead of hand-merging the 45K-line generated file. The regenerated snapshot picks up main's TerminalOptions DTO and WithTerminal(options ...*WithTerminalOptions) changes (#21116) rendered with this PR's godoc comments. Ignoring comment and blank lines it is identical to main's snapshot. Co-authored-by: Copilot App <[email protected]>
…pHosts (#1959) Documents changes from microsoft/aspire#21116 Author: ``@davidfowl`` (source PR author per metadata; see source PR) Targeting `release/17.0` based on the source PR milestone `17.0` (`target_resolution`: `exact_match`). ## Why The source PR exports the `WithTerminal` callback to TypeScript AppHosts so columns and rows can be configured, and removes the `ASPIRETERMINAL001` experimental diagnostic from `WithTerminal` and `TerminalOptions`. The docs said TypeScript couldn't configure dimensions and that `WithTerminal` was experimental. ## Changes (updated existing pages) - `src/frontend/src/content/docs/app-host/with-terminal.mdx`: TypeScript `configure` callback example and auto-fit behavior; replaced the experimental caution with a note; removed the pragma from the C# examples in that section. - `src/frontend/src/content/docs/dashboard/terminals.mdx`: removed the `ASPIRETERMINAL001` pragma from the `WithTerminal` C# example. Note for the SME: other pragmas on pages that use AppHost-owned terminals remain intentionally, and the replica example in `with-terminal.mdx` may still carry one; please check. > Generated by [PR Documentation Check](https://github.com/microsoft/aspire/actions/runs/40473856476) for #21116 · copilot · auto · 29.1 AIC · ⌖ 1.15 AIC · ⊞ 7.1K · [◷](https://github.com/search?q=repo%3Amicrosoft%2Faspire.dev+%22gh-aw-workflow-id%3A+pr-docs-check%22&type=pullrequests) <!-- gh-aw-agentic-workflow: PR Documentation Check, engine: copilot, model: auto, id: 40473856476, workflow_id: pr-docs-check, run: https://github.com/microsoft/aspire/actions/runs/40473856476 --> <!-- gh-aw-workflow-id: pr-docs-check --> <!-- gh-aw-workflow-call-id: microsoft/aspire/pr-docs-check -->


Description
TypeScript AppHosts could enable resource terminals but could not configure their initial dimensions. Export the existing
WithTerminalcallback through ATS so polyglot AppHosts can set columns and rows, retaining the 132×50 defaults and positive-dimension validation.Mark the existing
TerminalOptionsas an ATS DTO and use callback writeback rather than a separate adapter or configuration type. Run the synchronous export on a background thread so callbacks can re-enter ATS. RemoveASPIRETERMINAL001fromWithTerminalandTerminalOptions; AppHost-owned terminals,TerminalService, and interaction APIs remain experimental.Address the shared SDK issues exposed by the callback: use camel-case DTO wire names in Go, Java, Python, and Rust; return mutated DTO arguments from Python void callbacks; and use checked integer conversion for whole-number values encoded as
200.0. Keep builder defaults and exported DTO values aligned with the corrected names. Python keyword keys use functional TypedDict declarations with deferred forward references. Add executable SDK round-trip probes, host validation cases, documentation, and regenerated snapshots. Update the Python validation AppHosts to use the corrected camelCase DTO keys.Rust intentionally keeps a single callback-taking
with_terminalmethod. Since Rust support is in preview, this accepts the parameterless-call breaking change rather than adding a compatibility method or optional callback wrapper. This follows the Rust generator's existing required-callback convention.Merged
main, retaining its terminal auto-fit behavior. TypeScript and Python preserve assignment intent in callback DTO writeback: a no-op callback leaves auto-fit enabled, while explicitly assigning either dimension—even its default value—disables auto-fit. Regression coverage executes a generated Python SDK callback, feeds its actual payload through the host dispatcher, and asserts the resultingterminal.autoFitresource snapshot.User-facing usage
TypeScript
resource.withTerminal()and a no-op callback preserve default dimensions and automatic dashboard fitting. Leaving one dimension unchanged preserves its default. Rust useswith_terminal(callback); a callback returningserde_json::Value::Nullretains the defaults, while a configuring callback returns its updated DTO underp0.C# AppHosts use the same callback without an experimental warning:
Validation
Final head
092d272044: CI green; 10/10 PR-artifact E2E scenarios passed. Full final-head report, exact commands, and results.Actual artifact
17.0.0-pr.21116.g092d2720was installed into an isolated temporary directory. Nine fresh TypeScript projects and one C# project exercised real producer PTYs: custom 200×60, omitted and no-op callbacks 132×50, explicit-default columns and rows 132×50, partial 180×50, minimum 1×1, invalid zero/negative values, and C# 160×40 with warnings as errors and no suppression. Resource snapshots confirmed auto-fit remains enabled only for omitted/no-op callbacks and is disabled by explicit assignments, including default values. Invalid dimensions returned exit 2 andINVALID_ARGUMENTwithout launching the producer. All AppHosts were stopped and temporary installs/projects cleaned up.The following commands passed locally. Python probes used installed Python 3.14 as
python3onPATH../restore.sh— passed.dotnet test --project tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj --no-launch-profile -- --filter-class '*.WithTerminalTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'— passed: 70 tests; 1 platform-specific test skipped on macOS.dotnet test --project tests/Aspire.Hosting.RemoteHost.Tests/Aspire.Hosting.RemoteHost.Tests.csproj --no-launch-profile -- --filter-class '*.CapabilityDispatcherTests' --filter-class '*.CallbackProxyTests' --filter-class '*.AtsMarshallerTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'— passed: 285 tests, including generated-SDK-to-host auto-fit regression, decimal-form dimensions, and invalid fractional/out-of-range values.dotnet test --project tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.csproj --no-launch-profile -- --filter-class '*.AtsTypeScriptCodeGeneratorTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'— passed: 135 tests.npm test --prefix tests/Aspire.Hosting.CodeGeneration.TypeScript.JsTests— passed: 202 JavaScript runtime tests, including no-op/default-assignment DTO callbacks and nested mutations. Strict targeted type-checking of the changed transport also passed; the broader test-project type-check reports unrelated missing generated modules and existing test typing errors and is not counted as passed.dotnet test --project tests/Aspire.Hosting.CodeGeneration.Python.Tests/Aspire.Hosting.CodeGeneration.Python.Tests.csproj --no-launch-profile -- --filter-class '*.AtsPythonCodeGeneratorTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'— passed: 29 tests, including sparse callback writeback and Python keyword keys with forward references.dotnet test --project tests/Aspire.Hosting.CodeGeneration.Go.Tests/Aspire.Hosting.CodeGeneration.Go.Tests.csproj --no-launch-profile -- --filter-class '*.AtsGoCodeGeneratorTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'— passed after merging main: 34 tests, including executable Go DTO round trip.dotnet test --project tests/Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.Java.Tests.csproj --no-launch-profile -- --filter-class '*.AtsJavaCodeGeneratorTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'— passed after merging main: 61 tests, including executable Java DTO/callback probes using a temporary JDK 21.dotnet test --project tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Aspire.Hosting.CodeGeneration.Rust.Tests.csproj --no-launch-profile -- --filter-class '*.AtsRustCodeGeneratorTests' --filter-not-trait 'quarantined=true' --filter-not-trait 'outerloop=true'— passed after merging main: 21 tests, including executable Rust DTO and single-method terminal callback probes.git diff --check— passed.Final-head CI completed successfully after automatic reruns: 325 passed checks, 12 skipped, none failed or pending. All review threads are resolved. Human approval is still required; the PR has not been merged.
Checklist
<remarks />and<code />elements on your triple slash comments?