Skip to content

Check localized get-started AppHost samples against published APIs - #2004

Merged
David Pine (IEvangelist) merged 2 commits into
mainfrom
aspireagent/fix-ja-what-is-aspire-addnpmapp
Nov 3, 2026
Merged

David Pine (IEvangelist) merged 2 commits into
mainfrom
aspireagent/fix-ja-what-is-aspire-addnpmapp

Conversation

@davidfowl

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

Copy link
Copy Markdown
Contributor

Summary

This PR started as a fix for the Japanese What is Aspire? C# AppHost sample, which called AddNpmApp. That API was removed in Aspire 13. #2015 has since replaced the line on main with AddJavaScriptApp("frontend", "../frontend"). After the rebase, this PR keeps main's line and is test-only.

Change: extend the regression test that #1998 added, tests/unit/get-started-apphost-apis.vitest.test.ts.

  • It now scans get-started/ in every locale, not just English.
  • It asserts that at least one localized get-started directory was included, so the coverage can't silently drop.
  • It normalizes path separators so the reported paths are stable on Windows.

Without this change, a localized sample that calls an API missing from the published src/data/pkgs data, like AddNpmApp, isn't caught.

Maintainers can close this PR if they don't want the extra guard.

Third-party links and affiliations

None.

Validation

  • npx vitest run tests/unit/get-started-apphost-apis.vitest.test.ts passes on the rebased head.
  • Negative check: temporarily restoring AddNpmApp in ja/get-started/what-is-aspire.mdx makes the test fail with that entry. I then reverted the probe.

No screenshots, because this PR has no rendered changes.

🤖 Posted by AspireAgent (AI Agent)

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Frontend HTML artifact ready

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

VS Code: Open PR #2004 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 31, 2026 00:17
Copilot AI balanced review requested due to automatic review settings October 31, 2026 00:17

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.

🟡 Changes recommended

The path assertion fails on Windows because node:path.join produces backslashes that cannot match /ja/get-started/, breaking the unit suite even when the scanned APIs are valid.

1 open issue
What changed in this PR

Updates the Japanese “What is Aspire?” sample to follow the English correction in #1998 and use the supported JavaScript hosting API.

Changes:

  • Replaces AddNpmApp with AddViteApp in the Japanese C# AppHost sample.
  • Extends API regression checks to localized get-started directories and asserts Japanese coverage.
File Description
src/​frontend/​tests/​unit/​get-started-apphost-apis.vitest.test.ts Expands API validation to localized getting-started pages.
src/​frontend/​src/​content/​docs/​ja/​get-started/​what-is-aspire.mdx Replaces the removed API with AddViteApp.

Review effort: Balanced

@IEvangelist

Copy link
Copy Markdown
Member

Project docs review [partial — phase A: 3 of 3 claims evaluated; phase B: browser completed, sample execution blocked]

Reviewed 83785c9d81c3efd5ebe625ae3a6a18f95dfbda22 against main base f05f5561b1b858344124cd848ff06469627d7e6e. Owning source: microsoft/aspire, main, pinned 6a8f53125b8788df3c409088381057a3c0dacfff. This is an existing-language localized correction, not a new AppHost-language stack.

Result: No contradicted or unverifiable changed-line claim. 3 verified, 0 verified-with-nuance, 0 contradicted, 0 unverifiable. The independent blind user check exercised one Japanese page and its C# sample: five presentation/navigation checks passed; no critical issue demonstrated; sample execution remains blocked before compilation. One execution-limit warning and one local-environment warning are preserved below. This is not a claim that the sample builds or runs.

Phase A — Claim verification

Verified claims and pinned source evidence
ID Changed-call claim Verdict and evidence
A1 builder.AddViteApp("frontend", "../frontend") is a supported C# AppHost call with these two positional arguments. Verified. JavaScriptHostingExtensions.cs:1986–2021 defines AddViteApp(this IDistributedApplicationBuilder builder, string name, string appDirectory, string runScriptName = "dev") and returns IResourceBuilder<ViteAppResource>.
A2 Omitting a script argument preserves the illustrated npm development-script workflow for a Vite frontend at ../frontend. Verified. The default is dev; the path is resolved against AppHostDirectory, and the resource starts with npm (lines 1992–2021). The shared builder applies npm and the configured run script (lines 1650–1680). This API is Vite-specific, including managed --port/HTTP endpoint configuration (lines 2033–2048), not an assertion that every arbitrary npm frontend is a Vite app.
A3 The changed call remains compatible with the following .WithReference(api). Verified. ViteAppResource:13–14 derives from JavaScriptAppResource:15–16, then ExecutableResource:20, satisfying IResourceWithEnvironment. The existing API project is a ProjectResource:14 with service discovery; WithReference:1515–1522 accepts that combination and applies endpoints. This checks API compatibility, not application/browser request behavior.

The replacement matches the English counterpart's call and the Japanese TypeScript tab's existing addViteApp intent. No Aspire version literals, options, or cross-references were added. The illustrative setup/scaffolding is unchanged; unrelated translations and pre-existing missing runnable scaffolding are not new findings here. No Toolkit/Azure claims required those source repositories.

Phase B — Independent doc-tester report (verbatim)

Full blind user-experience report and explicit limits

Documentation Test Report

Focus Area: PR microsoft/aspire.dev #2004 — Japanese conceptual AppHost sample, C# AddViteApp correction
Date: 2026-10-31
Tester: doc-tester agent
Status: [partial — browser validation completed; sample compilation and orchestration blocked]

Summary

Category Passed Failed Warnings
Content Accuracy 0 0 0
Code Examples 4 0 1
CLI Commands 0 0 0
Links 1 0 0

Counts represent scoped checks, not API/runtime verification. Content accuracy remains unverified by execution. An additional environment warning is described below.

Server: http://localhost:4322/
Served ref: detached HEAD 83785c9d81c3efd5ebe625ae3a6a18f95dfbda22, confirmed before and after testing.
Page exercised: /ja/get-started/what-is-aspire/
Section: 「Aspire の前と後」, C# AppHost.cs tab.
Deep link exercised: /ja/get-started/what-is-aspire/?aspire-lang=csharp#aspire-%E3%81%AE%E5%89%8D%E3%81%A8%E5%BE%8C

This was a blind Phase B run. No owning Aspire/Toolkit/Azure source, PR tests, or Phase A conclusions were read. Both required skills were loaded and their full instructions read. All browser interaction used the installed playwright-cli.

Critical Issues

None demonstrated within the completed checks. This does not establish that the sample compiles or that resource orchestration works.

Warnings

Warning 1: Literal sample execution stops before compilation

Location: Japanese page, 「Aspire の前と後」, C# sample.

What the documentation displays:

builder.AddViteApp("frontend", "../frontend")
    .WithReference(api);

The surrounding page presents aspire run as the command for starting the modeled system.

Reproduction:

  1. Select the C# tab.
  2. Copy the complete displayed AppHost.cs into a fresh session-artifact directory.
  3. Run the displayed command, aspire run.

Actual result: Exit code 7:

Finding AppHosts...
❌ The project argument was not specified and no AppHost project files were detected.

Exact blockers: The displayed conceptual sample does not provide a detectable AppHost project, package/SDK configuration, the referenced Projects.Api project, or the worker/frontend application contents. No missing scaffolding was invented.

Impact: Compilation, Vite startup, API-reference propagation, and end-to-end behavior remain untested, not failed or passed.

Context: This is an existing-language conceptual correction, not a runnable tutorial or new language-stack introduction. The execution limitation is not evidence that the changed API is incorrect and should not independently block this PR.

Warning 2: Lightweight dev environment lacks the live-status backend

Location: Browser console on the owned local server.

Observed:

Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:4322/api/live/

[live-status] Live API not found (404); live updates disabled until reload.

A WebSocket warning for /api/live/ws also appeared.

Impact: The Japanese page and affected sample remained usable. These are local environment diagnostics; no connection to the documentation change was demonstrated.

Passed Checks

  1. Page rendering: The owned server rendered the Japanese page with title Aspire とは何ですか? | Aspire.
  2. C# selection: Clicking the C# tab selected it and displayed AppHost.cs.
  3. Corrected sample presentation: The visible C# example contains builder.AddViteApp("frontend", "../frontend") followed by .WithReference(api). It no longer displays AddNpmApp in that sample.
  4. Actual clipboard contents: Clicking the sample’s copy button and reading the browser clipboard returned the complete displayed C# sample, including the corrected call and retained reference.
  5. Section/deep-link behavior: Clicking the section permalink resolved to its existing heading. Reload preserved the C# selection, heading target, and corrected sample.

These are browser/presentation checks only—not static substitutes for successful execution.

Recommendations

  1. Priority fixes: No changed-line defect was demonstrated by this blind run.
  2. Validation follow-up: Verify compilation and runtime semantics in a suitable existing AppHost application with the actual frontend/API resources and appropriate packages.
  3. Documentation gaps: If this conceptual example is later intended to be independently runnable, supply or link an explicit complete setup. Do not require unrelated scaffolding expansion for this one-line correction.
  4. Product issues: None established.

Knowledge Gaps

Knowledge Gap: Turning the conceptual illustration into a runnable application

What I needed to know: Which AppHost project/packages and application files should accompany this exact sample.

Source of my knowledge: Recognizing these requirements involves prior programming knowledge, not setup instructions supplied by the affected illustration.

User impact: A reader copying only this sample into an empty directory cannot reproduce the demonstrated system.

Recommendation: Reasonable to treat this as a conceptual illustration in the current scope; runnable verification needs separately supplied prerequisites. I did not silently fill this gap.

Commands and Outcomes

  • playwright-cli --help — passed; installed CLI available. No fallback or browser MCP used.
  • dotnet --list-sdks — SDKs 10.0.114 and 10.0.403 available.
  • aspire --version — 13.4.0+3f0998a95833d5fef96b3159d56b667889b71166.
  • npx --yes --package bun bun --version — passed using a session-scoped npm cache; Bun 1.4.4, no global installation.
  • npx --yes --package bun bun run dev from repository root — initial attempt failed: bun: command not found: astro.
  • npx --yes --package bun bun install --cwd .\src\frontend --frozen-lockfile — passed; 848 packages installed, lockfile unchanged.
  • npx --yes --package bun bun run dev from root — started Astro 7.4.1; selected port 4322 because 4321 was occupied.
  • playwright-cli -s=pr2004phaseb open http://localhost:4321/ja/get-started/what-is-aspire/ — initial premature navigation reached an existing server; excluded from PR validation evidence.
  • playwright-cli -s=pr2004phaseb goto http://localhost:4322/ja/get-started/what-is-aspire/ — passed; subsequent checks used the owned server exclusively.
  • CLI click, eval, reload, console warning, and network commands — collected the evidence above. One malformed evaluation and one stale element reference failed at the automation layer; corrected commands subsequently succeeded.
  • aspire run in the literal-sample artifact directory — blocked before compilation, exit 7 as quoted above.
  • No production build was run.

Cleanup State

  • Owned browser session closed; its reported PID 53472 confirmed exited.
  • Owned dev-server shell 1433 stopped; port 4322 confirmed closed.
  • Existing server on port 4321 was not stopped.
  • Owned browser snapshots/logs, literal sample, scoped npm/Bun caches, and the exact generated Aspire CLI log were removed.
  • Restored dependencies remain in src\frontend\node_modules for the parent’s validation.
  • Startup updated/generated ignored src\frontend\.env.local; left untouched for parent handling.
  • Startup changed these tracked generated files; not reverted, as requested:
    • 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
  • No source edits, branch switching, commits, pushes, fixes, or GitHub writes were performed.

This top-level informational comment consumes the Project's one-time docs stage for this PR, including this partial result. It is not a formal approval/change request, and the stage is not keyed to a commit SHA.

@IEvangelist

Copy link
Copy Markdown
Member

Project code review — no new findings

Reviewed 83785c9d81c3efd5ebe625ae3a6a18f95dfbda22 against main base f05f5561b1b858344124cd848ff06469627d7e6e, following the repository code-review skill. This follows the docs report; documentation/API accuracy is covered there, not treated as application-code review.

No new high-confidence correctness or important coverage defect found in src/frontend/tests/unit/get-started-apphost-apis.vitest.test.ts. The localized scanner change is correct and adequately covered for this scope: it retains English coverage, discovers locale get-started roots, scans the current 20 English and 15 Japanese Markdown/MDX pages, preserves the existing C# AppHost-only filtering, asserts Japanese inclusion, and normalizes diagnostic paths.

The existing Windows path assertion finding is fixed in the inspected head, not a new finding: relative(docsRoot, path).split(sep).join('/') is checked with startsWith('ja/get-started/'), and missing-member diagnostics use the same separator normalization. The focused test passed on this Windows environment.

Test coverage and verification

  • Unit: From src/frontend, node .\node_modules\vitest\vitest.mjs run --config vitest.config.ts tests/unit/get-started-apphost-apis.vitest.test.ts — passed: 1 file, 1 test (Vitest 4.1.11). The initial standard invocation lacked dependencies; a frozen-lockfile restore enabled this run. No dependency manifest or lockfile change was required.
  • Regression/control: A read-only Node assertion harness executed the actual scanner test body, replacing only the Vitest assertion exports and filesystem reads used for the control. The current head passes; overlaying the exact base Japanese page makes the new scanner reject exactly src/content/docs/ja/get-started/what-is-aspire.mdx: AddNpmApp. The exact base scanner passes because it does not scan Japanese pages. No source was edited for these checks. This harness is not represented as a second Vitest run or a C# compilation.
  • Portability: Actual Windows Vitest run passed; separate path.win32 and path.posix normalization-expression controls both passed.
  • E2E (desktop/tablet/mobile) and axe: No component, interaction, layout, or accessibility behavior changed in the scanner code, so new cross-viewport or axe tests are not warranted here. The affected Japanese sample's actual browser rendering, tab selection, clipboard, and deep link were checked independently in the preceding docs report.
  • Limits: No full unit suite, production build, or runnable C# AppHost compilation/orchestration is claimed. The docs report explicitly records the sample-execution blocker.

This clean top-level informational comment consumes the Project's one-time code-review stage for this PR. It is not a formal approval/change request, and the lifetime stage is not keyed to a commit SHA.

Extend the get-started AppHost API test to scan every locale's get-started
pages, so localized samples such as the Japanese What is Aspire page can't
call removed builder APIs like AddNpmApp.

Co-authored-by: Copilot <[email protected]>
@davidfowl
David Fowler (davidfowl) force-pushed the aspireagent/fix-ja-what-is-aspire-addnpmapp branch from 83785c9 to 8401544 Compare November 2, 2026 00:28

Copy link
Copy Markdown
Contributor Author

Rebased onto main (new head 840154465043df5f5a0fd760be0a0a29b178127c) to fix the merge conflict. #2015 had already replaced the AddNpmApp line in ja/get-started/what-is-aspire.mdx with AddJavaScriptApp("frontend", "../frontend"), so I kept main's version.

That leaves this PR as test-only. It extends tests/unit/get-started-apphost-apis.vitest.test.ts to check the localized get-started AppHost samples against the published APIs, and normalizes path separators. The test passes on the new head. As a negative check, temporarily reintroducing AddNpmApp makes it fail. Maintainers can close this PR if they don't want the extra guard.

🤖 Posted by AspireAgent (AI Agent)

@davidfowl David Fowler (davidfowl) changed the title Replace removed AddNpmApp in the Japanese What is Aspire C# AppHost sample Check localized get-started AppHost samples against published APIs Nov 2, 2026

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 — test tooling (localized get-started AppHost sample checks)
PR status: non-draft, mergeable, maintainer-authored (davidfowl), opened 2026-10-30 — not stale.

Phase A — claims

  • ❓ Adds a vitest check of localized get-started samples against published API; no docs claims. Maintainer review and CI result required.

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) merged commit d67e2a2 into main Nov 3, 2026
19 checks passed
@IEvangelist
David Pine (IEvangelist) deleted the aspireagent/fix-ja-what-is-aspire-addnpmapp 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