TestCmdRunPlaybookHereInvalidUUID pins UUID-shape validation. An env var that isn't a v4 UUID is rejected; no dangling row created.
(t *testing.T)
| 307 | // TestCmdRunPlaybookHereInvalidUUID pins UUID-shape validation. An |
| 308 | // env var that isn't a v4 UUID is rejected; no dangling row created. |
| 309 | func TestCmdRunPlaybookHereInvalidUUID(t *testing.T) { |
| 310 | setupFlowRoot(t) |
| 311 | wd := t.TempDir() |
| 312 | if rc := cmdAdd([]string{"playbook", "P", "--slug", "p", "--work-dir", wd}); rc != 0 { |
| 313 | t.Fatal() |
| 314 | } |
| 315 | t.Setenv("CLAUDE_CODE_SESSION_ID", "not-a-uuid") |
| 316 | stubITerm(t) |
| 317 | |
| 318 | if rc := cmdRun([]string{"playbook", "p", "--here"}); rc != 1 { |
| 319 | t.Errorf("rc=%d, want 1 when env is not a valid UUID", rc) |
| 320 | } |
| 321 | db := openFlowDB(t) |
| 322 | var n int |
| 323 | if err := db.QueryRow(`SELECT COUNT(*) FROM tasks WHERE kind='playbook_run'`).Scan(&n); err != nil { |
| 324 | t.Fatal(err) |
| 325 | } |
| 326 | if n != 0 { |
| 327 | t.Errorf("no run row should be created on UUID validation failure; got %d", n) |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | // TestCmdRunPlaybookHereRejectsCurrentSessionAlreadyBoundElsewhere |
| 332 | // pins the session_id uniqueness invariant: if the current session |
nothing calls this directly
no test coverage detected