fix(mail): normalize crew/polecats paths in addressToIdentity

Strip crew/ and polecats/ from addresses before identity conversion.
This ensures beads/crew/dave and beads/dave both resolve to beads-dave,
fixing the inbox mismatch bug (hq-0ol).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-21 10:06:13 -08:00
parent 199da5aa9b
commit 9a631b9195

View File

@@ -284,6 +284,8 @@ func ParseMessageType(s string) MessageType {
// - "gastown/Toast" → "gastown-Toast"
// - "gastown/refinery" → "gastown-refinery"
// - "gastown/" → "gastown" (rig broadcast)
// - "beads/crew/dave" → "beads-dave" (crew/ stripped)
// - "beads/polecats/nux" → "beads-nux" (polecats/ stripped)
func addressToIdentity(address string) string {
// Town-level agents: mayor and deacon keep trailing slash
if address == "mayor" || address == "mayor/" {
@@ -298,6 +300,12 @@ func addressToIdentity(address string) string {
address = address[:len(address)-1]
}
// Normalize worker paths: strip crew/ and polecats/ from path
// beads/crew/dave → beads/dave (both resolve to beads-dave)
// beads/polecats/nux → beads/nux (both resolve to beads-nux)
address = strings.Replace(address, "/crew/", "/", 1)
address = strings.Replace(address, "/polecats/", "/", 1)
// Replace / with - for beads identity
// gastown/Toast → gastown-Toast
result := ""