Skip to content

Restore per-PR preview host stack#650

Open
IEvangelist wants to merge 3 commits intomainfrom
dapine/per-pr-preview-app-redraft
Open

Restore per-PR preview host stack#650
IEvangelist wants to merge 3 commits intomainfrom
dapine/per-pr-preview-app-redraft

Conversation

@IEvangelist
Copy link
Copy Markdown
Member

Summary

This restores the per-PR preview system onto a fresh branch after the earlier revert.

  • reintroduces the dedicated PreviewHost app and isolated Aspire.Dev.Preview.AppHost
  • restores PR-specific frontend artifact production plus trusted preview registration/cleanup workflows
  • restores the /prs catalog and /prs/{number} preview/status UX, including reset/cancel behavior
  • restores the storage and extraction hardening needed for large preview artifacts, including Dockerfile-based unzip support and temp content roots
  • restores the PR description preview block using the ## 🌐 Preview shields badge format

Validation

  • dotnet build src\statichost\PreviewHost\PreviewHost.csproj -nologo
  • dotnet build src\apphost\Aspire.Dev.Preview.AppHost\Aspire.Dev.Preview.AppHost.csproj -nologo
  • node --check src\statichost\PreviewHost\wwwroot\_preview\index.js
  • node --check src\statichost\PreviewHost\wwwroot\_preview\status.js

Follow-up

Live workflow/deployment validation is still needed after redeploy to confirm PR body updates, cleanup, and end-to-end preview behavior in the hosted environment.

Copilot AI review requested due to automatic review settings March 31, 2026 13:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Restores the per-PR preview hosting stack (PreviewHost service + Preview AppHost) and re-enables PR-scoped frontend artifact builds plus GitHub workflows to register/clean up previews and update PR descriptions.

Changes:

  • Reintroduces PreviewHost (API + storage + artifact download/extraction + /prs UI) including hardened extraction modes for large artifacts.
  • Updates the frontend build pipeline to produce per-PR artifacts and build with a PR-scoped Astro base path.
  • Adds GitHub workflows to register preview builds on successful CI runs, update PR bodies with a preview badge block, and clean up on PR close.

Reviewed changes

Copilot reviewed 31 out of 35 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/statichost/PreviewHost/wwwroot/_preview/status.js Client-side status page logic (SSE, cancel/retry, progress UI).
src/statichost/PreviewHost/wwwroot/_preview/status.html Status page shell for /prs/{number}/ while preparing.
src/statichost/PreviewHost/wwwroot/_preview/index.js Client-side /prs/ catalog UI (filters, reset action).
src/statichost/PreviewHost/wwwroot/_preview/index.html Catalog page shell for /prs/.
src/statichost/PreviewHost/wwwroot/_preview/preview.css Shared styling for preview catalog/status shells.
src/statichost/PreviewHost/wwwroot/_preview/aspire-mark.svg Aspire mark used by preview shells.
src/statichost/PreviewHost/wwwroot/_preview/github-mark.svg GitHub icon asset for preview shells.
src/statichost/PreviewHost/wwwroot/_preview/left-arrow.svg Navigation icon asset.
src/statichost/PreviewHost/wwwroot/_preview/retry-arrow.svg Retry icon asset.
src/statichost/PreviewHost/Properties/launchSettings.json Local launch settings for PreviewHost.
src/statichost/PreviewHost/Program.cs PreviewHost endpoints, routing, auth token check, SSE, registration APIs.
src/statichost/PreviewHost/Previews/PreviewStateStore.cs Persistent registry + content root management + snapshot APIs.
src/statichost/PreviewHost/Previews/PreviewRequestDispatcher.cs Routes /prs requests and serves prepared preview files with rewriting support.
src/statichost/PreviewHost/Previews/PreviewModels.cs Options + request/response models + snapshot/work-item types.
src/statichost/PreviewHost/Previews/PreviewCoordinator.cs Orchestrates discovery/loading, download/extraction progress, eviction, activation.
src/statichost/PreviewHost/Previews/PreviewBufferSettings.cs Adaptive buffer sizing based on available memory.
src/statichost/PreviewHost/Previews/GitHubArtifactClient.cs GitHub API integration for PR catalog + workflow runs + artifact downloads.
src/statichost/PreviewHost/Previews/CommandLineExtractionSupport.cs Validates/locates tar.exe/unzip when command-line extraction is selected.
src/statichost/PreviewHost/PreviewHost.csproj PreviewHost project definition + GitHub client dependencies.
src/statichost/PreviewHost/Dockerfile Container build and chiseled runtime image w/ unzip copied in.
src/statichost/PreviewHost/appsettings.json Default PreviewHost configuration (logging + max active previews).
src/statichost/PreviewHost/appsettings.Development.json Development logging overrides.
src/statichost/PreviewHost/.dockerignore Docker ignore rules for build output.
src/frontend/astro.config.mjs Adds env-driven Astro base for PR-scoped builds.
src/apphost/Aspire.Dev.Preview.AppHost/Properties/launchSettings.json Local launch settings for Preview AppHost.
src/apphost/Aspire.Dev.Preview.AppHost/Aspire.Dev.Preview.AppHost.csproj New AppHost project referencing PreviewHost.
src/apphost/Aspire.Dev.Preview.AppHost/appsettings.json AppHost logging configuration.
src/apphost/Aspire.Dev.Preview.AppHost/appsettings.Development.json Development logging overrides.
src/apphost/Aspire.Dev.Preview.AppHost/AppHost.cs Aspire AppHost wiring for PreviewHost + env parameters (tokens, extraction mode, GitHub auth).
Aspire.Dev.slnx Adds PreviewHost + Preview AppHost projects to the solution.
.github/workflows/pr-preview-register.yml Registers preview builds on successful CI runs + updates PR body preview block.
.github/workflows/pr-preview-cleanup.yml Removes preview registrations + PR body block on PR close.
.github/workflows/frontend-build.yml Makes artifact name/retention/base-path configurable for PR builds.
.github/workflows/ci.yml Configures CI to publish PR-scoped artifacts and base paths.
.github/workflows/apphost-build.yml Builds AppHost artifacts via a matrix (AppHost + Preview AppHost).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

IEvangelist and others added 3 commits March 31, 2026 09:12
This reapplies the per-PR preview implementation that was reverted by PR #642, restoring the PreviewHost, preview AppHost, workflow automation, UI, and performance hardening work onto the redraft branch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pass exact preview artifact metadata from the parent CI run into register-preview so the workflow no longer guesses artifact details across workflow_run boundaries. Also use the Aspire bot GitHub App token for PR body updates and artifact access when available.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fix the AppHost workflow indentation, validate preview registrations against the configured repository, make registry writes durable, harden cleanup deletes, and align the Preview AppHost to the repo's current Aspire package versions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@IEvangelist IEvangelist force-pushed the dapine/per-pr-preview-app-redraft branch from 622a72f to 3144450 Compare March 31, 2026 14:12
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.

2 participants