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

Function insertTask

internal/app/testhelpers_test.go:33–52  ·  view source on GitHub ↗
(t *testing.T, db *sql.DB, slug, name, status, priority, wd string, project any)

Source from the content-addressed store, hash-verified

31}
32
33func insertTask(t *testing.T, db *sql.DB, slug, name, status, priority, wd string, project any) {
34 t.Helper()
35 now := flowdb.NowISO()
36 // Session-id invariant: only backlog may have a NULL session_id.
37 // Tests that create non-backlog rows get a deterministic per-slug
38 // placeholder UUID — unique (so the partial unique index is happy)
39 // without needing real Claude session bookkeeping.
40 var sessionID any
41 if status != "backlog" {
42 sessionID = fakeSessionID(slug)
43 }
44 _, err := db.Exec(
45 `INSERT INTO tasks (slug, name, project_slug, status, priority, work_dir, session_id, created_at, updated_at)
46 VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
47 slug, name, project, status, priority, wd, sessionID, now, now,
48 )
49 if err != nil {
50 t.Fatalf("insert task: %v", err)
51 }
52}
53
54// fakeSessionID makes a deterministic v4-shaped UUID derived from
55// slug. Used by insertTask to satisfy the session-id invariant on

Calls 2

NowISOFunction · 0.92
fakeSessionIDFunction · 0.85

Tested by

no test coverage detected