fix(dashboard): do not delete the dashboard report#3669
Conversation
For the past two years I have wondered why I would get "Report could not be found..." error on the dashboard when performing this command: ```sh dotnet tool run dotnet-stryker --reporter dashboard --open-report:dashboard --version main --dashboard-api-key ****** ```` Today I looked at the code and it turns out that the HTTP client performs a DELETE request on the report when all the mutants are tested, obviously deleting it! Note: this regression was introduced in stryker-mutator#2563.
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression in Stryker.NET’s dashboard real-time reporting client where finishing a run would issue an HTTP DELETE against the dashboard report URL, causing the report to disappear and later fail to open.
Changes:
- Removed the
DELETEcall fromDashboardClient.PublishFinished()so finishing a run no longer deletes the dashboard report. - (No other functional changes in this PR.)
Comments suppressed due to low confidence (1)
src/Stryker.Core/Stryker.Core/Clients/DashboardClient.cs:105
- Grammar in this log message is off (missing "to"), which makes the error harder to read/search consistently.
{
_logger.LogError(exception, "Failed send finished event to the dashboard at {DashboardUrl}", url);
}
| public async Task PublishFinished() | ||
| { | ||
| var url = GetUrl(_options.ProjectVersion, true); | ||
|
|
||
| try | ||
| { | ||
| if (_batch.Count != 0) | ||
| { | ||
| var batchResponse = await _httpClient.PostAsJsonAsync(url, _batch, JsonReportSerialization.Options); | ||
| batchResponse.EnsureSuccessStatusCode(); | ||
| _batch.Clear(); | ||
| } | ||
|
|
||
| var deleteResponse = await _httpClient.DeleteAsync(url); | ||
| deleteResponse.EnsureSuccessStatusCode(); | ||
| } |
|
If I remember correctly the deletion is by design. It is a failsafe in case anything in the mutant matching, transport or whatever else (a risk was identified but I don't remember the specific reason that was brought forward) happens with real time reporting. However immediately after that the non-realtime report (so the full report as calculated by Stryker client) is supposed to be published iirc so it should not have any user impact so obviously something is going wrong there still. |
Since PublishFinished performs a DELETE on the report
The thing is, the current implementation publishes the report immediately before and not immediately after deletion. 😉 Addressed in 63ee722 and restored the DELETE HTTP call. |
For the past two years I have wondered why I would get "Report could not be found..." error on the dashboard when performing this command:
dotnet tool run dotnet-stryker --reporter dashboard --open-report:dashboard --version main --dashboard-api-key ******Today I looked at the code and it turns out that the HTTP client performs a DELETE request on the report when all the mutants are tested, obviously deleting it!
Note: this regression was introduced in #2563.