diff options
| author | Claudomator Agent <agent@claudomator> | 2026-03-10 00:27:36 +0000 |
|---|---|---|
| committer | Claudomator Agent <agent@claudomator> | 2026-03-10 00:27:36 +0000 |
| commit | a782bbfe25569bae2de2f77b7cdee8b5ffa71671 (patch) | |
| tree | 4e398a87e20676f7f7c47dee6489d5ce4855b9a6 | |
| parent | c8e3b467afdfcee9c5047902662d49d33c862764 (diff) | |
Remove legacy claude field and working_dir backward compat
- Remove Claude field alias from Task struct (already removed in sandbox)
- Remove UnmarshalJSON from AgentConfig that silently accepted working_dir
- Remove legacy claude fallback in scanTask (db.go)
- Remove TestGetTask_BackwardCompatibility test that validated removed behavior
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| -rw-r--r-- | internal/storage/db.go | 9 | ||||
| -rw-r--r-- | internal/storage/db_test.go | 32 | ||||
| -rw-r--r-- | internal/task/task.go | 19 |
3 files changed, 0 insertions, 60 deletions
diff --git a/internal/storage/db.go b/internal/storage/db.go index 835ac29..31d38ed 100644 --- a/internal/storage/db.go +++ b/internal/storage/db.go @@ -519,15 +519,6 @@ func scanTask(row scanner) (*task.Task, error) { if err := json.Unmarshal([]byte(configJSON), &t.Agent); err != nil { return nil, fmt.Errorf("unmarshaling agent config: %w", err) } - // Fallback for legacy 'claude' field - if t.Agent.Instructions == "" { - var legacy struct { - Claude task.AgentConfig `json:"claude"` - } - if err := json.Unmarshal([]byte(configJSON), &legacy); err == nil && legacy.Claude.Instructions != "" { - t.Agent = legacy.Claude - } - } if err := json.Unmarshal([]byte(retryJSON), &t.Retry); err != nil { return nil, fmt.Errorf("unmarshaling retry: %w", err) } diff --git a/internal/storage/db_test.go b/internal/storage/db_test.go index 5f786ac..d28a4a8 100644 --- a/internal/storage/db_test.go +++ b/internal/storage/db_test.go @@ -733,35 +733,3 @@ func TestListRecentExecutions_LargeDataset(t *testing.T) { }) } -func TestGetTask_BackwardCompatibility(t *testing.T) { - db := testDB(t) - now := time.Now().UTC().Truncate(time.Second) - - // Legacy config JSON using "claude" field instead of "agent" - legacyConfig := `{"claude":{"model":"haiku","instructions":"legacy instructions","max_budget_usd":0.5}}` - - _, err := db.db.Exec(` - INSERT INTO tasks (id, name, description, config_json, priority, timeout_ns, retry_json, tags_json, depends_on_json, state, created_at, updated_at) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, - "legacy-id", "Legacy Task", "A legacy test", legacyConfig, "normal", - 0, "{}", "[]", "[]", "PENDING", now, now, - ) - if err != nil { - t.Fatalf("inserting legacy task: %v", err) - } - - got, err := db.GetTask("legacy-id") - if err != nil { - t.Fatalf("getting legacy task: %v", err) - } - - if got.Agent.Instructions != "legacy instructions" { - t.Errorf("instructions: want 'legacy instructions', got %q", got.Agent.Instructions) - } - if got.Agent.Model != "haiku" { - t.Errorf("model: want 'haiku', got %q", got.Agent.Model) - } - if got.Agent.MaxBudgetUSD != 0.5 { - t.Errorf("budget: want 0.5, got %f", got.Agent.MaxBudgetUSD) - } -} diff --git a/internal/task/task.go b/internal/task/task.go index 4977f40..c0aa036 100644 --- a/internal/task/task.go +++ b/internal/task/task.go @@ -1,7 +1,6 @@ package task import ( - "encoding/json" "time" ) @@ -43,24 +42,6 @@ type AgentConfig struct { SkipPlanning bool `yaml:"skip_planning" json:"skip_planning"` } -// UnmarshalJSON reads project_dir with fallback to legacy working_dir. -func (c *AgentConfig) UnmarshalJSON(data []byte) error { - type Alias AgentConfig - aux := &struct { - ProjectDir string `json:"project_dir"` - WorkingDir string `json:"working_dir"` // legacy - *Alias - }{Alias: (*Alias)(c)} - if err := json.Unmarshal(data, aux); err != nil { - return err - } - if aux.ProjectDir != "" { - c.ProjectDir = aux.ProjectDir - } else { - c.ProjectDir = aux.WorkingDir - } - return nil -} type RetryConfig struct { MaxAttempts int `yaml:"max_attempts" json:"max_attempts"` |
