fix: extend valid phases and return empty slice for missing session

Add "retrospective" to validPhases so non-TDD skills pass Validate().
Return []Entry{} instead of nil in session.Read when no file exists,
so JSON serialisation produces [] rather than null.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mathias Bergqvist
2026-04-17 20:48:32 +02:00
parent 13ee0d7114
commit 3dfc064353
2 changed files with 7 additions and 2 deletions

View File

@@ -20,7 +20,12 @@ type Result struct {
}
var validStatuses = map[string]bool{"pass": true, "fail": true, "error": true}
var validPhases = map[string]bool{"red": true, "green": true, "refactor": true}
var validPhases = map[string]bool{
"red": true,
"green": true,
"refactor": true,
"retrospective": true,
}
func (r Result) Validate() error {
var errs []string

View File

@@ -68,7 +68,7 @@ func Read(sessionsDir, sessionID string) ([]Entry, error) {
path := filepath.Join(sessionsDir, sessionID+".jsonl")
f, err := os.Open(path)
if errors.Is(err, fs.ErrNotExist) {
return nil, nil
return []Entry{}, nil
}
if err != nil {
return nil, fmt.Errorf("open session log: %w", err)