Repository navigation
Use exported TypeScript names in Kubernetes Ingress/Gateway samples - #2002
Conversation
The TypeScript AppHost samples for Kubernetes Ingress and Gateway routing copied the C# overload names, which the TypeScript SDK exports under distinct capability names: - WithPath -> withIngressPath - WithRoute -> withGatewayPathRoute - WithTls() -> withIngressTlsAuto() - WithTls(issuer) -> withGatewayTlsIssuer(issuer) - WithIngressClass/WithHostname(parameter) -> withIngressClassParam / withIngressHostnameParam / withGatewayHostnameParam Add a unit test that checks Ingress/Gateway calls in TypeScript samples against the generated ts-modules API surface. Co-authored-by: Copilot <[email protected]>
Frontend HTML artifact readyThe latest frontend build uploaded the This comment updates automatically when a new frontend build artifact is uploaded. |
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the TypeScript Kubernetes routing sample corrections and accompanying regression test.
No open issues 🎉
What changed in this PR
This PR corrects Kubernetes Ingress and Gateway TypeScript AppHost samples to use exported SDK method names, addressing API-name and argument-shape drift without changing C# samples or prose.
Changes:
- Updates 15 sample lines across six TypeScript blocks to use the appropriate routing, TLS, and parameter-based methods.
- Adds a regression test that checks recognized Ingress/Gateway calls in English documentation against generated API metadata for exported names, required arguments, and resource-to-string mismatches.
| File | Description |
|---|---|
src/frontend/tests/unit/typescript-kubernetes-routing-apis.vitest.test.ts |
Adds API-surface regression checks for TypeScript routing samples. |
src/frontend/src/content/docs/deployment/kubernetes/aks.mdx |
Corrects Gateway routing, TLS issuer, and hostname parameter calls. |
src/frontend/src/content/docs/deployment/kubernetes-ingress.mdx |
Corrects Ingress path, automatic TLS, and parameter-based calls. |
Review effort: Balanced
Documentation accuracy review [partial — phase A: 15 of 15 changed call claims evaluated; phase B: browser and syntax checks completed, semantic/model/publish validation blocked]Reviewed PR #2002 against Publication note (2026-11-01): the PR merged while this review was paused. The inspected head is unchanged; this report records the requested historical review, not a pre-merge gate. Phase A: 15 changed sample-call claims: 15 verified, 0 verified-with-nuance, 0 unverifiable, 0 contradicted. The explanatory API-name claim in the new regression test agrees with the same owning-source exports. Source reads: Phase B: Independent, source-blind doc-tester exercised the two actual PR pages at Phase A — Claim verificationNo contradicted or unverifiable changed call was found. All 15 changed call claims and owning-source evidencePaths in the location column are relative to
Additional contract evidence: AKS Gateway delegates to the inner Kubernetes environment, AKS cert-manager delegates to the same environment, polyglot parameter dispatcher, generator resolves promise-compatible handle arguments, and generated fluent promises track their underlying work. Therefore un-awaited parameter creation is not by itself evidence of a wrong resource argument. No Aspire version string was added or edited. Surrounding unchanged prose/examples are context, not additional changed-claim findings. Phase B — Independent doc-tester results (verbatim)Documentation Test Report — Frozen Phase BFocus Area: PR #2002: TypeScript Ingress TLS/path/parameter examples and AKS Gateway path/TLS issuer/hostname parameter examples Served identity
No product source, site tests, generated API metadata, or Phase A findings were inspected. No GitHub comments were posted. Summary
Critical IssuesNone demonstrated. This is not an assertion that the APIs or deployment behavior are correct: the required runtime validation could not be completed. WarningsWarning 1: A compatible TypeScript runtime could not be preparedLocation: Both scoped pages; prerequisite/project setup for executable examples. Installed Aspire was: The Ingress page explicitly states:
The default starter preparation failed because its staging package source returned 404s and could not restore A stable 13.6.4 retry failed with:
Impact: No valid TypeScript AppHost was available for type checking, model evaluation, or publishing. These failures are environment limitations, not newly demonstrated documentation defects. Helm was also unavailable on PATH. No global installation or update was performed. Warning 2: TypeScript method names are not consistently explained by nearby proseLocations:
The displayed examples now use methods such as: withIngressPath(...)
withIngressTlsAuto(...)
withIngressHostnameParam(...)
withGatewayPathRoute(...)
withGatewayTlsIssuer(...)
withGatewayHostnameParam(...)Nearby explanations continue to describe await storefront.withTls(letsencrypt, {
hsts: { includeSubDomains: true, preload: true },
});Issue: A TypeScript reader is not explicitly taught how these names correspond or how to extend the issuer example with options. Suggestion: Add TypeScript-specific mapping and an executable customization example. No invalid signature is asserted here, because semantic validation was blocked. Warning 3: Lightweight dev mode has unrelated live-status errorsOn the accepted server: Both scoped pages remained readable. These are not attributed to the changed snippets. Passed Checks
Executed Commands and Results
The syntax check executed: node -e "const fs=require('fs'),path=require('path'),ts=require('./src/frontend/node_modules/typescript');let failed=0;for(const name of fs.readdirSync('.doc-tester-workspace/phase-b-pr2002').filter(n=>n.endsWith('.mts'))){const code=fs.readFileSync(path.join('.doc-tester-workspace/phase-b-pr2002',name),'utf8');const result=ts.transpileModule(code,{fileName:name,reportDiagnostics:true,compilerOptions:{module:ts.ModuleKind.NodeNext,target:ts.ScriptTarget.ESNext}});const errors=(result.diagnostics||[]).filter(d=>d.category===ts.DiagnosticCategory.Error);console.log(name+': '+(errors.length?'FAIL '+errors.map(d=>ts.flattenDiagnosticMessageText(d.messageText,' ')).join('; '):'PASS syntax-only; no type/model/runtime validation'));failed+=errors.length;}process.exitCode=failed?1:0"Result: Seven passes, exit 0. This does not verify API availability, argument types, async behavior, or generated manifests. Knowledge GapsWhat I needed to know: How the TypeScript-specific method names map to the prose’s C#-style overload descriptions, particularly TLS options. Source of my knowledge: No product implementation knowledge was used to resolve this; the mapping remains unverified. User impact: Readers extending the examples may not know which TypeScript method to call. Recommendation: Explain the mapping or provide complete TypeScript variants. Context-dependent snippets—not new defectsThese are AppHost fragments, not standalone programs. They require previously established Recommendations
No cloud authentication, feature registration, Kubernetes deployment, provisioning, or destructive deployment commands were run. Cleanup
Phase B result frozen; no Phase A conclusions incorporated. The blind tester's surrounding-prose observation is retained as requested, not promoted to a changed-line correctness finding. Link/style observations and dev-only live API errors are not merge findings. This partial report consumes the documentation stage once for this PR, independent of future head SHAs; no automatic rerun is implied. |
Summary
The TypeScript AppHost samples for Kubernetes Ingress and Gateway routing use the C# overload names. Those names don't exist in the TypeScript AppHost SDK, so a reader who copies the samples hits
withPath is not a function(or sends the wrong argument type).In the TypeScript SDK, each C# overload is exported under its own capability name. Upstream
microsoft/aspiremain(c77b0c13c34616d1ce4698771bdd445fd50c7a99) defines them inKubernetesIngressExtensions.cs,KubernetesGatewayExtensions.csandCertManagerExtensions.cs. The in-reposrc/data/ts-modules/Aspire.Hosting.Kubernetes.*.jsonsurface matches them.[AspireExport]WithPath(path, endpoint)withIngressPathingress.withPath(...)ingress.withIngressPath(...)WithTls()(Ingress)withIngressTlsAutoingress.withTls()(TSwithTlsrequiressecretName)ingress.withIngressTlsAuto()WithIngressClass(IResourceBuilder<ParameterResource>)withIngressClassParamingress.withIngressClass(param)ingress.withIngressClassParam(param)WithHostname(IResourceBuilder<ParameterResource>)(Ingress)withIngressHostnameParamingress.withHostname(param)ingress.withIngressHostnameParam(param)WithRoute(path, endpoint)withGatewayPathRoutestorefront.withRoute(...)storefront.withGatewayPathRoute(...)WithTls(issuer)(Gateway)withGatewayTlsIssuerstorefront.withTls(letsencrypt)storefront.withGatewayTlsIssuer(letsencrypt)WithHostname(IResourceBuilder<ParameterResource>)(Gateway)withGatewayHostnameParamstorefront.withHostname(param)storefront.withGatewayHostnameParam(param)Upstream's own TypeScript polyglot AppHost uses the same names, for example
gateway.withGatewayTlsIssuer(stagingIssuer)intests/PolyglotAppHosts/Aspire.Hosting.Kubernetes/TypeScript/apphost.mts.This PR changes 15 sample lines in 6 TypeScript blocks:
deployment/kubernetes-ingress.mdx: 3 blocks.deployment/kubernetes/aks.mdx: 3 blocks.The C# samples and the prose are unchanged.
How this was found
I ran a systematic TypeScript AppHost drift audit across all docs:
twoslashblocks, which the build already type-checks.src/data/twoslash/aspire.d.tswith the repo's twoslash compiler options. That produced 202 English diagnostics..d.tsgenerator, not sample errors. For example, upstream emits options objects for all optional parameters, so calls likerunAsEmulator({ configureContainer })are correct.addAzureCosmosDbis already handled by Use addAzureCosmosDB in the EF Core Cosmos DB TypeScript AppHost samples #2001.Regression test
The new
tests/unit/typescript-kubernetes-routing-apis.vitest.test.tsscans the TypeScript samples in the English docs foraddIngress/addGatewayresources. It checks each call on them against the ts-modules surface forKubernetesIngressResource/KubernetesGatewayResource, including inherited interface targets. It flags:stringis required.On
mainit fails with 14 problems:With this change, the test passes.
The 15th line,
aks.mdx:460(withTls(letsencrypt)→withGatewayTlsIssuer), is the same issuer drift. The test doesn't detect it because that snippet reusesletsencryptfrom an earlier block without declaring it.Screenshots
The only visual change is the rendered TypeScript tab text. Captures are Playwright, desktop 1280×900, light theme, against a local dev server.
main)Out of scope
The TypeScript samples in
kubernetes-ingress-aks.mdxandkubernetes-gateway-aks.mdxuse a different, non-canonical shape (import { DistributedApplication } from "@aspire/apphost"with synchronous chaining). Correcting them needs a sample rewrite rather than a rename, so I left them for a separate change.Overlap check: no open issue or PR mentions these names. #1996 and #1868 touch other Kubernetes pages but not these samples.
Third-party links and affiliations
None. The links above point to
microsoft/aspiresource.Validation
npx vitest run tests/unit/typescript-kubernetes-routing-apis.vitest.test.ts: fails onmain(14 problems above) and passes with this change.npx vitest run: 85 files, 1,121 passed, 1 skipped.npx eslint . --max-warnings 0: clean.npx prettier --checkon the new test: clean. The two.mdxfiles already have Prettier warnings onmain, unchanged by this PR.🤖 Posted by AspireAgent (AI Agent)