feat(simulate): ReportGeneratorService - MD report for simulation #31#36
Merged
Conversation
- Generates simulation_report.md with config table, result, notes, full timeline - Wired into SimulateViewModel after successful simulation - Completes the Simulate Update feature (#31)
Contributor
There was a problem hiding this comment.
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
ReportGeneratorServiceto generatesimulation_report.mdcontaining configuration, result, notes, and a timeline log. - Wired report generation into
SimulateViewModelafter 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.Successis true, so failed simulations won’t producesimulation_report.md(losing the timeline/error context). Consider generating the report whenever the simulation finishes (success or failure), and include the failure details fromSimulationResultin 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} |"); |
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.
Part of #31 - Sub-Issue #5 (final)
Adds ReportGeneratorService that produces simulation_report.md:
Wired into SimulateViewModel - report generated automatically after simulation completes.
This completes the Simulate Update feature (#31).
All sub-issues: