Skip to content

Use the apphost.mts layout in Japanese TypeScript AppHost docs - #2003

Merged
David Pine (IEvangelist) merged 2 commits into
mainfrom
aspireagent/fix-ja-legacy-typescript-apphost-layout
Nov 3, 2026
Merged

David Pine (IEvangelist) merged 2 commits into
mainfrom
aspireagent/fix-ja-legacy-typescript-apphost-layout

Conversation

@davidfowl

@davidfowl David Fowler (davidfowl) commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Japanese TypeScript AppHost docs still described the pre-13.4 apphost.ts layout, while the English pages use apphost.mts and ./.aspire/modules/aspire.mjs. I found this with a type-check audit of the localized TypeScript AppHost samples, using the same twoslash compiler and src/data/twoslash/aspire.d.ts setup as the English audit.

  • ja/architecture/resource-hierarchies.mdx: the EndpointReferenceExpression TypeScript sample imported ./.modules/aspire.js under the title TypeScript — apphost.ts.
    • Projects created by current Aspire CLIs generate the SDK in .aspire/modules/aspire.mjs, so readers who copy the sample get Cannot find module './.modules/aspire.js' (TS2307 in the audit).
    • The import and title now match the English sample: ./.aspire/modules/aspire.mjs, apphost.mts.
  • ja/architecture/multi-language-architecture.mdx: the guest/host description, the Mermaid diagram and the code-generation steps called the guest apphost.ts and the SDK folder .modules/. They now match the English page: apphost.mts, .aspire/modules/.

Legacy apphost.ts / ./.modules/aspire.js references that remain are intentional. The Aspire 13.4 release notes and the "projects created before 13.4" asides describe that layout for migration.

Regression check: new tests/unit/typescript-apphost-sdk-imports.vitest.test.ts.

  • It walks TypeScript fences in every locale and fails when a fence imports the generated SDK from any path other than ./.aspire/modules/aspire.mjs, or when a current-layout fence is titled apphost.ts.
  • Release notes under whats-new/ are skipped because they intentionally show the layout they migrate from.
  • A fixture test covers both rules.

On main it fails:

- []
+ [
+   "ja/architecture/resource-hierarchies.mdx: line 437: ./.modules/aspire.js",
+ ]

After this change it passes.

Localized audit counts

  • 14 locale folders, 73 localized pages, 144 TypeScript fences.
  • 74 fences are twoslash blocks, which the build already type-checks. 49 non-twoslash AppHost blocks were compiled (31 full samples and 18 fragments with a createBuilder preamble).
  • 26 diagnostics in 17 blocks on main; 25 after this change. The resource-hierarchies block now compiles cleanly.
  • The remaining diagnostics were left alone. They match the English pages, which have the same samples, and fall into these groups:
    • createReferenceExpression, a known SDK gap.
    • The tutorial-defined addMy* integrations.
    • Fragments that reference names defined elsewhere on the page.
    • Argument-shape gaps from the local .d.ts options heuristic.
    • Two release-note items.
  • fundamentals/custom-resource-commands.mdx calls addNodeApp with two arguments in both the English and Japanese pages, but the SDK requires (name, appDirectory, scriptPath). I left it out because open PR Add the config-driven AppHost language foundation #1634 rewrites that English page.

No open issue or PR touches these Japanese files.

Screenshots

Captured with Playwright on astro dev: desktop 1280px, light theme, TypeScript tab.

/ja/architecture/resource-hierarchies/, TypeScript sample

Before After
Before: Japanese resource hierarchies sample titled apphost.ts importing ./.modules/aspire.js, desktop light After: sample titled apphost.mts importing ./.aspire/modules/aspire.mjs, desktop light

/ja/architecture/multi-language-architecture/, guest process diagram

Before After
Before: guest process diagram showing apphost.ts and Generated SDK (.modules/), desktop light After: guest process diagram showing apphost.mts and Generated SDK (.aspire/modules/), desktop light

Third-party links and affiliations

None.

Validation

  • npx vitest run tests/unit/typescript-apphost-sdk-imports.vitest.test.ts: fails on main (output above) and passes with this change.
  • npx vitest run: 85 files, 1122 passed, 1 skipped.
  • npx eslint . --max-warnings 0: clean. The new test is Prettier-formatted.
  • Localized twoslash audit rerun: the resource-hierarchies block no longer reports TS2307.
  • Rendered output checked in the screenshots above.

🤖 Posted by AspireAgent (AI Agent)

The Japanese resource hierarchies TypeScript sample still imported the
pre-13.4 SDK path ./.modules/aspire.js under an apphost.ts title, which
does not resolve in projects created by current Aspire CLIs and fails to
type-check against the documented SDK. The Japanese multi-language
architecture page also described the guest as apphost.ts with a
.modules/ SDK. Align both with the English pages (apphost.mts and
./.aspire/modules/aspire.mjs) and add a unit check that TypeScript
samples in every locale import the generated SDK from the current path.

Co-authored-by: Copilot <[email protected]>
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Frontend HTML artifact ready

The latest frontend build uploaded the frontend-dist artifact for PR #2003. Use the VS Code button below to open this PR with GitHub Artifacts Explorer and browse the built HTML locally.

VS Code: Open PR #2003 artifacts

This comment updates automatically when a new frontend build artifact is uploaded.

@davidfowl
David Fowler (davidfowl) marked this pull request as ready for review October 30, 2026 19:59
Copilot AI balanced review requested due to automatic review settings October 30, 2026 19:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the Japanese AppHost documentation alignment and accompanying regression-test changes.

No open issues 🎉

What changed in this PR

Updates the Japanese TypeScript AppHost architecture docs to match the current apphost.mts layout used by the English documentation.

Changes:

  • Corrects the SDK import and filename in the resource-hierarchies sample.
  • Updates the guest-process description, diagram, and SDK-generation paths.
  • Adds a cross-locale regression test for legacy SDK imports and mismatched sample titles, excluding release notes.
File Description
src/​frontend/​tests/​unit/​typescript-apphost-sdk-imports.vitest.test.ts Adds layout checks across documentation locales and fixture coverage.
src/​frontend/​src/​content/​docs/​ja/​architecture/​resource-hierarchies.mdx Changes the sample to apphost.mts and ./.aspire/modules/aspire.mjs.
src/​frontend/​src/​content/​docs/​ja/​architecture/​multi-language-architecture.mdx Aligns prose and diagram paths with the current AppHost layout.

Review effort: Balanced

@IEvangelist

Copy link
Copy Markdown
Member

Documentation accuracy review [partial]

[partial — phase A: 7 of 7 edited claims evaluated; phase B: rendering and compilation passed, full runtime validation blocked]

Reviewed PR #2003 against main, head f8acca30fbe181c53dfa8553b8f679241137e072, base f05f5561b1b858344124cd848ff06469627d7e6e, using the repository's doc-pr-reviewer skill and an isolated, source-blind doc-tester run.

Result: No documentation defect established in the edited claims. Phase A: 7 verified, 0 verified-with-nuance, 0 unverifiable, 0 contradicted. Phase B: both affected Japanese pages exercised; 0 critical issues, 2 validation-limit warnings. Full runtime behavior was not verified because the sample references an external Worker project that was not present. This is a top-level report, not a formal review verdict.

Owning source: microsoft/aspire, main at 6a8f53125b8788df3c409088381057a3c0dacfff. The site's active version is 13.6.0; the filename, SDK import, output directory, and Node.js launcher were additionally checked against v13.6.0 at 56f3e9c0d216c0c7069dabb49dd0464e4827744f. No English documentation was used as the source of truth. No Community Toolkit or Azure SDK claim required another owning repository.

Phase A — Claim verification

All seven edited claims and pinned source evidence

Locations below are relative to src/frontend/src/content/docs/ja/architecture/.

Claim PR location and exact changed text Verdict Owning-source evidence
C1 multi-language-architecture.mdx:21: Node.js guest process uses apphost.mts Verified TypeScriptLanguageSupport.cs:29-30,68-73 declares the Node.js language and default filename; :258-275 launches the AppHost with npx --no-install tsx.
C2 multi-language-architecture.mdx:28: diagram node TS["apphost.mts"] Verified DefaultLanguageDiscovery.cs:33-39 selects apphost.mts for TypeScript/Node.js. The unchanged local JSON-RPC connection is corroborated by transport.mts:1040-1045 and :1124-1125.
C3 multi-language-architecture.mdx:29: diagram Generated SDK (.aspire/modules/) Verified ILanguageDiscovery.cs:66 defines Path.Combine(".aspire", "modules"); GuestAppHostProject.cs:2110-2143 writes generated files there for the modern layout.
C4 multi-language-architecture.mdx:55: startup SDK output is .aspire/modules/ Verified Same output-path implementation as C3; CodeGenerationService.cs:243-266 generates the SDK from the ATS context, and GuestAppHostProject.cs:2102-2110 requests generation and selects the output directory.
C5 multi-language-architecture.mdx:111: typed wrappers are output to .aspire/modules/ Verified AtsTypeScriptCodeGenerator.cs:456-464 produces the TypeScript SDK; CLI output-path evidence is C3.
C6 resource-hierarchies.mdx:437: title="apphost.mts" Verified TypeScriptLanguageSupport.cs:30,68-73 scaffolds this filename and the modern import together.
C7 resource-hierarchies.mdx:438: import { createBuilder, EndpointProperty } from './.aspire/modules/aspire.mjs'; — changed module specifier Verified ts-starter/apphost.mts:1 uses this exact module path. The source-blind tester independently compiled the displayed sample with both imported symbols.

Release cross-check: v13.6.0 scaffold import, generated directory, generation output path, and Node launcher agree.

The modern default does not mean legacy projects stop working: the owning CLI explicitly retains the old layout for detected legacy AppHosts. That does not contradict these modern-layout edits. Unchanged architecture claims and unchanged sample APIs were not expanded into an unrelated audit.

Phase B — Independent doc-tester report (verbatim)

Documentation Test Report — Frozen

Focus: Phase B only, microsoft/aspire.dev PR #2003
Date: 2026-10-31
Tester: Blind doc-tester assessment
SHA: f8acca30fbe181c53dfa8553b8f679241137e072
Result: Scoped rendering and TypeScript compilation passed; runtime validation partial.

Summary

Category Passed Failed Warnings
Content Accuracy 3 0 0
Code Examples 2 0 1
CLI Commands 1 0 1
Links / Route Availability 2 0 0
Total 8 0 2

Counts represent scoped checks, not certification of unchanged architectural claims.

Scope and Independence

Loaded doc-tester, playwright-cli, and—before operating Aspire CLI—aspire. Read available skill guidance and repository development instructions.

Did not read owning Aspire source, test files, or other reviewer conclusions. Documentation was inspected as displayed through playwright-cli exclusively. No production build, repository content edits, commits, pushes, comments, or formal review.

Routes and Environment

Confirmed owned local URL: http://localhost:4322/

  • /ja/architecture/multi-language-architecture/
  • /ja/architecture/resource-hierarchies/

Port 4321 belonged to another checkout. Initial observations there were discarded; both checks were repeated against the confirmed owned server on 4322.

Critical Issues

None established within the changed sections.

Warnings

1. Runtime verification stopped at an external Worker prerequisite

The displayed sample was copied verbatim into a freshly scaffolded TypeScript AppHost.

Its generated SDK import resolved, and execution reached addProject, then stopped:

Capability: Aspire.Hosting/addProject
Project file '…\phaseb2003\Worker\Worker.csproj' was not found.

Assessment: Runtime validation is partial. Redis orchestration, Worker environment injection, and final application behavior were not verified. The missing Worker is not evidence that the changed filename or import is defective.

2. Installed CLI’s default staging scaffolding failed

Installed Aspire CLI: 13.4.0+3f0998a95833d5fef96b3159d56b667889b71166.

Default scaffolding failed because its staging feed returned missing-package errors for Aspire.Hosting and Aspire.Hosting.CodeGeneration.TypeScript. A bounded retry using --channel stable succeeded.

Assessment: Environment/feed limitation, not a documentation defect.

Passed Checks

  1. Guest-process prose displays apphost.mts.
  2. The Mermaid diagram renders successfully and labels:
    • apphost.mts
    • Generated SDK (.aspire/modules/)
  3. Startup-sequence and SDK-generation prose consistently display .aspire/modules/.
  4. Resource-hierarchy TypeScript example displays filename apphost.mts and import:
    import { createBuilder, EndpointProperty } from './.aspire/modules/aspire.mjs';
  5. Browser-copied sample passes Node syntax checking and the scaffold’s TypeScript build with zero diagnostics.
  6. Stable TypeScript scaffolding succeeds and generates the SDK consumed during compilation/execution.
  7. Japanese multi-language architecture route loads successfully.
  8. Japanese resource-hierarchies route loads successfully.

No changed hyperlinks required additional target checks; unrelated navigation was not audited.

Exact Command Outcomes

Bun commands after installation used .doc-tester-workspace\phaseb-tools\node_modules\.bin prepended to the process-local PATH.

Command Outcome
git rev-parse HEAD Requested SHA confirmed before and after testing
playwright-cli --help Passed; existing CLI available
bun run dev Failed: Bun missing from PATH
npm install --prefix .doc-tester-workspace\phaseb-tools --no-save --package-lock=false [email protected] Passed; local installation only
bun --version 1.4.3
bun run dev Failed: Astro missing
bun install --cwd .\src\frontend --frozen-lockfile Passed; 848 packages installed
bun run dev Passed; lightweight Astro server ready on port 4322
playwright-cli -s=phaseb2003 goto http://localhost:4322/ja/architecture/multi-language-architecture/ Passed
playwright-cli -s=phaseb2003 goto http://localhost:4322/ja/architecture/resource-hierarchies/ Passed
aspire --version Installed CLI identified above
aspire new --list Failed: unsupported flag; help listed available templates
aspire new aspire-ts-empty -n PhaseB2003 -o .doc-tester-workspace\phaseb2003\AppHost --non-interactive --suppress-agent-init Failed, exit 4: staging packages unavailable
aspire new aspire-ts-empty -n PhaseB2003Stable -o .doc-tester-workspace\phaseb2003\StableAppHost --channel stable --non-interactive --suppress-agent-init Passed
node --check .doc-tester-workspace\phaseb2003\StableAppHost\apphost.mts Passed
aspire start --isolated --non-interactive --format Json from StableAppHost Partial, exit 2: missing referenced Worker project
npm run aspire:build from StableAppHost Passed, exit 0
aspire stop --non-interactive Refused ambiguous target, exit 7; did not stop other AppHosts
aspire stop --apphost .doc-tester-workspace\phaseb2003\StableAppHost\apphost.mts --non-interactive Passed, exit 0; no sample AppHost running
playwright-cli -s=phaseb2003 close Passed
playwright-cli list No browsers
git status --porcelain=v1 -uall after cleanup Clean

Browser DOM evaluations verified displayed content, sample text, and rendered Mermaid SVG. Console/network inspection found /api/live/ unavailable under frontend-only development; this was excluded from documentation-defect counts.

Knowledge Gaps and Limitations

  • No unverified intrinsic knowledge was used to supply a Worker implementation.
  • Full execution requires the referenced ../Worker/Worker.csproj; no additional documentation gap was established within these filename/import changes.
  • The local page’s generated Git metadata showed f05f556…, despite repeated Git HEAD checks confirming the requested SHA. Assessment used the owned checkout and observed changed content, not that metadata.
  • No assertion is made about unchanged architectural internals or complete runtime behavior.

Recommendations

  1. No documentation correction is supported by this assessment.
  2. Complete runtime validation later with the referenced Worker project available.
  3. Treat the staging-feed failure separately from documentation correctness.

Cleanup State

  • Owned dev server stopped; PID 46848 absent and port 4322 no longer listening.
  • Named browser closed; daemon PID 45028 absent.
  • Sample AppHost confirmed not running.
  • Removed 16 owned browser snapshot/console/network artifacts and the owned phaseb2003 scaffold/example workspace.
  • Restored only these four dev-generated tracked files:
    • src\frontend\.starlight-icons\language-map.json
    • src\frontend\.starlight-icons\material-icons.json
    • src\frontend\.starlight-icons\safelist.json
    • src\frontend\.starlight-icons\version.txt
  • Retained ignored local Bun/frontend dependencies for reuse.
  • Retained ignored src\frontend\.env.local and .astro cache files because their pre-run existence/content was not captured; no speculative deletion or restoration.
  • Tracked working tree clean; requested SHA unchanged.

This report consumes the documentation stage for this PR regardless of head changes or its partial runtime status; it is not queued for an automatic rerun. The applicable code review follows separately.

@IEvangelist

Copy link
Copy Markdown
Member

Code correctness review

Reviewed the new src/frontend/tests/unit/typescript-apphost-sdk-imports.vitest.test.ts at head f8acca30fbe181c53dfa8553b8f679241137e072, base main / f05f5561b1b858344124cd848ff06469627d7e6e, following .agents/skills/code-review/SKILL.md. Documentation prose was handled in the preceding documentation report. This is a top-level report, not a formal review verdict.

Medium

Lines 20-22 — CRLF Markdown is silently skipped, so the corpus test can pass without checking any examples on Windows. Confidence: 10/10.

source.split('\n') retains the \r on each CRLF line. The opening-fence regex ends in (.*)$; . cannot consume that carriage return, so ordinary fences such as ```typescript title="apphost.ts"\r do not match at all. The scanner consequently returns an empty problem list for a legacy import.

Why it matters: this repository uses * text=auto without forcing LF for MDX, and this review's Windows checkout has core.autocrlf=true. The actual Japanese resource-hierarchies file contains 651 CRLF endings and no LF-only endings. The new fixture uses .join('\n'), so it passes while the filesystem scan can be vacuous.

Confirmed reproduction using the unchanged helper functions:

Input:
  ```typescript title="apphost.ts"
  import { x } from "./.modules/aspire.js";

LF: 1 fence, ["line 1: ./.modules/aspire.js"]
CRLF: 0 fences, []


**Suggested fix:** split on `/\r?\n/` (or otherwise normalize line endings before fence parsing), and add CRLF fixtures for both the legacy-import and mismatched-title cases.

### Test coverage and verification

- **Existing unit run:** `bun run vitest run --config vitest.config.ts tests/unit/typescript-apphost-sdk-imports.vitest.test.ts` from `src/frontend` — **passed, 2/2 tests**. Bun was supplied only through the review's local tool directory. This passing result does **not** invalidate the reproduced CRLF false negative.
- **Meaningful failure control:** ran the exact test/helper source under Node's TypeScript stripping and a `node:assert/strict` assertion shim, with file reads normalized to LF in memory. The PR head passed both cases; substituting the two changed docs from the base SHA failed the corpus check on exactly `ja/architecture/resource-hierarchies.mdx: line 437: ./.modules/aspire.js`. No repository files were changed for this control.
- **Additional helper checks:** LF legacy import detection, tilde fences with multiline imports, longer closing fences, ignoring non-TypeScript blocks, ignoring unrelated imports, and accepting the current SDK import passed. The corresponding CRLF legacy-import check failed as reported above.
- **Traversal/exclusions:** recursive traversal covers `.md` and `.mdx`; native `relative(...).split(sep).join('/')` normalizes Windows paths before release-note filtering. Checked root plus all 14 configured locale folders: `whats-new/` pages are excluded and architecture pages remain included.
- **E2E / accessibility:** no production UI, markup, interaction, or route was added by this test-only code change, so additional viewport or axe suites are not warranted here. Both affected existing Japanese pages were independently exercised in the documentation stage.

No other high-confidence code issue was established in this three-file change. No fixes, commits, pushes, formal reviews, or merge actions were performed.

This report consumes the code-review stage for this PR regardless of later head changes; it is not queued for an automatic rerun.

Split fences on \r?\n so CRLF checkouts don't silently skip every
TypeScript fence, and add a CRLF fixture covering both the legacy
import and the apphost.ts title cases.

Co-authored-by: Copilot <[email protected]>

Copy link
Copy Markdown
Contributor Author

Thanks David Pine (@IEvangelist) — confirmed the CRLF false negative. Fixed in e5c8d3d:

  • typeScriptFences now splits on /\r?\n/, so CRLF checkouts no longer skip every fence.
  • Added a CRLF fixture covering both the legacy ./.modules/aspire.js import and the apphost.ts title case.

Validation (from src/frontend): bun run vitest run --config vitest.config.ts tests/unit/typescript-apphost-sdk-imports.vitest.test.ts. The new CRLF test failed before the fix ([] instead of both problems) and all 3 tests pass after. ESLint and Prettier are clean.

🤖 Posted by AspireAgent (AI Agent)

Copy link
Copy Markdown
Member

docs-pr-reviewer report — [partial — phase A: key claims evaluated; phase B: not run (docs site was not served in this automated run)]

Recommendation: needs human

Source used: n/a — localization fix; checked against English layout (apphost.mts)
PR status: non-draft, mergeable, maintainer-authored (davidfowl), opened 2026-10-30 — not stale; 7 files.

Phase A — claims

  • ✅ aligning Japanese pages with the English apphost.mts / ./.aspire/modules/aspire.mjs layout (13.4+) is consistent with the PR rationale.
  • ⚠️ the PR also changes generated .starlight-icons/* files (language-map, material-icons, safelist, version); confirm that is intended. Japanese translation accuracy needs a Japanese-reading reviewer.

Phase B — doc-tester

Not run; rendering of the changed pages is not browser-checked.

🤖 Posted by aspire.dev - squad (AI Agent)

@IEvangelist
David Pine (IEvangelist) enabled auto-merge (squash) November 3, 2026 13:06
@IEvangelist
David Pine (IEvangelist) merged commit 170081c into main Nov 3, 2026
19 checks passed
@IEvangelist
David Pine (IEvangelist) deleted the aspireagent/fix-ja-legacy-typescript-apphost-layout branch November 3, 2026 13:07
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