Skip to content

Add ASP.NET Core one-shot compilation status mode for AI/automation workflows#2065

Draft
tomasherceg with Copilot wants to merge 5 commits into
mainfrom
copilot/diagnostics-compilation-page-ai-agents
Draft

Add ASP.NET Core one-shot compilation status mode for AI/automation workflows#2065
tomasherceg with Copilot wants to merge 5 commits into
mainfrom
copilot/diagnostics-compilation-page-ai-agents

Conversation

Copilot AI commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

The diagnostics compilation page is human-centric and awkward for agent workflows that need a single machine-readable result and process termination. This change introduces an ASP.NET Core one-shot mode triggered by DOTVVM_COMPILATION_STATUS=1 that initializes DotVVM, compiles all views, emits compilation status payload, and stops the app.

  • Shared compilation-status response contract

    • Added DotvvmCompilationStatusApi to centralize status generation used by both HTTP API and one-shot mode.
    • Returns:
      • 200 with no body when all files compile
      • 500 with JSON array of failed files when compilation fails
  • Reuse in existing diagnostics API presenter

    • CompilationPageApiPresenter now delegates to the shared helper to keep API and one-shot output semantics aligned.
  • ASP.NET Core one-shot execution path

    • In UseDotVVM, when DOTVVM_COMPILATION_STATUS=1:
      • DotVVM startup/configuration runs normally
      • compilation status is computed once
      • stdout prints status code (and JSON error payload on failure)
      • process exit code is set (0 for success, 1 for failure)
      • host shutdown is requested via IHostApplicationLifetime
  • Focused unit coverage for status mapping

    • Added tests for the shared helper to validate CompileAll result → (status code, body) mapping.
var status = await DotvvmCompilationStatusApi.GetStatusResponse(compilationService);

Console.WriteLine(status.StatusCode);
if (status.ResponseBody is {} body)
{
    Console.WriteLine(body);
}
Environment.ExitCode = status.StatusCode == 200 ? 0 : 1;

Copilot AI changed the title [WIP] Enhance diagnostics compilation page for AI agents Add ASP.NET Core one-shot compilation status mode for AI/automation workflows Jul 3, 2026
Copilot AI requested a review from tomasherceg July 3, 2026 22:00
@tomasherceg

Copy link
Copy Markdown
Member

@copilot Add an end-to-end test that when we run the samples.aspnetcore app with the env variable, the desired output is actually written on the stdout.

Copilot AI commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Add an end-to-end test that when we run the samples.aspnetcore app with the env variable, the desired output is actually written on the stdout.

Implemented in ecb0b30. I added an end-to-end MSTest (CompilationStatusMode_AspNetCoreSample_WritesStatusToStdout) that builds and runs src/Samples/AspNetCore/DotVVM.Samples.BasicSamples.AspNetCore.csproj with DOTVVM_COMPILATION_STATUS=1, then verifies the status code is printed to stdout, exit code mapping is correct, and the 500-case payload is valid JSON.

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.

Diagnostics Compilation page suitable for AI agents

2 participants