Repository navigation
Add a build-time opt-in hybrid API documentation POC - #1874
Draft
David Pine (IEvangelist) wants to merge 8 commits into
Draft
David Pine (IEvangelist) wants to merge 8 commits into
David Pine (IEvangelist) wants to merge 8 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
Frontend HTML artifact readyThe latest frontend build uploaded the This comment updates automatically when a new frontend build artifact is uploaded. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a local POC for building only non-API documentation statically, while rendering C# and TypeScript API reference HTML and Markdown on demand through the existing ASP.NET Core
StaticHost.ASPIRE_HYBRID_API_DOCS=1, with cross-platformbuild:hybridandbuild:hybrid:skip-searchcommands. The default build remains fully static, including API docs.StaticHostserves the selected static client and calls a private, long-lived Astro/Node worker on API cache misses. Uses the official Node adapter rather than reimplementing Astro rendering in .NET.Content-Length; excludes failed, private, authenticated, and cookie-setting responses.dist-hybridclient/server output, private manifest with build identity and platform checks, and opt-in Aspire wiring. Builds matching Linux and Windows artifacts; rejects mismatched host/artifact modes instead of silently falling back.This is intentionally local-only. Azure hybrid publishing, Front Door configuration changes, Redis-backed output caching, and distributed locking are not included. Existing Redis usage for live status and the default Azure/static deployment path are unchanged.
Measured POC result
The successful acceptance run compared both modes at this PR's head commit:
The hybrid build avoided 48,451 API HTML/Markdown files, preserved 8,828 non-API HTML/Markdown outputs, and produced a private server bundle of 123,244,200 bytes. The faster build and smaller client output come with higher peak build memory in this run; this is not a claim that hybrid mode lowers memory usage or is production-ready.
Third-party links and affiliations
None. This change does not add or change third-party links.
Validation
Opt-in CI passed on
d0476d4737a0c813d31b33ec9818f37fd23a0963, including Linux acceptance verification and the Windows artifact/contracts job. Exact commands below were run fromsrc/frontendin CI:pnpm exec astro sync— passed.pnpm exec eslint . --max-warnings 0— passed.pnpm exec vitest run --config vitest.config.ts tests/unit/hybrid-api-docs.vitest.test.ts tests/unit/api-markdown.vitest.test.ts tests/unit/ts-api-route-catalog.vitest.test.ts tests/unit/build-performance.vitest.test.ts— passed.dotnet test ../../tests/StaticHost.Tests/StaticHost.Tests.csproj --filter 'FullyQualifiedName~HybridApiDocs' --nologo— passed on Linux and Windows.dotnet test ../../tests/Aspire.Dev.AppHost.Tests/Aspire.Dev.AppHost.Tests.csproj --filter 'FullyQualifiedName~HybridApiDocs' --nologo— passed.pnpm build:productionwith the toggle unset — passed; static baseline retained API output.pnpm build:productionwithASPIRE_HYBRID_API_DOCS=1— passed on Linux and Windows.node scripts/verify-hybrid-output.mjs— passed; zero static API HTML/Markdown, non-API inventory parity, redirect destinations, private server separation, and API sitemap coverage.dotnet build ../statichost/StaticHost/StaticHost.csproj -c Release --nologowith the toggle enabled — passed.node scripts/test-hybrid-host.mjswithHYBRID_TEST_BROWSER=1— passed, includingpnpm exec playwright test --config playwright.hybrid.config.mjs, twenty concurrent cold requests coalesced into one render, large-response lengths, representation isolation, and static/warmed-cache availability after stopping the worker.Also verified locally using the Windows CI-built artifact and an isolated Aspire AppHost: the real homepage, API rendering/cache hits, Markdown copy actions, completed client-side navigation, lazy-loaded images, and bounded gateway errors for cold requests during a worker outage. No full-site build was run locally, and transient services were stopped.
Limitations: Azure deployment, Front Door behavior, and distributed caching were not tested. The full viewport suite was not rerun on the final commit; an earlier broad run reported ten mobile Developer Hub failures outside the focused POC coverage. The raw repository-wide
tsc --noEmitcheck also reports existing unrelated diagnostics; no diagnostics remained in the new hybrid code.