(t *testing.T)
| 1009 | if task.SessionID.String != newSID { |
| 1010 | t.Errorf("session_id after --force: got %q, want %s", task.SessionID.String, newSID) |
| 1011 | } |
| 1012 | } |
| 1013 | |
| 1014 | // TestCmdDoHereIdempotent pins that re-running --here against a |
| 1015 | // task already bound to THIS session is a no-op success (no error, |
| 1016 | // no overwrite needed). |
| 1017 | func TestCmdDoHereIdempotent(t *testing.T) { |
| 1018 | setupFlowRoot(t) |
| 1019 | seedTaskAtCwd(t, "idem-task") |
| 1020 | stubClaudeStatOK(t) |
| 1021 | const sid = "f00ba111-2222-4333-8444-555555555555" |
| 1022 | t.Setenv("CLAUDE_CODE_SESSION_ID", sid) |
| 1023 | |
| 1024 | if rc := cmdDo([]string{"idem-task", "--here"}); rc != 0 { |
| 1025 | t.Fatalf("first --here rc=%d", rc) |
| 1026 | } |
| 1027 | if rc := cmdDo([]string{"idem-task", "--here"}); rc != 0 { |
| 1028 | t.Errorf("second --here rc=%d, want 0 (idempotent)", rc) |
| 1029 | } |
| 1030 | } |
| 1031 | |
| 1032 | // TestCmdDoHereRejectsCurrentSessionAlreadyBoundElsewhere pins the |
| 1033 | // no-duplicate-session_id invariant: if THIS session is already |
| 1034 | // bound to another task, --here refuses with a friendly error |
| 1035 | // regardless of --force. The session-id uniqueness is structural; |
| 1036 | // no escape hatch. |
| 1037 | func TestCmdDoHereRejectsCurrentSessionAlreadyBoundElsewhere(t *testing.T) { |
| 1038 | setupFlowRoot(t) |
nothing calls this directly
no test coverage detected