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

Function TestCmdDoHereRejectsDoneTask

internal/app/do_test.go:963–981  ·  view source on GitHub ↗

TestCmdDoHereRejectsDoneTask pins that --here on a done task refuses with a friendly pointer at the reopen path. Auto-reopen would silently bypass the user's previous closure intent.

(t *testing.T)

Source from the content-addressed store, hash-verified

961 db := openFlowDB(t)
962 if _, err := db.Exec(
963 `UPDATE tasks SET session_id=?, session_started=?, status='in-progress' WHERE slug='bound-task'`,
964 oldSID, flowdb.NowISO(),
965 ); err != nil {
966 t.Fatal(err)
967 }
968 db.Close()
969
970 t.Setenv("CLAUDE_CODE_SESSION_ID", newSID)
971 if rc := cmdDo([]string{"bound-task", "--here"}); rc != 1 {
972 t.Errorf("rc=%d, want 1 when target already bound to a different session", rc)
973 }
974
975 db = openFlowDB(t)
976 task, _ := flowdb.GetTask(db, "bound-task")
977 if task.SessionID.String != oldSID {
978 t.Errorf("session_id changed without --force: got %q, want %s", task.SessionID.String, oldSID)
979 }
980}
981
982// TestCmdDoHereForceOverwritesBinding pins that --force allows the
983// overwrite of a prior binding. The user has been told this orphans
984// the prior session.

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected