Add nudge_channels to MessagingConfig schema (gt-3shmx)

- Add NudgeChannels field to MessagingConfig struct in types.go
- Initialize NudgeChannels map in NewMessagingConfig()
- Add validation in validateMessagingConfig(): channel names must be
  non-empty and each channel must have at least one recipient
- Add tests for valid nudge channels and empty recipient validation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gastown/polecats/toast
2025-12-30 22:47:14 -08:00
committed by Steve Yegge
parent d28ba6e2c6
commit d94fb4669b
3 changed files with 58 additions and 5 deletions

View File

@@ -278,6 +278,11 @@ type MessagingConfig struct {
// Used for broadcast announcements that don't need acknowledgment.
// Example: {"alerts": {"readers": ["@town"]}}
Announces map[string]AnnounceConfig `json:"announces,omitempty"`
// NudgeChannels are named groups for real-time nudge fan-out.
// Like mailing lists but for tmux send-keys instead of durable mail.
// Example: {"workers": ["gastown/polecats/*", "gastown/crew/*"], "witnesses": ["*/witness"]}
NudgeChannels map[string][]string `json:"nudge_channels,omitempty"`
}
// QueueConfig represents a work queue configuration.
@@ -306,10 +311,11 @@ const CurrentMessagingVersion = 1
// NewMessagingConfig creates a new MessagingConfig with defaults.
func NewMessagingConfig() *MessagingConfig {
return &MessagingConfig{
Type: "messaging",
Version: CurrentMessagingVersion,
Lists: make(map[string][]string),
Queues: make(map[string]QueueConfig),
Announces: make(map[string]AnnounceConfig),
Type: "messaging",
Version: CurrentMessagingVersion,
Lists: make(map[string][]string),
Queues: make(map[string]QueueConfig),
Announces: make(map[string]AnnounceConfig),
NudgeChannels: make(map[string][]string),
}
}