diff --git a/internal/tui/clipboard.go b/internal/tui/clipboard.go index a5e6c03..a7ab2b2 100644 --- a/internal/tui/clipboard.go +++ b/internal/tui/clipboard.go @@ -242,7 +242,7 @@ func validSessionID(id string) bool { // for a later `bodek --session `. The ✓ Copied flash is the only ack. func (m *Model) copySessionID() tea.Cmd { if !validSessionID(m.sessionID) { - return m.transientNoteCmd("no active session yet") + return m.transientNoteCmd("no session yet — the id exists once a session is created; send a prompt first") } return m.copyText(m.sessionID) } diff --git a/internal/tui/copy_session_id_test.go b/internal/tui/copy_session_id_test.go index e6afa1b..29fa7bf 100644 --- a/internal/tui/copy_session_id_test.go +++ b/internal/tui/copy_session_id_test.go @@ -1,6 +1,7 @@ package tui import ( + "strings" "testing" "github.com/BackendStack21/bodek/internal/workspace" @@ -47,6 +48,13 @@ func TestCopySessionIDWithoutSession(t *testing.T) { if m.copyFlashing() { t.Error("nothing was copied — the flash must stay off") } + // The note must warn and teach: the id only exists once a session is + // created (first prompt), so the operator knows to send a prompt first. + if n := len(m.notices); n == 0 { + t.Fatal("no-session copy must record a visible note") + } else if got := m.notices[n-1]; !strings.Contains(got, "no session") || !strings.Contains(got, "prompt") { + t.Errorf("note = %q, want a warning naming the session and a prompt hint", got) + } } // A hostile id must never reach the clipboard — the payload is a