From 20effb0a511c196f5826bcfc8349251844875d34 Mon Sep 17 00:00:00 2001 From: gastown/crew/max Date: Thu, 15 Jan 2026 07:33:36 -0800 Subject: [PATCH] fix(beads): add CreatedAt to group/channel creation, check channel status - Add CreatedAt timestamp to CreateGroupBead() in beads_group.go - Add CreatedAt timestamp to CreateChannelBead() in beads_channel.go - Check channel status before sending in router.go sendToChannel() - Reject sends to closed channels with appropriate error message Closes: gt-yibjdm, gt-bv2f97 Co-Authored-By: Claude Opus 4.5 --- internal/beads/beads_channel.go | 2 ++ internal/beads/beads_group.go | 2 ++ internal/mail/router.go | 3 +++ 3 files changed, 7 insertions(+) diff --git a/internal/beads/beads_channel.go b/internal/beads/beads_channel.go index a7c56175..f9f24560 100644 --- a/internal/beads/beads_channel.go +++ b/internal/beads/beads_channel.go @@ -9,6 +9,7 @@ import ( "os" "strconv" "strings" + "time" ) // ChannelFields holds structured fields for channel beads. @@ -146,6 +147,7 @@ func (b *Beads) CreateChannelBead(name string, subscribers []string, createdBy s Subscribers: subscribers, Status: ChannelStatusActive, CreatedBy: createdBy, + CreatedAt: time.Now().Format(time.RFC3339), } description := FormatChannelDescription(title, fields) diff --git a/internal/beads/beads_group.go b/internal/beads/beads_group.go index 5c2213ff..ed1a80db 100644 --- a/internal/beads/beads_group.go +++ b/internal/beads/beads_group.go @@ -8,6 +8,7 @@ import ( "fmt" "os" "strings" + "time" ) // GroupFields holds structured fields for group beads. @@ -114,6 +115,7 @@ func (b *Beads) CreateGroupBead(name string, members []string, createdBy string) Name: name, Members: members, CreatedBy: createdBy, + CreatedAt: time.Now().Format(time.RFC3339), } description := FormatGroupDescription(title, fields) diff --git a/internal/mail/router.go b/internal/mail/router.go index 28509899..c5d1bedd 100644 --- a/internal/mail/router.go +++ b/internal/mail/router.go @@ -829,6 +829,9 @@ func (r *Router) sendToChannel(msg *Message) error { if fields == nil { return fmt.Errorf("channel not found: %s", channelName) } + if fields.Status == beads.ChannelStatusClosed { + return fmt.Errorf("channel %s is closed", channelName) + } // Build labels for from/thread/reply-to/cc plus channel metadata var labels []string