Skip to content

feat(simulate): ReportGeneratorService - MD report for simulation #31#36

Merged
JusterZhu merged 1 commit into
mainfrom
feat/simulate-report
May 20, 2026
Merged

feat(simulate): ReportGeneratorService - MD report for simulation #31#36
JusterZhu merged 1 commit into
mainfrom
feat/simulate-report

Conversation

@JusterZhu
Copy link
Copy Markdown
Collaborator

Part of #31 - Sub-Issue #5 (final)

Adds ReportGeneratorService that produces simulation_report.md:

  • Configuration table (patch, app dir, platform, versions, port, time)
  • Result section (PASS/FAIL + elapsed)
  • Notes section
  • Full timeline log in code block

Wired into SimulateViewModel - report generated automatically after simulation completes.

This completes the Simulate Update feature (#31).

All sub-issues:

- Generates simulation_report.md with config table, result, notes, full timeline
- Wired into SimulateViewModel after successful simulation
- Completes the Simulate Update feature (#31)
Copilot AI review requested due to automatic review settings May 20, 2026 15:06
@JusterZhu JusterZhu merged commit 1a3c8a6 into main May 20, 2026
1 check passed
@JusterZhu JusterZhu deleted the feat/simulate-report branch May 20, 2026 15:09
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

Adds Markdown report generation for the Simulate Update workflow by introducing a ReportGeneratorService and invoking it from SimulateViewModel after a simulation run, aligning with issue #31’s requirement to produce simulation_report.md.

Changes:

  • Added ReportGeneratorService to generate simulation_report.md containing configuration, result, notes, and a timeline log.
  • Wired report generation into SimulateViewModel after a successful simulation run.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/ViewModels/SimulateViewModel.cs Instantiates and calls the new report generator after simulation completes successfully.
src/Services/ReportGeneratorService.cs New service that formats and writes the simulation Markdown report to the output directory.
Comments suppressed due to low confidence (1)

src/ViewModels/SimulateViewModel.cs:95

  • Report generation is currently only executed when result.Success is true, so failed simulations won’t produce simulation_report.md (losing the timeline/error context). Consider generating the report whenever the simulation finishes (success or failure), and include the failure details from SimulationResult in the report.
            if (result.Success)
            {
                Status = $"Simulation completed ({result.Elapsed.TotalSeconds:F1}s)";
                L($"Result: {(result.Success ? "PASS" : "FAIL")}");
                foreach (var note in result.Notes)
                    L($"  Note: {note}");

                // Generate report
                var reportPath = await _report.GenerateAsync(Config, result, Config.OutputDirectory);
                L($"Report: {reportPath}");
            }
            else
            {
                Status = $"Simulation failed: {result.ErrorMessage}";
            }

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

Comment on lines +38 to +41
sb.AppendLine($"**{(result.Success ? "✅ PASS" : "❌ FAIL")}** — {result.Elapsed.TotalSeconds:F1}s");
if (!string.IsNullOrEmpty(result.ErrorMessage))
sb.AppendLine($"\nError: `{result.ErrorMessage}`");
sb.AppendLine();
Comment on lines +54 to +62
sb.AppendLine("```");
sb.Append(result.FullLog);
sb.AppendLine("```");

var reportPath = Path.Combine(outputDir, "simulation_report.md");
await File.WriteAllTextAsync(reportPath, sb.ToString(), Encoding.UTF8);
return reportPath;
}

Comment on lines +25 to +33
sb.AppendLine("| Field | Value |");
sb.AppendLine("|-------|-------|");
sb.AppendLine($"| Patch | {EscapeMd(config.PatchFilePath)} |");
sb.AppendLine($"| App Directory | {EscapeMd(config.AppDirectory)} |");
sb.AppendLine($"| Platform | {config.Platform} |");
sb.AppendLine($"| AppType | {config.AppType} |");
sb.AppendLine($"| Version | {config.CurrentVersion} → {config.TargetVersion} |");
sb.AppendLine($"| Server Port | {config.ServerPort} |");
sb.AppendLine($"| Simulation Time | {DateTime.Now:yyyy-MM-dd HH:mm:ss} |");
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