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

Function TestCmdDoneRefusesTaskWithoutSession

internal/app/done_test.go:105–122  ·  view source on GitHub ↗

TestCmdDoneRefusesTaskWithoutSession pins the session-id invariant at the friendly-error layer for `flow done`: a backlog task with no session_id has no transcript to sweep, so done refuses with a pointer to `flow archive`. Replaces the older "skips sweep when no session" test — that path is no long

(t *testing.T)

Source from the content-addressed store, hash-verified

103// "skips sweep when no session" test — that path is no longer
104// reachable under the invariant.
105func TestCmdDoneRefusesTaskWithoutSession(t *testing.T) {
106 setupFlowRoot(t)
107 calls := stubClaudeRunner(t, errors.New("should not be called"))
108 if rc := cmdAdd([]string{"task", "No Session Task"}); rc != 0 {
109 t.Fatalf("add rc=%d", rc)
110 }
111 if rc := cmdDone([]string{"no-session-task"}); rc != 1 {
112 t.Errorf("done rc=%d, want 1 (sessionless task should be refused)", rc)
113 }
114 if len(*calls) != 0 {
115 t.Errorf("expected 0 sweep calls, got %d", len(*calls))
116 }
117 db := openFlowDB(t)
118 task, _ := flowdb.GetTask(db, "no-session-task")
119 if task.Status != "backlog" {
120 t.Errorf("status = %q, want backlog (refused done should not flip)", task.Status)
121 }
122}
123
124// TestCmdDoneRunsSweepWhenSessionExists verifies that done invokes the
125// claude runner exactly once with the task slug and a sweep prompt

Callers

nothing calls this directly

Calls 6

GetTaskFunction · 0.92
setupFlowRootFunction · 0.85
stubClaudeRunnerFunction · 0.85
cmdAddFunction · 0.85
cmdDoneFunction · 0.85
openFlowDBFunction · 0.85

Tested by

no test coverage detected