diff options
Diffstat (limited to 'internal/task')
| -rw-r--r-- | internal/task/story.go | 41 | ||||
| -rw-r--r-- | internal/task/story_test.go | 42 | ||||
| -rw-r--r-- | internal/task/task.go | 4 |
3 files changed, 0 insertions, 87 deletions
diff --git a/internal/task/story.go b/internal/task/story.go deleted file mode 100644 index 536bda1..0000000 --- a/internal/task/story.go +++ /dev/null @@ -1,41 +0,0 @@ -package task - -import "time" - -type StoryState string - -const ( - StoryPending StoryState = "PENDING" - StoryInProgress StoryState = "IN_PROGRESS" - StoryShippable StoryState = "SHIPPABLE" - StoryDeployed StoryState = "DEPLOYED" - StoryValidating StoryState = "VALIDATING" - StoryReviewReady StoryState = "REVIEW_READY" - StoryNeedsFix StoryState = "NEEDS_FIX" -) - -type Story struct { - ID string `json:"id"` - Name string `json:"name"` - ProjectID string `json:"project_id"` - BranchName string `json:"branch_name"` - DeployConfig string `json:"deploy_config"` - ValidationJSON string `json:"validation_json"` - Status StoryState `json:"status"` - CreatedAt time.Time `json:"created_at"` - UpdatedAt time.Time `json:"updated_at"` -} - -var validStoryTransitions = map[StoryState]map[StoryState]bool{ - StoryPending: {StoryInProgress: true}, - StoryInProgress: {StoryShippable: true, StoryNeedsFix: true}, - StoryShippable: {StoryDeployed: true}, - StoryDeployed: {StoryValidating: true}, - StoryValidating: {StoryReviewReady: true, StoryNeedsFix: true}, - StoryReviewReady: {}, - StoryNeedsFix: {StoryInProgress: true}, -} - -func ValidStoryTransition(from, to StoryState) bool { - return validStoryTransitions[from][to] -} diff --git a/internal/task/story_test.go b/internal/task/story_test.go deleted file mode 100644 index 38d0290..0000000 --- a/internal/task/story_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package task - -import "testing" - -func TestValidStoryTransition_Valid(t *testing.T) { - cases := []struct { - from StoryState - to StoryState - }{ - {StoryPending, StoryInProgress}, - {StoryInProgress, StoryShippable}, - {StoryInProgress, StoryNeedsFix}, - {StoryNeedsFix, StoryInProgress}, - {StoryShippable, StoryDeployed}, - {StoryDeployed, StoryValidating}, - {StoryValidating, StoryReviewReady}, - {StoryValidating, StoryNeedsFix}, - } - for _, tc := range cases { - if !ValidStoryTransition(tc.from, tc.to) { - t.Errorf("expected valid transition %s → %s", tc.from, tc.to) - } - } -} - -func TestValidStoryTransition_Invalid(t *testing.T) { - cases := []struct { - from StoryState - to StoryState - }{ - {StoryPending, StoryDeployed}, - {StoryReviewReady, StoryPending}, - {StoryReviewReady, StoryInProgress}, - {StoryReviewReady, StoryShippable}, - {StoryShippable, StoryPending}, - } - for _, tc := range cases { - if ValidStoryTransition(tc.from, tc.to) { - t.Errorf("expected invalid transition %s → %s", tc.from, tc.to) - } - } -} diff --git a/internal/task/task.go b/internal/task/task.go index eeac49e..7092ce8 100644 --- a/internal/task/task.go +++ b/internal/task/task.go @@ -88,11 +88,7 @@ type Task struct { Priority Priority `yaml:"priority" json:"priority"` Tags []string `yaml:"tags" json:"tags"` DependsOn []string `yaml:"depends_on" json:"depends_on"` - StoryID string `yaml:"-" json:"story_id,omitempty"` BranchName string `yaml:"-" json:"branch_name,omitempty"` - AcceptanceCriteria string `yaml:"-" json:"acceptance_criteria,omitempty"` - CheckerForTaskID string `yaml:"-" json:"checker_for_task_id,omitempty"` - CheckerReport string `yaml:"-" json:"checker_report,omitempty"` State State `yaml:"-" json:"state"` RejectionComment string `yaml:"-" json:"rejection_comment,omitempty"` QuestionJSON string `yaml:"-" json:"question,omitempty"` |
