From 77b38692c695d289d66117eeb7ea488c686135e8 Mon Sep 17 00:00:00 2001 From: Robin Olsen Date: Wed, 4 Mar 2026 14:00:35 +0100 Subject: [PATCH 1/3] align task with description add a complete with message in case we need that --- cmd/pm/tasks/createIssue.go | 38 +++++++++++++++++++++++++++------- internal/utils/check/expect.go | 8 +++++++ pkg/task/runner.go | 4 +++- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/cmd/pm/tasks/createIssue.go b/cmd/pm/tasks/createIssue.go index b10c32c..952b322 100644 --- a/cmd/pm/tasks/createIssue.go +++ b/cmd/pm/tasks/createIssue.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "github.com/LazyBachelor/LazyPM/internal/models" "github.com/LazyBachelor/LazyPM/internal/utils/check" ) @@ -12,10 +13,10 @@ const description = `You are tasked with creating a new issue in the project man This task will test your ability to use the issue creation workflow effectively. Your task: -1. Create a new issue with a clear title -2. Add a detailed description explaining what needs to be done -3. Assign the issue to yourself -4. Mark the issue as in-progress when you start working on it +1. Create a new issue with a the title "My first Issue" +2. Add this detailed description "I need to do some coding" +3. Assign the issue to yourself as "Me" +4. Mark the issue as In Progress when you start working on it 5. Close the issue once you've completed the work Make sure to fill out all the necessary details to help others understand the work item.` @@ -55,6 +56,8 @@ func (t *CreateIssueTask) Setup(ctx context.Context) error { return t.app.Issues.CreateIssue(ctx, t.setupIssue, "") } +var isInProgress = false + func (t *CreateIssueTask) Validate(ctx context.Context) ValidationFeedback { expect := check.NewExpector() @@ -63,9 +66,6 @@ func (t *CreateIssueTask) Validate(ctx context.Context) ValidationFeedback { return expect.ValidationFeedback } - expect.NotEmptyString(t.setupIssue.Assignee, - fmt.Sprintf("%s is not assigned to anyone", t.setupIssue.ID)) - if len(issues) == 0 { expect.Fail("No new issues created") return expect.ValidationFeedback @@ -73,8 +73,30 @@ func (t *CreateIssueTask) Validate(ctx context.Context) ValidationFeedback { issue := issues[0] - expect.Assert(len(issues) < 2, "Multiple issues were created instead of one") + expect.Assert(len(issues) < 2, "Multiple issues were created instead of one delete the extra issues and try again") + + expect.NotEmptyString(issue.Title, "Issue title should not be empty") + expect.Assert(issue.Title == "My first Issue", + fmt.Sprintf("Issue title does not match the expected value 'My first Issue', but was '%s'", issue.Title)) + expect.NotEmptyString(issue.Description, "Issue description should not be empty") + expect.Assert(issue.Description == "I need to do some coding", + fmt.Sprintf("Issue description does not match the expected value 'I need to do some coding', but was '%s'", issue.Description)) + + expect.Assert(issue.Assignee == "Me", + fmt.Sprintf("Issue should be assigned to 'Me', but was assigned to '%s'", issue.Assignee)) + + if issue.Status == models.StatusInProgress || isInProgress { + isInProgress = true + } else { + expect.Fail("Issue should be marked as in-progress when work starts") + } + + if !isInProgress { + return expect.ValidationFeedback + } else if issue.Status != models.StatusClosed { + expect.Fail("Issue should be set to Closed once the work is completed") + } return expect.Complete() } diff --git a/internal/utils/check/expect.go b/internal/utils/check/expect.go index cfa40a2..670fcdb 100644 --- a/internal/utils/check/expect.go +++ b/internal/utils/check/expect.go @@ -35,6 +35,14 @@ func (e *Expector) Complete() ValidationFeedback { return e.ValidationFeedback } +func (e *Expector) CompleteWithMessage(message string) ValidationFeedback { + e.Success = len(e.Errors()) == 0 + if !e.Success { + e.Message = message + } + return e.ValidationFeedback +} + func (e *Expector) Fail(message string) ValidationFeedback { e.Checks = append(e.Checks, NewCheck(message, false)) return e.ValidationFeedback diff --git a/pkg/task/runner.go b/pkg/task/runner.go index a9c4389..ea15b2b 100644 --- a/pkg/task/runner.go +++ b/pkg/task/runner.go @@ -100,7 +100,9 @@ func startValidationLoop(ctx context.Context, t Tasker, feedbackChan chan Valida case <-ticker.C: feedback := t.Validate(ctx) if feedback.Success { - feedback.Message = "Task completed successfully!" + if feedback.Message == "" { + feedback.Message = "Task completed successfully! Going back to the survey menu..." + } feedbackChan <- feedback time.Sleep(4 * time.Second) doneChan <- true From 81a046e9358c3a8da937c01ab9a602fe9d50dca4 Mon Sep 17 00:00:00 2001 From: Robin Olsen <129996395+Telikz@users.noreply.github.com> Date: Wed, 4 Mar 2026 14:20:47 +0100 Subject: [PATCH 2/3] Update cmd/pm/tasks/createIssue.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cmd/pm/tasks/createIssue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/pm/tasks/createIssue.go b/cmd/pm/tasks/createIssue.go index 952b322..21cef28 100644 --- a/cmd/pm/tasks/createIssue.go +++ b/cmd/pm/tasks/createIssue.go @@ -13,7 +13,7 @@ const description = `You are tasked with creating a new issue in the project man This task will test your ability to use the issue creation workflow effectively. Your task: -1. Create a new issue with a the title "My first Issue" +1. Create a new issue with the title "My first Issue" 2. Add this detailed description "I need to do some coding" 3. Assign the issue to yourself as "Me" 4. Mark the issue as In Progress when you start working on it From a47ff2a39b71d5a01af9286b7681010b76d6915d Mon Sep 17 00:00:00 2001 From: Robin Olsen <129996395+Telikz@users.noreply.github.com> Date: Wed, 4 Mar 2026 14:21:13 +0100 Subject: [PATCH 3/3] Update cmd/pm/tasks/createIssue.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cmd/pm/tasks/createIssue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/pm/tasks/createIssue.go b/cmd/pm/tasks/createIssue.go index 21cef28..c6757d4 100644 --- a/cmd/pm/tasks/createIssue.go +++ b/cmd/pm/tasks/createIssue.go @@ -73,7 +73,7 @@ func (t *CreateIssueTask) Validate(ctx context.Context) ValidationFeedback { issue := issues[0] - expect.Assert(len(issues) < 2, "Multiple issues were created instead of one delete the extra issues and try again") + expect.Assert(len(issues) < 2, "Multiple issues were created instead of one. Delete the extra issues and try again.") expect.NotEmptyString(issue.Title, "Issue title should not be empty") expect.Assert(issue.Title == "My first Issue",