(t *testing.T)
| 499 | if task.SessionStarted.Valid { |
| 500 | t.Errorf("session_started should be NULL after spawn failure rollback; got %q", task.SessionStarted.String) |
| 501 | } |
| 502 | // Status is rolled back to backlog so the invariant holds and the |
| 503 | // next `flow do` re-flips fresh. |
| 504 | if task.Status != "backlog" { |
| 505 | t.Errorf("status after spawn failure: got %q, want backlog (full rollback)", task.Status) |
| 506 | } |
| 507 | } |
| 508 | |
| 509 | // TestCmdDoResumeSpawnFailureKeepsSessionID is the inverse of the |
| 510 | // fresh-bootstrap case: when a RESUME spawn fails (the session_id |
| 511 | // already pointed at a real jsonl from a previous successful spawn), |
| 512 | // the DB row must be left untouched. A transient osascript failure |
| 513 | // should not cost the user their conversation history. |
| 514 | func TestCmdDoResumeSpawnFailureKeepsSessionID(t *testing.T) { |
| 515 | setupFlowRoot(t) |
| 516 | seedTask(t, "resume-fail-task") |
| 517 | |
| 518 | db := openFlowDB(t) |
| 519 | const existingSID = "real-existing-sid" |
| 520 | if _, err := db.Exec( |
| 521 | `UPDATE tasks SET session_id=?, session_started=? WHERE slug='resume-fail-task'`, |
| 522 | existingSID, flowdb.NowISO(), |
| 523 | ); err != nil { |
| 524 | t.Fatal(err) |
| 525 | } |
nothing calls this directly
no test coverage detected