MCPcopy Create free account
hub / github.com/Facets-cloud/flow / TestCmdDoDoneTaskRefused

Function TestCmdDoDoneTaskRefused

internal/app/do_test.go:501–522  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

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.
514func 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 }

Callers

nothing calls this directly

Calls 7

NowISOFunction · 0.92
setupFlowRootFunction · 0.85
seedTaskFunction · 0.85
openFlowDBFunction · 0.85
fakeSessionIDFunction · 0.85
stubITermFunction · 0.85
cmdDoFunction · 0.85

Tested by

no test coverage detected