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 <noreply@anthropic.com>
This commit is contained in:
gastown/crew/max
2026-01-15 07:33:36 -08:00
committed by Steve Yegge
parent 4f02abb535
commit 20effb0a51
3 changed files with 7 additions and 0 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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