Session names `gt-mayor` and `gt-deacon` were hardcoded, causing tmux
session name collisions when running multiple towns simultaneously.
Changed to `gt-{town}-mayor` and `gt-{town}-deacon` format (e.g.,
`gt-ai-mayor`) to allow concurrent multi-town operation.
Key changes:
- session.MayorSessionName() and DeaconSessionName() now take townName param
- Added workspace.GetTownName() helper to load town name from config
- Updated all callers in cmd/, daemon/, doctor/, mail/, rig/, templates/
- Updated tests with new session name format
- Bead IDs remain unchanged (already scoped by .beads/ directory)
Fixes #60
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
35 lines
839 B
Go
35 lines
839 B
Go
package cmd
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestAddressToAgentBeadID(t *testing.T) {
|
|
townName := "ai"
|
|
tests := []struct {
|
|
address string
|
|
expected string
|
|
}{
|
|
{"mayor", "gt-ai-mayor"},
|
|
{"deacon", "gt-ai-deacon"},
|
|
{"gastown/witness", "gt-gastown-witness"},
|
|
{"gastown/refinery", "gt-gastown-refinery"},
|
|
{"gastown/alpha", "gt-gastown-polecat-alpha"},
|
|
{"gastown/crew/max", "gt-gastown-crew-max"},
|
|
{"beads/witness", "gt-beads-witness"},
|
|
{"beads/beta", "gt-beads-polecat-beta"},
|
|
// Invalid addresses should return empty string
|
|
{"invalid", ""},
|
|
{"", ""},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.address, func(t *testing.T) {
|
|
got := addressToAgentBeadID(tt.address, townName)
|
|
if got != tt.expected {
|
|
t.Errorf("addressToAgentBeadID(%q, %q) = %q, want %q", tt.address, townName, got, tt.expected)
|
|
}
|
|
})
|
|
}
|
|
}
|