Merge pull request #52 from LazyBachelor/LPM-84-fixed
LPM-84 Priority Management Task
This commit is contained in:
@@ -2,6 +2,7 @@ package tasks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/LazyBachelor/LazyPM/internal/models"
|
||||
"github.com/LazyBachelor/LazyPM/internal/utils/check"
|
||||
@@ -10,21 +11,22 @@ import (
|
||||
|
||||
const priorityManagementDescription = `You are tasked with managing issue priorities.
|
||||
|
||||
A critical production issue has been reported. You need to rebalance the current sprint priorities:
|
||||
A critical production issue has been reported.
|
||||
|
||||
1. Review all current issues and their priorities
|
||||
2. Identify the most urgent production issue
|
||||
3. Reprioritize existing work to accommodate the urgent fix
|
||||
4. Defer lower priority items if necessary
|
||||
5. Update the team on priority changes via comments
|
||||
6. Ensure the critical path is clear for the urgent fix
|
||||
The database is not working properly and users are not able to connect and access their data.
|
||||
|
||||
The production database is experiencing intermittent connection failures affecting all users.`
|
||||
You need to rebalance the current sprint priorities:
|
||||
|
||||
1. Assign the task Issue you are currently reading to yourself as "Me" and set status to "In Progress".
|
||||
2. A new issue has appeared in the list that needs urgent attention. Change the database related issue's priority to 4 (critical).
|
||||
3. Set the priority of the feature and chore issues in the list to 1 (low).`
|
||||
|
||||
type PriorityManagementTask struct {
|
||||
done bool
|
||||
app *App
|
||||
setupIssue *Issue
|
||||
done bool
|
||||
app *App
|
||||
setupIssue *Issue
|
||||
priorityIssues []*models.Issue
|
||||
isInProgress bool
|
||||
}
|
||||
|
||||
func NewPriorityManagementTask(app *App) *PriorityManagementTask {
|
||||
@@ -63,7 +65,7 @@ func (t *PriorityManagementTask) Setup(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
priorityIssues := []*models.Issue{
|
||||
t.priorityIssues = []*models.Issue{
|
||||
NewIssueBuilder().
|
||||
WithTitle("Database connection failures").
|
||||
WithDescription("PRODUCTION CRITICAL: Intermittent DB connection failures affecting all users. Needs immediate attention.").
|
||||
@@ -74,34 +76,34 @@ func (t *PriorityManagementTask) Setup(ctx context.Context) error {
|
||||
NewIssueBuilder().
|
||||
WithTitle("UI theme updates").
|
||||
WithDescription("Update color scheme per new brand guidelines. Currently in progress but can wait.").
|
||||
WithPriority(1).
|
||||
WithPriority(2).
|
||||
WithStatus(models.StatusInProgress).
|
||||
WithIssueType(models.TypeTask).
|
||||
WithIssueType(models.TypeFeature).
|
||||
Build(),
|
||||
NewIssueBuilder().
|
||||
WithTitle("Feature: Dark mode").
|
||||
WithDescription("Add dark mode toggle to settings. Nice to have, can be deferred.").
|
||||
WithPriority(2).
|
||||
WithStatus(models.StatusOpen).
|
||||
WithIssueType(models.TypeTask).
|
||||
WithIssueType(models.TypeFeature).
|
||||
Build(),
|
||||
NewIssueBuilder().
|
||||
WithTitle("API rate limiting").
|
||||
WithDescription("Add rate limiting to public API endpoints. Security enhancement.").
|
||||
WithPriority(2).
|
||||
WithStatus(models.StatusInProgress).
|
||||
WithIssueType(models.TypeTask).
|
||||
WithIssueType(models.TypeFeature).
|
||||
Build(),
|
||||
NewIssueBuilder().
|
||||
WithTitle("Documentation updates").
|
||||
WithDescription("Update API documentation for v2 endpoints. Can be deferred.").
|
||||
WithPriority(3).
|
||||
WithStatus(models.StatusOpen).
|
||||
WithIssueType(models.TypeTask).
|
||||
WithIssueType(models.TypeChore).
|
||||
Build(),
|
||||
}
|
||||
|
||||
if err := t.app.Issues.CreateIssues(ctx, priorityIssues, ""); err != nil {
|
||||
if err := t.app.Issues.CreateIssues(ctx, t.priorityIssues, ""); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -116,5 +118,28 @@ func (t *PriorityManagementTask) Setup(ctx context.Context) error {
|
||||
func (t *PriorityManagementTask) Validate(ctx context.Context) ValidationFeedback {
|
||||
expect := check.NewExpector()
|
||||
|
||||
issues, err := FetchIssues(ctx, t.app, t.setupIssue)
|
||||
if err != nil {
|
||||
return expect.Fatal("Failed to fetch issues for validation")
|
||||
}
|
||||
|
||||
expect.NotEmptyAndEqual(t.setupIssue.Assignee, "Me",
|
||||
fmt.Sprintf("%s assignee", t.setupIssue.Title))
|
||||
|
||||
expect.Equal(t.setupIssue.Status, models.StatusInProgress,
|
||||
fmt.Sprintf("%s status", t.setupIssue.Title))
|
||||
|
||||
if !expect.Valid() {
|
||||
return expect.ValidationFeedback
|
||||
}
|
||||
|
||||
for _, issue := range issues {
|
||||
if issue.Title == t.priorityIssues[0].Title {
|
||||
expect.Equal(issue.Priority, 4, fmt.Sprintf("Priority of issue %s", issue.Title))
|
||||
} else {
|
||||
expect.Equal(issue.Priority, 1, fmt.Sprintf("Priority of issue %s", issue.Title))
|
||||
}
|
||||
}
|
||||
|
||||
return expect.Complete()
|
||||
}
|
||||
|
||||
@@ -30,11 +30,21 @@ func NewExpector() *Expector {
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Expector) Valid() bool {
|
||||
return len(e.Errors()) == 0
|
||||
}
|
||||
|
||||
func (e *Expector) Complete() ValidationFeedback {
|
||||
e.Success = len(e.Errors()) == 0
|
||||
return e.ValidationFeedback
|
||||
}
|
||||
|
||||
func (e *Expector) Fatal(message string) ValidationFeedback {
|
||||
e.Success = false
|
||||
e.Message = message
|
||||
return e.ValidationFeedback
|
||||
}
|
||||
|
||||
func (e *Expector) CompleteWithMessage(message string) ValidationFeedback {
|
||||
e.Success = len(e.Errors()) == 0
|
||||
if !e.Success {
|
||||
|
||||
Reference in New Issue
Block a user