From 0af23c26b194cfca7bd576f6340200f968aaead9 Mon Sep 17 00:00:00 2001 From: Alexa <53471801+Alexa-RR@users.noreply.github.com> Date: Tue, 28 Jul 2026 17:16:44 +0300 Subject: [PATCH] fix: a closed issue marks the failing test case Passed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closed means fixed. The case that was failing on that bug passes, and reopening the issue undoes it: closed + Failed -> Passed open + Passed -> Failed Replaces the previous closed -> NotYetTested, which sent the case back for another run instead of recording the outcome. The guard that matters is unchanged: only those two states are the reconciler's to move, so a case a tester has Claimed — or one nobody has run yet — is never rewritten underneath them. --- .../TestCaseGitHubIssueTests.cs | 13 ++++---- .../TestCaseIssuesController.cs | 30 +++++++++---------- docs/admin.md | 15 +++++----- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/DorkNet.Server.Tests/TestCaseGitHubIssueTests.cs b/DorkNet.Server.Tests/TestCaseGitHubIssueTests.cs index eddcdb5..020da20 100644 --- a/DorkNet.Server.Tests/TestCaseGitHubIssueTests.cs +++ b/DorkNet.Server.Tests/TestCaseGitHubIssueTests.cs @@ -30,9 +30,9 @@ public sealed class TestCaseGitHubIssueTests : IClassFixture _factory = factory; - private const int StatusNotYetTested = 0; private const int StatusClaimed = 1; private const int StatusFailed = 2; + private const int StatusPassed = 3; [Fact] public async Task Filing_is_idempotent_and_stores_the_issue_url() @@ -69,7 +69,7 @@ public sealed class TestCaseGitHubIssueTests : IClassFixture(); var tc = await db.TestCases.SingleAsync(c => c.Id == caseId); - // Closing an issue is a developer saying the fix landed — not a tester - // saying the case passes. It goes back in the queue, not to Passed. - Assert.Equal(StatusNotYetTested, tc.Status); + // A closed issue means the bug is fixed, so the case that was failing + // on it passes. + Assert.Equal(StatusPassed, tc.Status); } [Fact] @@ -143,7 +143,8 @@ public sealed class TestCaseGitHubIssueTests : IClassFixture c.Id == caseId); // An open issue against a claimed case says nothing new; flipping it to - // Failed would yank it out from under whoever is testing it. + // Failed would yank it out from under whoever is testing it. Only + // Failed<->Passed are the reconciler's to move. Assert.Equal(StatusClaimed, tc.Status); } diff --git a/DorkNet.Server/Controllers/API/TestCaseManagement/TestCaseIssuesController.cs b/DorkNet.Server/Controllers/API/TestCaseManagement/TestCaseIssuesController.cs index 86dd060..f1c7ad7 100644 --- a/DorkNet.Server/Controllers/API/TestCaseManagement/TestCaseIssuesController.cs +++ b/DorkNet.Server/Controllers/API/TestCaseManagement/TestCaseIssuesController.cs @@ -33,8 +33,8 @@ public class TestCaseIssuesController( { /// Test-case status values, matching the client's /// TestCaseStatus enum. - private const int StatusNotYetTested = 0; private const int StatusFailed = 2; + private const int StatusPassed = 3; /// POST api/testcasemanagement/v1/testcase/{id}/issue — /// file a GitHub issue for a test case and link it. @@ -102,17 +102,15 @@ public class TestCaseIssuesController( /// only: /// /// - /// Issue CLOSED and the case is still Failed → back to NotYetTested. - /// The bug is fixed, so the case is due for another run. It is deliberately - /// NOT marked Passed: closing an issue is a developer's claim that the fix - /// landed, not a tester's observation that the case passes. - /// Issue REOPENED and the case is NotYetTested → back to Failed. - /// The bug came back, so the close transition above is undone. + /// Issue CLOSED and the case is Failed → Passed. A closed issue means + /// the bug is fixed, and the case that was failing on it therefore passes. + /// Issue REOPENED and the case is Passed → Failed. The bug came back, + /// so the close transition above is undone. /// /// /// Nothing else moves. Only these two states are the reconciler's to - /// change, so a case a tester has Claimed — or marked Passed after - /// verifying the fix — is never dragged back underneath them. + /// change, so a case a tester has Claimed, or one nobody has run yet, is + /// never rewritten underneath them. [HttpPost("api/testcasemanagement/v1/issues/sync")] public async Task Sync(CancellationToken ct) { @@ -144,15 +142,15 @@ public class TestCaseIssuesController( if (issue is null) continue; var closed = issue.State.Equals("closed", StringComparison.OrdinalIgnoreCase); - // Only ever move a case between the two states this reconciler - // itself owns. Reopening undoes the close transition and nothing - // else: "open issue and the case isn't Failed" would also catch a - // case a tester has just Claimed, or one they marked Passed after - // verifying the fix, and drag it back to Failed underneath them. + // Closed means fixed, so a case failing on that bug now passes. + // Only ever move between those two states: reopening undoes the + // close and nothing else. "Open issue and the case isn't Failed" + // would also catch a case a tester has just Claimed, or one nobody + // has run yet, and mark it Failed underneath them. int? next = (closed, tc.Status) switch { - (true, StatusFailed) => StatusNotYetTested, - (false, StatusNotYetTested) => StatusFailed, + (true, StatusFailed) => StatusPassed, + (false, StatusPassed) => StatusFailed, _ => null, }; if (next is not int status) continue; diff --git a/docs/admin.md b/docs/admin.md index 5ad6fd7..6bc43fe 100644 --- a/docs/admin.md +++ b/docs/admin.md @@ -222,15 +222,14 @@ issue number is only read from a URL matching the GitHub issue shape. | Issue | Case status | Result | | --- | --- | --- | -| Closed | Failed | → NotYetTested | -| Open | NotYetTested | → Failed | -| anything | Claimed / Passed | untouched | +| Closed | Failed | → Passed | +| Open | Passed | → Failed | +| anything | Claimed / NotYetTested | untouched | -A closed issue does **not** mark the case Passed: closing is a developer's claim -that the fix landed, not a tester's observation that the case passes, so it goes -back in the queue for another run. And only those two states are the -reconciler's to move — a case a tester has Claimed, or marked Passed after -verifying the fix, is never dragged back underneath them. +Closed means fixed: the case that was failing on that bug now passes, and +reopening the issue undoes it. Only those two states are the reconciler's to +move — a case a tester has Claimed, or one nobody has run yet, is never +rewritten underneath them. ## Build And Deploy